Adding “VHD & ZFS 24” support to Xen 4.0.*.rc* source & kernels packaged for Ubuntu Virtualusr’s Blog

To test NexentaStor-3.0.2.xen.tar.bz2 at Xen 4.0.1-rc3 & 2.6.32.16 pvops Dom0 on top of Ubuntu 10.04 Server. Apply patch bellow to packageXen40x.sh.Notice , that 4.0.1 doesn’t support either ZFS 24 or VHD disk devices by default.
Two patches mentioned bellow ( for VHD support, ZFS 24 support) may be applied as usual to clone of http://xenbits.xensource.com/xen-4.0-testing.hg for straightforward Xen & Tools build and install.

--- packageXen40x.sh.orig	2010-07-16 15:33:03.756414641 +0400
+++ packageXen40x.sh	2010-07-16 15:40:31.546289159 +0400
@@ -35,6 +35,8 @@
 [ -r mk_ub_pgk_source.sh ] && sh mk_ub_pgk_source.sh $SDSC
 
 # Retreive latest release tag if not specified
+cp fsimage-zfs-24.patch1 $WRKD
+cp blktap2_ctrl_func.patch-xen-testing-4.x.patch1 $WRKD
 cd $WRKD
 [ ! -d $REPOS -a -d ../$REPOS ] && ln -sv ../$REPOS .
 if [ -z "$LREL" ]; then
@@ -43,7 +45,7 @@
 	[ -d $REPOS ] || hg clone $REPURL #http://xenbits.xensource.com/$REPOS
 	cd $WRKD/$REPOS
 	LREL=$(hg tags | sed '/^tip\b /d' | sed -n '1 s/  *.*//p')      # RELEASE-4.0.0
-	hg pull; hg update
+	hg pull; hg update;
 fi
 RELTAG=$(echo $LREL | sed 's/^RELEASE-//;s/-\([^-]*\)$/\1/')	# 4.0.0
 
@@ -66,6 +68,9 @@
 cd $WRKD/$DEBDIRNAM
 echo Info: Patch with debian diff $UDIFNAME ...
 zcat $STARTDIR/$UDIFNAME | patch -p1
+echo "Info: ZFS & VHD patching"
+        patch -p1 -s -i $WRKD/fsimage-zfs-24.patch1;
+        patch -p1 -s -i $WRKD/blktap2_ctrl_func.patch-xen-testing-4.x.patch1;
 echo Info: Tag change log with the version: $RELTAG-0ubuntu1
 test "$RELTAG" != "4.0.0" && \
 	dch -b --newversion $RELTAG-0ubuntu1 "Automated rebuild atempt for new upstream version."

Run ./packageXen40x.sh 4.0.1-rc3 will result building debian packages
root@ServerLDX:/usr/src/build/xen40-lucid# ls -l *.deb

-rw-r--r-- 1 root root  279808 2010-07-16 14:53 libxen4_4.0.1rc3-0ubuntu1_amd64.deb
-rw-r--r-- 1 root root  398908 2010-07-16 14:53 libxen4-dev_4.0.1rc3-0ubuntu1_amd64.deb
-rw-r--r-- 1 root root 1051920 2010-07-16 14:53 python-xen-4.0_4.0.1rc3-0ubuntu1_amd64.deb
-rw-r--r-- 1 root root 2592098 2010-07-16 14:53 xen-docs-4.0_4.0.1rc3-0ubuntu1_all.deb
-rw-r--r-- 1 root root  685676 2010-07-16 14:53 xen-hypervisor-4.0_4.0.1rc3-0ubuntu1_amd64.deb
-rw-r--r-- 1 root root 5874246 2010-07-16 14:53 xen-utils-4.0_4.0.1rc3-0ubuntu1_amd64.deb

which been installed would build Hypervisor with required features , not present by default in Xen 4.0.1.

exeCooler’s blktap2_ctrl_func.patch-xen-testing-4.x.patch

diff -r 2c3495f3ca84 tools/python/xen/util/blkif.py
--- a/tools/python/xen/util/blkif.py	Fri Jun 04 10:50:55 2010 +0100
+++ b/tools/python/xen/util/blkif.py	Sun Jun 06 23:48:50 2010 +0400
@@ -87,7 +87,7 @@
                 fn = "/dev/%s" %(fn,)
                
         if typ in ("tap", "tap2"):
-            (taptype, fn) = fn.split(":", 1)
+            (taptype, fn) = fn.split(":", 2)[1:3]
     return (fn, taptype)
 
 def blkdev_uname_to_file(uname):
diff -r 2c3495f3ca84 tools/python/xen/xend/XendBootloader.py
--- a/tools/python/xen/xend/XendBootloader.py	Fri Jun 04 10:50:55 2010 +0100
+++ b/tools/python/xen/xend/XendBootloader.py	Sun Jun 06 23:48:50 2010 +0400
@@ -38,10 +38,15 @@
         msg = "Bootloader isn't executable"
         log.error(msg)
         raise VmError(msg)
-    if not os.access(disk, os.R_OK):
-        msg = "Disk isn't accessible"
-        log.error(msg)
-        raise VmError(msg)
+    attempt = 0
+    while True:
+        if not os.access(disk, os.R_OK) and attempt > 3:
+            msg = "Disk isn't accessible"
+            log.error(msg)
+            raise VmError(msg)
+        else:
+            break
+        attempt = attempt + 1
 
     if os.uname()[0] == "NetBSD" and disk.startswith('/dev/'):
        disk = disk.replace("/dev/", "/dev/r")
diff -r 2c3495f3ca84 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jun 04 10:50:55 2010 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py	Sun Jun 06 23:48:50 2010 +0400
@@ -3269,7 +3269,7 @@
                     log.info("Unmounting %s from %s." %
                              (fn, BOOTLOADER_LOOPBACK_DEVICE))
 
-                    dom0.destroyDevice('tap', BOOTLOADER_LOOPBACK_DEVICE)
+                    dom0.destroyDevice(devtype, BOOTLOADER_LOOPBACK_DEVICE, force = True)
 
             if blcfg is None:
                 msg = "Had a bootloader specified, but can't find disk"


References
1. http://old.nabble.com/-PATCH–RESUBMIT–sync-up-zfs-boot-support-in-pygrub-p28236835.html
2. http://virtualusr.wordpress.com/2010/07/14/xen-4-0-rc-source-kernels-packaged-for-ubuntu/

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

%d bloggers like this: