Tuesday, May 18, 2010


Set up Libvirt 0.7.7&Xen 4.0 on top Fedora 13 RC2


Install Xen 4.0 and Libvirt exactly as in [1].
Via my experience xend will hang for 5-7 min at startup and xen managed bridging will fail as well as at the same time PV guests won't be able to obtain IP via interface virbr0. Workaround for the issue follow bellow. Comment out all xen bridging in /etc/xen/xend-config.sxp

Disable NetworkManager per [2]

# chkconfig NetworkManager off
# chkconfig network on
# service network start
# reboot

Creating network initscripts

In the /etc/sysconfig/network-scripts directory it is neccessary
to create 2 config files. The first (ifcfg-eth0) defines your physical
network interface, and says that it will be part of a bridge:

# cat > ifcfg-eth0 <<EOF
DEVICE=eth0
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
EOF

Obviously change the HWADDR to match your actual NIC's address.


The second config file (ifcfg-br0) defines the bridge device:

# cat > ifcfg-br0 <<EOF
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0
NM_CONTROLLED=no
EOF

Reboot
Now brctl should report :-
[root@FedoraSRV ~]# brctl show

bridge name bridge id STP enabled interfaces
br0 8000.00221563f99f no eth0
virbr0 8000.000000000000 yes

Run virt-install:-

virt-install -n VM13 -r 1024 -p --nographics -f /dev/sdc5 -l http://192.168.1.41/f13 --debug

Set up VNC connection to DomU at runtime. When done login to virsh console to set initdefault to 5 in /etc/inittab and create non-root user. Redefine DomU via XML profile :-

<domain type='xen'>
<name>FedoraPV</name>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<bootloader_args>-q</bootloader_args>
<os>
<type>linux</type>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sdc5'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<mac address='00:16:3e:76:2b:53'/>
<source bridge='br0'/>
<script path='/etc/xen/scripts/vif-bridge'/>
<target dev='vif7.0'/>
</interface>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target port='0'/>
</console>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='5900' autoport='yes'/>
</devices>
</domain>







References
1.http://bderzhavets.wordpress.com/2010/04/14/zfs-24-support-via-pygrub-fsimage-iso-patch-for-xen-4-0-dom0-pvops-2-6-32-11-on-top-of-f12/
2.http://wiki.libvirt.org/page/Networking