You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@vcl.apache.org by Young h Oh <oh...@us.ibm.com> on 2011/12/01 17:24:40 UTC

Converting VMware Windows Images into KVM images

Hi All,

I've working on the integration between IBM SmartCloud Provisioning and VCL
and I found some useful tips and issues on converting VMware Windows images
into KVM images.

For the VMware Linux image case, you could directly convert  VMware Linux
images into KVM (libvirt) images using 'qemu-img' command.

$ qemu-img convert Your-VMware-Linux-flat.vmdk -O raw (/qcow2)
KVM-Linux.img

However, if you try to directly convert a VMware Windows images into KVM
images using 'qemu-img' command, you might have the BOD (blue screen of
Death) issue on boot of the converted images in KVM.  The main reason for
BOD problem is that most VMware Windows images are installed on SCSI
virtual disk  but KVM requires IDE device driver for converted images. To
solve this problem, you might have different methods but I'd like to
introduce how I solved that problem. I updated the Windows Registry of the
images offline to  using libguestfs library in RHEL 6 (host). The detailed
steps are follows:

===============================
1. Prepare OS
-  RHEL 6 X86_64
Notes: libguestfs-winsupport package is only needed on RHE 6 hosts

2. Install packages (qemu-img, all libguestfs related packages:
http://libguestfs.org/ )
$ yum install qemu-img '*libguestfs*'

3. Download and install  'libguestfs-winsupport' (windows support package)
(
http://rpm.pbone.net/index.php3/stat/4/idpl/16605602/dir/scientific_linux_6/com/libguestfs-winsupport-1.0-7.el6.x86_64.rpm.html
 )
$ rpm -i libguestfs-winsupport-1.0-7.el6.x86_64.rpm
=> You will see virt-win-reg command now (virt-win-reg manual :
http://libguestfs.org/virt-win-reg.1.html#currentcontrolset_etc_ )

4. Download and modify mergeide.reg
(http://www.proxmox.com/downloads/proxmox-ve/misc/59-mergeide )
=> Replace all CurrentControlSet => ControlSet001
e.g) vi mergeide.reg
:1,$s/CurrentControlSet/ControlSet001/g

5. Define KVM xml file

6. Converting Images
$ qemu-img convert Your-VMware-Windows-flat.vmdk Your-KVM-Windows.img
$ virt-win-reg --merge Your-KVM-Windows.img mergeide.reg
$ virsh --connect qemu:///system define Your_Image.xml
$ virsh start Your_Image_Domain

Note: I do NOT have any issues on this method but you might do this at your
own risks.
===============================

Thanks,
--------------------------------------------------------------------
Young Hyun Oh
IBM, Tivoli CTO Technology and Architecture


Re: Converting VMware Windows Images into KVM images

Posted by Aaron Peeler <aa...@ncsu.edu>.
Very cool. This will be helpful as we move forward on the libvirt/kvm module.

It looks like this could be automated within the vcl code.

Thanks,
Aaron

On Thu, Dec 1, 2011 at 11:24 AM, Young h Oh <oh...@us.ibm.com> wrote:
>
> Hi All,
>
> I've working on the integration between IBM SmartCloud Provisioning and VCL
> and I found some useful tips and issues on converting VMware Windows images
> into KVM images.
>
> For the VMware Linux image case, you could directly convert  VMware Linux
> images into KVM (libvirt) images using 'qemu-img' command.
>
> $ qemu-img convert Your-VMware-Linux-flat.vmdk -O raw (/qcow2)
> KVM-Linux.img
>
> However, if you try to directly convert a VMware Windows images into KVM
> images using 'qemu-img' command, you might have the BOD (blue screen of
> Death) issue on boot of the converted images in KVM.  The main reason for
> BOD problem is that most VMware Windows images are installed on SCSI
> virtual disk  but KVM requires IDE device driver for converted images. To
> solve this problem, you might have different methods but I'd like to
> introduce how I solved that problem. I updated the Windows Registry of the
> images offline to  using libguestfs library in RHEL 6 (host). The detailed
> steps are follows:
>
> ===============================
> 1. Prepare OS
> -  RHEL 6 X86_64
> Notes: libguestfs-winsupport package is only needed on RHE 6 hosts
>
> 2. Install packages (qemu-img, all libguestfs related packages:
> http://libguestfs.org/ )
> $ yum install qemu-img '*libguestfs*'
>
> 3. Download and install  'libguestfs-winsupport' (windows support package)
> (
> http://rpm.pbone.net/index.php3/stat/4/idpl/16605602/dir/scientific_linux_6/com/libguestfs-winsupport-1.0-7.el6.x86_64.rpm.html
>  )
> $ rpm -i libguestfs-winsupport-1.0-7.el6.x86_64.rpm
> => You will see virt-win-reg command now (virt-win-reg manual :
> http://libguestfs.org/virt-win-reg.1.html#currentcontrolset_etc_ )
>
> 4. Download and modify mergeide.reg
> (http://www.proxmox.com/downloads/proxmox-ve/misc/59-mergeide )
> => Replace all CurrentControlSet => ControlSet001
> e.g) vi mergeide.reg
> :1,$s/CurrentControlSet/ControlSet001/g
>
> 5. Define KVM xml file
>
> 6. Converting Images
> $ qemu-img convert Your-VMware-Windows-flat.vmdk Your-KVM-Windows.img
> $ virt-win-reg --merge Your-KVM-Windows.img mergeide.reg
> $ virsh --connect qemu:///system define Your_Image.xml
> $ virsh start Your_Image_Domain
>
> Note: I do NOT have any issues on this method but you might do this at your
> own risks.
> ===============================
>
> Thanks,
> --------------------------------------------------------------------
> Young Hyun Oh
> IBM, Tivoli CTO Technology and Architecture
>
>



-- 
Aaron Peeler
Program Manager
Virtual Computing Lab
NC State University

All electronic mail messages in connection with State business which
are sent to or received by this account are subject to the NC Public
Records Law and may be disclosed to third parties.

Re: Converting VMware Windows Images into KVM images

Posted by Young h Oh <oh...@us.ibm.com>.
Hi Andy,

Yea, this is for Windows XP images. I haven't tried to convert Windows 7
images  because I don't have Windows 7 images. But I'm pretty sure they
have different boot loader. And I think you can also disable some other
services using virt-win-reg if you know how to set the registry values for
the service.

The following information is the xml file I used for my test.  One
important thing is you need to set the target dev of the disk is "<target
dev='hda' bus='ide'/>.  If you need more information, please let me know.
Thank you.

=================================================================
<domain type='kvm'>
  <name>windowsxp</name>
  <uuid>2795fa2a-eeaf-bb1d-9431-c0e600ee1d4c</uuid>
  <memory>1024000</memory>
  <currentMemory>1024000</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.0.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/data/vmware/kvm_winxp.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ff:13:d1'/>
      <source bridge='br0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='52:54:00:23:64:87'/>
      <source bridge='br1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0'/>
    </memballoon>
  </devices>
</domain>
=================================================================

Best regards
--------------------------------------------------------------------
Young Hyun Oh
IBM, Tivoli CTO Technology and Architecture



From:	Andy Kurth <an...@ncsu.edu>
To:	vcl-dev@incubator.apache.org
Date:	12/02/2011 10:28 AM
Subject:	Re: Converting VMware Windows Images into KVM images



Thanks Young.  This information is very much appreciated.  I'm
assuming this is an XP image?  I have tried it on a Win7 image and was
able to get it to boot without having to do the registry merge step.
I'm assuming this is because of the different boot loader.  I haven't
tried it on other versions yet.  One important detail was that I had
to enable ACPI in the XML for the VM.

As Aaron mentioned, we should be able to automate this in the code.
The guest OS tools for KVM are pretty cool.  There are many things we
can do using virt-win-reg to access the registry along with guestfish
to access the offline image filesystem.  For example, we could disable
Sysprep and VMware Tools on existing images before they boot under
KVM.  We should also be able to inject drivers.

I'd also be curious to see what settings ISAAC is adding to the XML
file.  I'm working on integrating the KVM code contributed by Xianqing
Yu.  There may be some settings I'm not aware of which could be
beneficial.

Thanks,
Andy

On Thu, Dec 1, 2011 at 11:24 AM, Young h Oh <oh...@us.ibm.com> wrote:
>
> Hi All,
>
> I've working on the integration between IBM SmartCloud Provisioning and
VCL
> and I found some useful tips and issues on converting VMware Windows
images
> into KVM images.
>
> For the VMware Linux image case, you could directly convert  VMware Linux
> images into KVM (libvirt) images using 'qemu-img' command.
>
> $ qemu-img convert Your-VMware-Linux-flat.vmdk -O raw (/qcow2)
> KVM-Linux.img
>
> However, if you try to directly convert a VMware Windows images into KVM
> images using 'qemu-img' command, you might have the BOD (blue screen of
> Death) issue on boot of the converted images in KVM.  The main reason for
> BOD problem is that most VMware Windows images are installed on SCSI
> virtual disk  but KVM requires IDE device driver for converted images. To
> solve this problem, you might have different methods but I'd like to
> introduce how I solved that problem. I updated the Windows Registry of
the
> images offline to  using libguestfs library in RHEL 6 (host). The
detailed
> steps are follows:
>
> ===============================
> 1. Prepare OS
> -  RHEL 6 X86_64
> Notes: libguestfs-winsupport package is only needed on RHE 6 hosts
>
> 2. Install packages (qemu-img, all libguestfs related packages:
> http://libguestfs.org/ )
> $ yum install qemu-img '*libguestfs*'
>
> 3. Download and install  'libguestfs-winsupport' (windows support
package)
> (
>
http://rpm.pbone.net/index.php3/stat/4/idpl/16605602/dir/scientific_linux_6/com/libguestfs-winsupport-1.0-7.el6.x86_64.rpm.html

>  )
> $ rpm -i libguestfs-winsupport-1.0-7.el6.x86_64.rpm
> => You will see virt-win-reg command now (virt-win-reg manual :
> http://libguestfs.org/virt-win-reg.1.html#currentcontrolset_etc_ )
>
> 4. Download and modify mergeide.reg
> (http://www.proxmox.com/downloads/proxmox-ve/misc/59-mergeide )
> => Replace all CurrentControlSet => ControlSet001
> e.g) vi mergeide.reg
> :1,$s/CurrentControlSet/ControlSet001/g
>
> 5. Define KVM xml file
>
> 6. Converting Images
> $ qemu-img convert Your-VMware-Windows-flat.vmdk Your-KVM-Windows.img
> $ virt-win-reg --merge Your-KVM-Windows.img mergeide.reg
> $ virsh --connect qemu:///system define Your_Image.xml
> $ virsh start Your_Image_Domain
>
> Note: I do NOT have any issues on this method but you might do this at
your
> own risks.
> ===============================
>
> Thanks,
> --------------------------------------------------------------------
> Young Hyun Oh
> IBM, Tivoli CTO Technology and Architecture
>




Re: Converting VMware Windows Images into KVM images

Posted by Andy Kurth <an...@ncsu.edu>.
Thanks Young.  This information is very much appreciated.  I'm
assuming this is an XP image?  I have tried it on a Win7 image and was
able to get it to boot without having to do the registry merge step.
I'm assuming this is because of the different boot loader.  I haven't
tried it on other versions yet.  One important detail was that I had
to enable ACPI in the XML for the VM.

As Aaron mentioned, we should be able to automate this in the code.
The guest OS tools for KVM are pretty cool.  There are many things we
can do using virt-win-reg to access the registry along with guestfish
to access the offline image filesystem.  For example, we could disable
Sysprep and VMware Tools on existing images before they boot under
KVM.  We should also be able to inject drivers.

I'd also be curious to see what settings ISAAC is adding to the XML
file.  I'm working on integrating the KVM code contributed by Xianqing
Yu.  There may be some settings I'm not aware of which could be
beneficial.

Thanks,
Andy

On Thu, Dec 1, 2011 at 11:24 AM, Young h Oh <oh...@us.ibm.com> wrote:
>
> Hi All,
>
> I've working on the integration between IBM SmartCloud Provisioning and VCL
> and I found some useful tips and issues on converting VMware Windows images
> into KVM images.
>
> For the VMware Linux image case, you could directly convert  VMware Linux
> images into KVM (libvirt) images using 'qemu-img' command.
>
> $ qemu-img convert Your-VMware-Linux-flat.vmdk -O raw (/qcow2)
> KVM-Linux.img
>
> However, if you try to directly convert a VMware Windows images into KVM
> images using 'qemu-img' command, you might have the BOD (blue screen of
> Death) issue on boot of the converted images in KVM.  The main reason for
> BOD problem is that most VMware Windows images are installed on SCSI
> virtual disk  but KVM requires IDE device driver for converted images. To
> solve this problem, you might have different methods but I'd like to
> introduce how I solved that problem. I updated the Windows Registry of the
> images offline to  using libguestfs library in RHEL 6 (host). The detailed
> steps are follows:
>
> ===============================
> 1. Prepare OS
> -  RHEL 6 X86_64
> Notes: libguestfs-winsupport package is only needed on RHE 6 hosts
>
> 2. Install packages (qemu-img, all libguestfs related packages:
> http://libguestfs.org/ )
> $ yum install qemu-img '*libguestfs*'
>
> 3. Download and install  'libguestfs-winsupport' (windows support package)
> (
> http://rpm.pbone.net/index.php3/stat/4/idpl/16605602/dir/scientific_linux_6/com/libguestfs-winsupport-1.0-7.el6.x86_64.rpm.html
>  )
> $ rpm -i libguestfs-winsupport-1.0-7.el6.x86_64.rpm
> => You will see virt-win-reg command now (virt-win-reg manual :
> http://libguestfs.org/virt-win-reg.1.html#currentcontrolset_etc_ )
>
> 4. Download and modify mergeide.reg
> (http://www.proxmox.com/downloads/proxmox-ve/misc/59-mergeide )
> => Replace all CurrentControlSet => ControlSet001
> e.g) vi mergeide.reg
> :1,$s/CurrentControlSet/ControlSet001/g
>
> 5. Define KVM xml file
>
> 6. Converting Images
> $ qemu-img convert Your-VMware-Windows-flat.vmdk Your-KVM-Windows.img
> $ virt-win-reg --merge Your-KVM-Windows.img mergeide.reg
> $ virsh --connect qemu:///system define Your_Image.xml
> $ virsh start Your_Image_Domain
>
> Note: I do NOT have any issues on this method but you might do this at your
> own risks.
> ===============================
>
> Thanks,
> --------------------------------------------------------------------
> Young Hyun Oh
> IBM, Tivoli CTO Technology and Architecture
>