Getting virt-install to work with Xen 4.0 guests on top of Ubuntu 10.04 Server

Set up Xen 4.0 Dom0 with pvops kernel 2.6.32.12 on top of Ubuntu 10.04 Server ([2]) . Install packages

# apt-get install virtinst python-virtinst virt-viewer

It’s important to specify “–connect xen:///” inside virt-install command line to succeed with VNC console launching (vs 9.10) . Another option just to patch virt-install on 10.04

--- virt-install.orig 2010-05-02 23:52:23.105726451 +0400
+++ virt-install 2010-05-05 15:55:10.025151535 +0400
@@ -675,9 +675,8 @@

def vnc_console(dom, uri):
- args = ["/usr/bin/virt-viewer"]
- if uri is not None and uri != "":
- args = args + [ "--connect", uri]
+ args = ["/usr/bin/virt-viewer"]
+ args = args + [ "--connect", "xen:///"]
args = args + [ "--wait", "%s" % dom.ID()]
child = os.fork()
if not child:

Variable VIRSH_DEFAULT_CONNECT_URI exported via .bashrc in my case caused virt-install to crash.Comment out (xend-unix-server yes) in /etc/xen/xend-config.sxp and export variable

export VIRSH_DEFAULT_CONNECT_URI="xen:///"

in root’s .bashrc. Then reboot Xen Host.

root@ServerLnx:~# virsh version
Compiled against library: libvir 0.7.5
Using library: libvir 0.7.5
Using API: Xen 3.0.1
Running hypervisor: Xen 4.0.0

Now run :

root@ServerLnx:/home/boris/lnx# virt-install --connect xen:/// -n LucidLNX -r 1024 --hvm --vnc -f /dev/sda8 -c /home/boris/lnx/LucidSRV.iso --debug
Tue, 04 May 2010 20:16:05 DEBUG Launched with command line:
/usr/bin/virt-install --connect xen:/// -n LucidLNX -r 1024 --hvm --vnc -f /dev/sda8 -c /home/boris/lnx/LucidSRV.iso --debug
Tue, 04 May 2010 20:16:05 DEBUG Requesting libvirt URI xen:///
Tue, 04 May 2010 20:16:05 DEBUG Received libvirt URI xen:///
Tue, 04 May 2010 20:16:05 DEBUG Requesting virt method 'hvm', hv type 'default'.
Tue, 04 May 2010 20:16:05 DEBUG Received virt method 'hvm'
Tue, 04 May 2010 20:16:05 DEBUG Hypervisor name is 'xen'
Tue, 04 May 2010 20:16:05 DEBUG Could not open "/etc/sysconfig/keyboard" [Errno 2] No such file or directory: '/etc/sysconfig/keyboard'
Tue, 04 May 2010 20:16:05 DEBUG Could not open "/etc/X11/xorg.conf": [Errno 2] No such file or directory: '/etc/X11/xorg.conf'
Tue, 04 May 2010 20:16:05 DEBUG DistroInstaller location is a local file/path: /home/boris/lnx/LucidSRV.iso
Starting install...
Tue, 04 May 2010 20:16:05 DEBUG Creating guest from:
<domain type='xen'>
<name>LucidLNX</name>
<currentMemory>1048576</currentMemory>
<memory>1048576</memory>
<uuid>37592841-82ee-2ba7-28de-3801683758d3</uuid>
<os>
<type arch='x86_64'>hvm</type>
<loader>/usr/lib/xen-default/boot/hvmloader</loader>
<boot dev='cdrom'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<vcpu>1</vcpu>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>
<source dev='/dev/sda8'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/home/boris/lnx/LucidSRV.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='bridge'>
<source bridge='eth0'/>
<mac address='00:16:36:7a:e4:2f'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<console type='pty'/>
</devices>
</domain>
Creating domain... 0 B 00:01
Tue, 04 May 2010 20:16:07 DEBUG Created guest, looking to see if it is running
Tue, 04 May 2010 20:16:07 DEBUG Launching console callback
Tue, 04 May 2010 20:16:07 DEBUG Saving XML boot config:
<domain type='xen'>
<name>LucidLNX</name>
<currentMemory>1048576</currentMemory>
<memory>1048576</memory>
<uuid>37592841-82ee-2ba7-28de-3801683758d3</uuid>
<os>
<type arch='x86_64'>hvm</type>
<loader>/usr/lib/xen-default/boot/hvmloader</loader>
<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>
<vcpu>1</vcpu>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>
<source dev='/dev/sda8'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='block' device='cdrom'>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='bridge'>
<source bridge='eth0'/>
<mac address='00:16:36:7a:e4:2f'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<console type='pty'/>
</devices>
</domain>






Also make sure that CONFIG_GNT_DEV=y in .config file of pvops kernel . Snapshot bellow



Otherwise virsh start will hang and /var/log/xen/qemu-dm-DomainName.log will report

ERROR Internal error: Could not open grant table interface (22 = Invalid argument)
xen be core: xen be core: can't open gnttab device can't open gnttab device

Virt-install F12 PV DomU:-

