Blog Article:

Migrating VMDK To/From QCOW2 disks with OpenNebula

José Ángel Garrido Montoya

Nov 21, 2018

Blue Light bulb

OpenNebula allows the management of hybrid environments, offering end-users a self-service portal to consume resources from both VMware-based infrastructures and KVM based ones in a transparent way to the user.

In order to smooth the way of migrating workloads to and from KVM to VMware, OpenNebula is working on an awesome feature for its next release (5.8, and probably backported to 5.6.x).

Here’s a quick review of the complete flow of a translation from vmdk to qcow2:

Export image to OpenNebula Marketplace

Suppose you have an vmdk image and you want to use it in KVM. At this point, we can have different situations.

  • We have the image in vmdk datastore. We would need to upload the image to a marketplace.
  • We want to use an image provided by OpenNebula marketplace. In this case, we have to do nothing.

Import to vmdk

Now we know what image we want to use so, we have to download the image to the datastore where we want to store the image. Once the image is downloaded, we are ready to use it!

Add it to a VM Template

Every image downloaded from a MarketPlace, OpenNebula creates a template in order to use it easily when the destination is vcenter, if not we have to create a template with the image. Now we can update the template with hosts, more images, network etc.

Implementation

From an implementation perspective:

  • Every time we download an image, it is downloaded to the frontend.
  • Then, it is converted to the proper type with the “qemu-img convert” command.
  • Finally, OpenNebula will copy the image to the datastore.

From vmdk to qcow2:  We only take into account that we have to set the bus driver.

From qcow2 to vmdk:  Here the limitation is when we convert an image to vmdk, we lose the contextualization. What we have to do is install VMware tools.

Let’s walk through an example

Imagine that we have a qcow2 image within the OpenNebula MarketPlace and we want to use it in vCenter.

1.)  We select the image:

Picture1

2.)  Check that the image has qcow2/raw image, then click on the download button.

Picture2

3.)  Now, we select the vcenter destination datastore.

Picture3

4.)  As we are going to export the image to a vcenter datastore, we should have a void template in order to attach the new image.

Picture4

5.)  Now we are ready to instantiate the template and we will see the vm in vcenter.

Picture5

6.)  And now, we have VNC working.

Picture6

As I mentioned, the plan is for this capability to be included in the upcoming version 5.8, and we will likely backport it to version 5.6.x, as well.  If you have any questions or feedback, send us your input – either on our Developers’ Forum or leave a comment below.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *