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
- vmware-vdiskmanager -r Virtual Disk.vmdk -t 0 NovaWin2k8R2.vmdk
- Get some coffee… step 1 takes a while.
- qemu-image convert NovaWin2k8R2.vmdk -o qcow2 NovaWin2k8R2.qemu
- scp the image to the controller node:
- 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?
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.
I can confirm that step 2 works almost perfectly every single time.
Get a coffee?
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?
Honestly haven’t tried just yet. Have you looked into VMware converter or similar?
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.)
step 3
Capital “-O” not -o
Just wondering what the process is for a VM with more than one hard drive? Is it not possible?
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.