You thought that importing a Windows Virtual Machine from VMware to KVM managed by OpenStack was a difficult task ?
Since Glance has been able to use VMDK disk format, you can easily migrate your infrastructure from VMware to OpenStack without problem. But you should know some tricks before.
Remove VMware tools
Remove the VMware tools via the Windows control panel and reboot the VM.
Enable IDE
Download and execute the mergeide.reg script. You can now boot from IDE that may be necessary for KVM.
Install VirtIO Drivers
- Download the ISO file here.
- Mount it on the Windows Virtual Machine.
- Click on Start Menu, click right on Compute and Manage.
- Select Diagnostics and Device Manager.
- Click right on the Hostname and select Add legacy hardware :
- Click on Next, select Search for and install the hardware automatically, Next, select “Show all devices” and Next.
- Have disk allows you to find the drivers we have previously downloaded. If you are using Windows 2008, the drivers are located in WIN7 folder.
- We should install at least NETKVM and VIOSTOR drivers :
- Before shutting down the VM, be sure to have RDP enabled and also the firewall disabled.
How to merge multiple VMDK files into a single image file
It’s very common to find VMware images in multiple VMDK files (if this is not your case, you can go to next step), so before uploading the image you need to convert it to a single VMDK file.
First thing you need to do is to install VMware Server and use the vmware-vdiskmanager utility under /bin directory. Open a terminal, go the directory where the multiple paths are open and execute this command:
./vmware-vdiskmanager -r multiple_disks.vmdk -t 0 single_file.vmdk
Et voilà ! Your VMDK files are now in a single disk.
Import into Glance
Copy the VMDK to the Glance Server and import it with Glance Client :
glance add name="Win2K8" container_format=bare disk_format=vmdk < win2K8.vmdk
That’s all !
You can now run your Windows instance from Nova CLI or from the Dashboard.
At the first boot, Glance will convert the image to RAW format so don’t worry if it takes 5 minutes at the first time.
The best way to access at your VM is to use RDP. You should allow 3389 (TCP) port into VM Security Group.
Extra : Sysprep the Server
Here is the way to Sysprep the Windows 2008 Virtual Machine :
- Run a terminal and launch “c:\Windows\System32\sysprep\sysprep.exe “
- A graphical tool will appear, we need to specify “Enter System Out-of-Box Experience (OOBE)” in the System Cleanup Action Setting, check “Generalize“, and select “Shutdown” option.
- Click “OK” to start the configuration and the server will shut down itself.
By the way, did you know that StackOps Distro is ready to launch Windows 2008 Virtual Machines ?