[nmglug] kvm ,virt-manager

Brendan synk at swcp.com
Tue May 5 15:46:40 PDT 2009


a wrote:
> Using Ubuntu 9.04 with kvm,virt-manager,I would like to virtualize the
> pre-loaded legacy operating system which is on the computer.
> How do I virtualize the pre-installed os via Ubuntu. ?

I've only done this in Fedora, but it should be pretty much the same 
thing with Ubuntu.  You need an xml description of the virtual machine. 
  Here's one I'm using for a Windows 2000 guest:

<domain type='kvm'>
   <name>win2k-1</name>
   <uuid>40d85ca9-225b-5ae4-f521-a84b19927a36</uuid>
   <memory>1048576</memory>
   <currentMemory>1048576</currentMemory>
   <vcpu>2</vcpu>
   <os>
     <type arch='x86_64' machine='pc'>hvm</type>
     <boot dev='hd'/>
   </os>
   <features>
     <acpi/>
     <apic/>
     <pae/>
   </features>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-kvm</emulator>
     <disk type='block' device='disk'>
       <source dev='/dev/vg0/win2k-1'/>
       <target dev='hda' bus='ide'/>
     </disk>
     <interface type='bridge'>
       <mac address='00:11:4f:a4:c2:f0'/>
       <source bridge='br0'/>
     </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'/>
   </devices>
</domain>

You will need to create a br0 interface if you want networking.  Tweak 
the memory, vcpus and most importantly the path to the volume.  That's 
an LVM disk image that I'm using.  You could just specify /dev/hdb if 
that's where your legacy OS is.

Anyway, save the xml file somewhere (Mine's under 
/etc/libvirt/qemu/win2k-1.xml) and use virsh to create the domain:

virsh create /path/to/your/description.xml

Or you could just use virt-manager to to all this.  What's the problem? 
  Double click on localhost, then click on the "New" button on the 
bottom right.  Fill in the blanks.

-Brendan



More information about the nmglug mailing list