OpenStack & VMWare VM Disk Migration
Migration from OpenStack to VMWare
1. Obtain VM disk image from OpenStack infrastructure
You can also use glance client (see the annexe for further information on installation and version):
$ glance -I <user> -K <pass> -T <tenant> -N <url>/v2.0 image-download --progress --file <vmImageFile> <imageId>
2. Convert vmdisk.qcow2 into a vmdisk.vmdk format (supported by VMWare)
3. Create a vm.vmx container for vmdisk.vmdk
When creating vm.vmx metadata file, make sure the disk file vmdisk.vmdk is in the same directory. There are plenty of parameters VMWare allows you to set, you can start using these (you can see the documentation for more information):
config.version = "6"
memsize = "1024"
displayName = "vm"
scsi0.present = "true"
scsi0.sharedBus = "none"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
scsi0:0.fileName = "vmdisk.vmdk"
scsi0:0.deviceType = "scsi-hardDisk"
virtualHW.productCompatibility = "hosted"
|
4. Import the VM image (vm.vmx + vmdisk.vmdk) into VMWare infrastructure
That's all. You should see your new VM called "vm" (see the .vmx file, property displayName) booting.
Migration from VMWare to OpenStack
1. Obtain the OVF container file of the VM VMWare infrastructure
This will download the OVF file together with some other files, like the VMDK disk file. It usually has the name vm-disk1.vmdk .
2. Convert VM disk file into a QCOW2 format disk file (supported by OpenStack)
Note: use qemu-img v1.2 or newer to avoid a weird sector error. See the Annexe for further information on version and installation.
3. Import the QCOW2 disk image into Glance
4. Start the VM using the OpenStack API
You can also do it through command line using nova client:
$ nova --os-username <user> --os-password <password> --os-tenant-name <tenant> --os-auth-url <url/v2.0> boot --image <imageId> --flavor <newVmFlavorId> <newVmName>
Annexe
Install glance client (v0.12.0.49)$ cd python-glanceclient
$ python setup.py install
$ sudo pip install pbr
Install nova client (v2.15.0.237)
$ cd python-novaclient/
$ sudo python setup.py install
Install qemu (v1.2.0)
$ wget http://wiki.qemu.org/download/qemu-1.2.0.tar.bz2
$ tar xfj qemu-1.2.0.tar.bz2
$ cd qemu-1.2.0
$ ./configure && make qemu-img
Some other references
Here there is a very interesting article I found about VM image containers and disk formats.
That's all folks.