Convert & Import a VMware Image to OpenStack (KVM)

In playing around with the OpenStack Private Cloud distro (here), it comes with two Linux distributions by default. However, having come from a Windows background, I needed to get that going. In order to do that, I first had to convert one of my existing Windows images to a KVM format, that is what follows:

Prerequisites

  • A flat VMDK file or vmware-vdiskmanager (Part of the VDDK toolkit)
  • QEMU

Conversion Process

Note: This will take a lot of time, and quite a bit of space… I used a helper VM to do the conversions with both vmware-vdiskmanager and QEMU installed along with an NFS mount to some decent storage.

Starting with a sparse file (lots of little 2 GB vmdks):
-rwxr-xr-x  1 provmware provmware 2.5K Aug 17 19:28 NovaWin2k8R2.vmx
-rw-r–r–  1 provmware provmware  267 Aug 17 19:28 NovaWin2k8R2.vmxf
-rw——-  1 provmware provmware 1.5G Aug 17 19:30 Virtual Disk-s001.vmdk
-rw——-  1 provmware provmware 1.9G Aug 17 19:33 Virtual Disk-s002.vmdk
-rw——-  1 provmware provmware 2.0G Aug 17 19:35 Virtual Disk-s003.vmdk
-rw——-  1 provmware provmware 1.6G Aug 17 19:37 Virtual Disk-s004.vmdk
-rw——-  1 provmware provmware 320K Aug 17 19:37 Virtual Disk-s005.vmdk
-rw——-  1 provmware provmware 320K Aug 17 19:37 Virtual Disk-s006.vmdk

  1. vmware-vdiskmanager -r Virtual Disk.vmdk -t 0 NovaWin2k8R2.vmdk
  2. Get some coffee… step 1 takes a while.
  3. qemu-image convert NovaWin2k8R2.vmdk -o qcow2 NovaWin2k8R2.qemu
  4. scp the image to the controller node:
    1. scp ./NovaWin2k8R2.qemu alamo@10.0.1.176:/home/alamo

Import to OpenStack (KVM)

Now that you have this image… you need to get it to your OpenStack Glance server. When using the Rackspace Private Cloud distro as we are, this is on your controller node:

# glance add name=Win2k8R2 is_public=true container_format=raw disk_format=qcow2 <  ./NovaWin2k8R2.qemu
Uploading image ‘Win2k8R2’

Everything above from “glance add” to “qemu” is a single line.

Can we start it?

image

Well, I’m not really sure. If you recall from my first post, at this point, all of this is running nested with that Windows image being 64bit and my underlying hardware does not support all of what is needed to run nested 64bit VMs (it does 32bit like a boss, however).

Summary

Is this working for you? Is it not? Did I miss the point? Drop a note in the comments. Also, follow me on twitter here.

10 thoughts on “Convert & Import a VMware Image to OpenStack (KVM)

  • Do u know if the same usecase works the otherway? If i can use a qcow2 image and convert it to a vmdk file and provision on ESX host using Openstack?

  • I’m trying this with OpenStack Folsom and having problems. Could you please provide any pointers?

    I have a single flat VMDX from a Linux VM exported from VMware ESX 5.1. I execute “glance -A $my_keystone_key image-create –name=”hostname_xyz” –is-public=true –container-format=ovf –disk-format=raw < /tmp/clone-disk1.vmdk". Glance accepts the image, but I receive an error when starting an instance from the image. I don't see any log files that explain the error.

    I have also tried –disk-format=vmdk.

    (Sorry, I know this isn't much to go on.)

  • I’ve not tried with more than one. I imagine the “qemu-image convert NovaWin2k8R2.vmdk -o qcow2 NovaWin2k8R2.qemu” command if passed the other VMDK files would convert them. Not sure off the top of my head how to reassemble them on the OpenStack side.

  • I figured out how..But it’s a crazy process involving creating dummy instances, copying the “disk” file into the same directory as the instance you want to have a 2nd drive on, redefining libvirt.xml and..yeah..a bit of a process but works.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.