Sunday, July 11, 2010


exeCooler's patch



diff -r a672af698bc3 tools/python/xen/util/blkif.py
--- a/tools/python/xen/util/blkif.py Fri Jul 09 12:35:58 2010 +0100
+++ b/tools/python/xen/util/blkif.py Sun Jul 11 12:13:34 2010 +0400
@@ -87,7 +87,10 @@
fn = "/dev/%s" %(fn,)

if typ in ("tap", "tap2"):
- (taptype, fn) = fn.split(":", 1)
+ if fn.count(":") == 1:
+ (taptype, fn) = fn.split(":", 1)
+ else:
+ (taptype, fn) = fn.split(":", 2)[1:3]
return (fn, taptype)

def blkdev_uname_to_file(uname):

diff -r a672af698bc3 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Fri Jul 09 12:35:58 2010 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Sun Jul 11 17:16:39 2010 +0400
@@ -3261,6 +3261,7 @@

taptype = blkdev_uname_to_taptype(disk)
mounted = devtype in ['tap', 'tap2'] and taptype != 'aio' and taptype != 'sync' and not os.stat(fn).st_rdev
+ mounted_vbd_uuid = 0
if mounted:
# This is a file, not a device. pygrub can cope with a
# file if it's raw, but if it's QCOW or other such formats
@@ -3276,7 +3277,8 @@

from xen.xend import XendDomain
dom0 = XendDomain.instance().privilegedDomain()
- dom0._waitForDeviceUUID(dom0.create_vbd(vbd, disk))
+ mounted_vbd_uuid = dom0.create_vbd(vbd, disk);
+ dom0._waitForDeviceUUID(mounted_vbd_uuid)
fn = BOOTLOADER_LOOPBACK_DEVICE

try:
@@ -3286,8 +3288,9 @@
if mounted:
log.info("Unmounting %s from %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))
-
- dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE)
+ _, vbd_info = dom0.info['devices'][mounted_vbd_uuid]
+ dom0.destroyDevice(dom0.getBlockDeviceClass(vbd_info['devid']),
+ BOOTLOADER_LOOPBACK_DEVICE, force = True)

if blcfg is None:
msg = "Had a bootloader specified, but can't find disk"

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

Saturday, April 24, 2010

Set up Ubuntu 10.04 Server PV DomU at Xen 4.0 Dom0 (pvops 2.6.32.10 kernel) Dom0 on top of Ubuntu 10.04 Server

The procedure bellow in general follows Thiago's Martins submission to xen-devel mailing list.However,sequence of steps has been changed, git checkout procedure is more straight
forward and one Change-set from xen-4.0-testing.hg back ported to Xen 4.0 to support grub2 notation '(hd0,1)' specific for Ubuntu 10.04 aka Lucid Lynx. The way it worked on Ubuntu 9.10 (04) Servers doesn't work any longer


apt-get install libcurl4-openssl-dev \
xserver-xorg-dev \
mercurial gitk \
build-essential \
libncurses5-dev \
uuid-dev gawk \
gettext texinfo bcc \
libncurses5-dev dpkg-dev debhelper \
iasl texinfo


apt-get build-dep xen-3.3

Now git clone and checkout branch xen/stable

cd /usr/src
git clone
git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git linux-2.6-xen
cd linux-2.6-xen
git checkout -b xen/stable origin/xen/stable

Build kernel in Debian way

make menuconfig # Enabled the dom0 support and the Xen backend as usual on Ubuntu 9.10, F12
make -j2
chmod g-s /usr/src -R
make deb-pkg
dpkg -i ../linux-image*2.6.32.10*.deb
depmod 2.6.32.10
update-initramfs -c -k 2.6.32.10
update-grub
echo "xen-evtchn" >> /etc/modules

At this point kernel is installed


Set up Xen 4.0 Hypervisor
cd /usr/src
Creare grub2-fix.patch1
as raw content of http://xenbits.xensource.com/xen-4.0-testing.hg?rev/065efaec5e71
Changeset 21112 pygrub: Fix Grub2 support for Ubuntu 10.04

gunzip xen-4.0.0.tar.gz
tar -xvf xen-4.0.0.tar
cd xen-4.0.0
patch -p1 -s -i ../grub2-fix.patch1
make xen
make tools
make install-xen
make install-tools PYTHON_PREFIX_ARG=


Set up xend,xendomains to run as services

update-rc.d xend defaults 20 21
update-rc.d xendomains defaults 21 20

Test Xen installation via creation Ubuntu 10.04 Server PV DomU
Create HVM DomU via profile

kernel="/usr/lib/xen/boot/hvmloader"
builder="hvm"
memory=2048
name="LucidSRV"
vcpus=1
vif = [ 'type=ioemu,bridge=eth0' ]
disk = [ 'phy:/dev/sdc5,hda,w']
device_model = "/usr/lib64/xen/bin/qemu-dm"
boot="d"
vnc=1

Due to CS 21112 PV DomU based on the same image may be loaded via profile

name="LucidPVG"
memory=2048
vcpus=1
bootloader="/usr/local/bin/pygrub"
disk=['phy:/dev/sdc5,xvda,w']
vif= ['bridge=eth0']
vfb=['type=vnc,vncunused=1']