Migrate a secondary Linux VM disk from vSphere to OpenStack

In this article, we will migrate a secondary Linux VM disk from vSphere to an OpenStack Cinder volume.

Requirements

Note: This article assumes that if the secondary disk uses LVM, the LVM volumes do not span other disks

Step 1 - Convert VMDK to QCOW2


Migrate a secondary Linux VM disk from vSphere to OpenStack Step 1 Convert VMDK to QCOW2

After powering off the VM, note the path of the secondary disk by selecting it in the VM settings. Secondary disks are usually listed after the first disk, unless there is a bios.hddOrder value in the .vmx file for the VM.

Copy the flat VMDK from the ESX host to the Image Library, or a machine with the qemu-img command available.


Screen-Shot-2016-02-03-at-11.19.08-AM

After copying, convert the VMDK to a QCOW2 image.

qemu-img convert -O qcow2 <input vmdk file /> <ouput qcow2 file>

For example:

qemu-img convert -O qcow2 ubuntu14-vm-migration-flat.vmdk ubuntu14-vm-migration-secondary.qcow2

Step 2 - Upload the Image to the Image Library Host

You can simply copy the converted qcow2 image to the Image library host's image directory.


Migrate a secondary Linux VM disk from vSphere to OpenStack Step 2 Upload the Image to the Image Library Host

Upload the Image to the Image Library Host

OR

Follow our support guide on Managing Images with the OpenStack Glance Client if you are not familiar with the OpenStack Glance Client.
Then, use the glance command to upload the image.

For example:

glance image-create --disk-format qcow2 \
--container-format bare \
--file ubuntu14-vm-migration-secondary.qcow2 \
--visibility public \
--name ubuntu14-vm-migration-secondary \
--property pf9_description="Linux VM secondary disk migrated from vSphere" \
--property pf9_virtual_size=26422542336

Step 3 - Create a Cinder Volume

The secondary disk image should now be present in the UI.


Migrate a secondary Linux VM disk from vSphere to OpenStack Step 3 - Create a Cinder Volume

Create a volume from this image by clicking "Create New Volume" from the Volume and Snapshots view.


Migrate a secondary Linux VM disk from vSphere to OpenStack Step 3 - Create a Cinder Volume

Select "Image" in the dropdown menu. Then, select the image for the secondary VM disk.


Screen Shot 2016-02-03 at 11.41.46 AM

Click next, and complete the form to the finish creating the volume.

The volume should soon be in the available state.


Migrate a secondary Linux VM disk from vSphere to OpenStack Step 3 - Create a Cinder Volume

Step 3 - Attach the migrated volume

From the Instances view, select the "Manage Volumes" action to attach the volume to a VM.


Migrate a secondary Linux VM disk from vSphere to OpenStack Step 3 - Create a Cinder Volume

Ensure the volume is attached and click "Update Volumes".


145453293541783

Step 3 - Verify the attached volume

When accessing the VM through the console or SSH, run the lsblk command to verify that the volume was attached.


Screen Shot 2016-02-03 at 12.50.05 PM

Enjoy your newly migrated volume!


February 03, 2016