root@ServerLnx:~# virt-install --connect xen:/// --name VF12P --ram 2000 -f /dev/sda7 --vnc --location http://192.168.1.38/f12 --debug
Tue, 04 May 2010 20:55:09 DEBUG Launched with command line:
/usr/bin/virt-install --connect xen:/// --name VF12P --ram 2000 -f /dev/sda7 --vnc --location http://192.168.1.38/f12 --debug
Tue, 04 May 2010 20:55:09 DEBUG Requesting libvirt URI xen:///
Tue, 04 May 2010 20:55:09 DEBUG Received libvirt URI xen:///
Tue, 04 May 2010 20:55:09 DEBUG Requesting virt method 'default', hv type 'default'.
Tue, 04 May 2010 20:55:09 DEBUG Received virt method 'xen'
Tue, 04 May 2010 20:55:09 DEBUG Hypervisor name is 'xen'
Tue, 04 May 2010 20:55:09 DEBUG Could not open "/etc/sysconfig/keyboard" [Errno 2] No such file or directory: '/etc/sysconfig/keyboard'
Tue, 04 May 2010 20:55:09 DEBUG Could not open "/etc/X11/xorg.conf": [Errno 2] No such file or directory: '/etc/X11/xorg.conf'
Tue, 04 May 2010 20:55:09 DEBUG DistroInstaller location is a network source.
Starting install...
Tue, 04 May 2010 20:55:09 DEBUG Attempting to detect distro:
Tue, 04 May 2010 20:55:09 DEBUG Fetching URI: http://192.168.1.38/f12/.treeinfo
Tue, 04 May 2010 20:55:09 DEBUG Saved file to /var/lib/libvirt/boot/virtinst-.treeinfo.LJOzek
Retrieving file .treeinfo 100% |=========================| 1.2 kB 00:00
Tue, 04 May 2010 20:55:09 DEBUG Fetching URI: http://192.168.1.38/f12/images/pxeboot/vmlinuz
Tue, 04 May 2010 20:55:09 DEBUG Saved file to /var/lib/libvirt/boot/virtinst-vmlinuz.Rir_53
Retrieving file vmlinuz.. 100% |=========================| 3.3 MB 00:00
Tue, 04 May 2010 20:55:09 DEBUG Fetching URI: http://192.168.1.38/f12/images/pxeboot/initrd.img
Tue, 04 May 2010 20:55:09 DEBUG Saved file to /var/lib/libvirt/boot/virtinst-initrd.img.Ynt0bl
Retrieving file initrd.im 100% |=========================| 22 MB 00:00
Tue, 04 May 2010 20:55:09 DEBUG Auto detected OS type as: linux
Tue, 04 May 2010 20:55:09 DEBUG Auto detected OS variant as: fedora12
Tue, 04 May 2010 20:55:09 DEBUG Creating guest from:
<domain type='xen'>
<name>VF12P</name>
<currentMemory>2048000</currentMemory>
<memory>2048000</memory>
<uuid>e50a231c-a64f-58ee-8c85-b9aca3143222</uuid>
<os>
<type arch='x86_64'>linux</type>
<kernel>/var/lib/libvirt/boot/virtinst-vmlinuz.Rir_53</kernel>
<initrd>/var/lib/libvirt/boot/virtinst-initrd.img.Ynt0bl</initrd>
<cmdline>method=http://192.168.1.38/f12</cmdline>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<vcpu>1</vcpu>
<devices>
<disk type='block' device='disk'>
<source dev='/dev/sda7'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='eth0'/>
<mac address='00:16:36:63:94:49'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
</devices>
</domain>
Creating domain... 0 B 00:01
Tue, 04 May 2010 20:55:11 DEBUG Created guest, looking to see if it is running
Tue, 04 May 2010 20:55:11 DEBUG Launching console callback
Tue, 04 May 2010 20:55:11 DEBUG Saving XML boot config:
<domain type='xen'>
<name>VF12P</name>
<currentMemory>2048000</currentMemory>
<memory>2048000</memory>
<uuid>e50a231c-a64f-58ee-8c85-b9aca3143222</uuid>
<bootloader>/usr/lib/xen-default/bin/pygrub</bootloader>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<vcpu>1</vcpu>
<devices>
<disk type='block' device='disk'>
<source dev='/dev/sda7'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='eth0'/>
<mac address='00:16:36:63:94:49'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
</devices>
</domain>








Starting Domain :-
root@ServerLnx:~# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 6855 4 r----- 501.8
LucidLNX 1024 1 10.3
VF12P 2000 1 34.6
VF12PV 1000 1 15.4
root@ServerLnx:~# virsh start VF12P
Domain VF12P started

root@ServerLnx:~# vncviewer localhost:0
Connected to RFB server, using protocol version 3.8
No authentication needed
Authentication successful
Desktop name "Xen-VF12P"
VNC server default format:
32 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor. Pixel format:
32 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Same machine: preferring raw encoding



References
1.http://librenix.com/?inode=14285
2.http://www.linuxtoday.com/high_performance/2010043000735OSS

One Response to Getting virt-install to work with Xen 4.0 guests on top of Ubuntu 10.04 Server

  1. Rodney says:

    Good post. I learn something totally new and challenging on blogs I stumbleupon on a daily
    basis. It will always be helpful to read articles from other authorrs and practice something from other websites.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s