Migrate images to/from KVM/vCenter DS¶
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.
We are going to show you both conversions below, step-by-step, through Sunstone:
VMDK Image to QCOW2 Datastore¶
Here is how it works. We have a vmdk image within MarketPlace and we want to use it in KVM:
- Go to MarketPlace and select the image, then click on the Import into Datastore button (with the cloud and arrow icon).
When the destination image datastore is qcow2 or raw, you must define the attribute
DRIVER=raw, respectively, in order to convert the image, otherwise it will be downloaded without any change. To do so, visit the Templates tab for the image, and use the edit icon button to alter the App template before download.
- Select the destination datastore.
- Create a template in order to use the new image.
- Instantiate the template and check that it works.
QCOW2 Image to VMDK Datastore¶
The process is very similar to the one described above.
- Go to MarketPlace and select the image in qcow2 format to be used in a vCenter cluster, then click on the Import into Datastore button.
In this case, when you import to a vcenter datastore
DRIVER=vcenter is set automatically, so you don’t need to define the DRIVER attribute.
- Select the destination image datastore.
- When we download a vmdk image from the marketplace, a template is automatically created along with the image. However, we need a template with a valid vcenter reference for your cloud. We need to define an empty template in vcenter and import it into OpenNebula.
- Now, clone the empty template to make use of the downloaded image.
- Attach the image to the cloned template, so we can keep the original for other VMs.
- Finally, instantiate the template.
How it was implemented¶
When the image that we selected from the MarketPlace is downloaded to the frontend, and the download process is finished, it is converted with the
qemu-img convert tool as follows:
qemu-img convert -f <original_type> -O <destination_type> <original_file> <destination_file>
Then the file is sent to the destination datastore.
Limitations and restrictions¶
We have to take into account that when we convert an image from qcow2/raw to vmdk, the contextualization is lost so, we will have to install VMWare tools manually.