ZFS 24 Support via Pygrub & fsimage.so patch for Xen 4.0 Dom0 (pvops 2.6.32.11) on top of F12

Finally Mark Johnson submitted to xen-devel mailing list patch for ZFS 24 support at Xen 4.0. Patch mentioned bellow was successfully tested at Xen 4.0 Dom0 with pvops kernel 2.6.32.11 on top of Fedora 12 via modifying Michael’s Young xen-4.0.0.7.fc12.src.rpm and direct patching xen 4.0 official tarball on Ubuntu Karmic Koala Server.
Download from [1] fsimage-zfs-24.patch . Then add it to /root/rpmbuild/SOURCES folder created via install xen-4.0.0-0.7.fc12.src.rpm :-

# cd
# wget http://pasik.reaktio.net/fedora/xen-4.0.0-0.7.fc12.src.rpm
# rpm -iv xen-4.0.0-0.7.fc12.src.rpm

Then activate rpmbuild via:-

# yum install transfig texi2html libaio-devel \
dev86 glibc-devel.i686 \
e2fsprogs-devel gitk mkinitrd iasl
# cd /root/rpmbuild/SPECS
# vi xen.spec

Add processing of newly added patch

Patch18 : fsimage-zfs-24.patch
. . . . . .
%patch18 -p1
. . . . . .

Save and build

# rpmbuild -ba ./xen.spec

When done

# cd ../RPMS/x*
# yum install xen-4.0.0-0.7.fc12.x86_64.rpm \
xen-debuginfo-4.0.0-0.7.fc12.x86_64.rpm \
xen-devel-4.0.0-0.7.fc12.x86_64.rpm \
xen-doc-4.0.0-0.7.fc12.x86_64.rpm \
xen-hypervisor-4.0.0-0.7.fc12.x86_64.rpm \
xen-libs-4.0.0-0.7.fc12.x86_64.rpm \
xen-runtime-4.0.0-0.7.fc12.x86_64.rpm

Now activate service :-

# chkconfig xend on
# chkconfig xendomains on
# chkconfig xenconsoled on
# chkconfig xenstored on

and install libvirt 0.7.1-15

# yum install libvirt libvirt-python python-virtinst virt-manager virt-viewer
# chkconfig libvirtd on

Now checkout and build 2.6.32.11 pvops kernel

# 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-2.6.32.x origin/xen/stable-2.6.32.x
# make menuconfig

and tune kernel to support Xen in Dom0

# make -j(x)number_of_cores
# make modules_install install
# mkinitrd /boot/initrd-2.6.32.11.img 2.6.32.11

Create grub’s entry

title Xen 4.0 Fedora (2.6.32.11 stable)
root (hd0,2)
kernel /xen.gz
module /vmlinuz-2.6.32.11 nopat ro root=/dev/mapper/vg_fedora12a-lv_root LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us
module /initrd-2.6.32.11.img

Reboot into Xen environment :-

host : fedora12a
release : 2.6.32.11
version : #13 SMP Wed Apr 7 14:57:48 MSD 2010
machine : x86_64
nr_cpus : 4
nr_nodes : 1
cores_per_socket : 4
threads_per_core : 1
cpu_mhz : 2833
hw_caps : bfebfbff:20100800:00000000:00000940:0408e3fd:00000000:00000001:00000000
virt_caps : hvm
total_memory : 8158
free_memory : 2054
node_to_cpu : node0:0-3
node_to_memory : node0:2054
node_to_dma32_mem : node0:1192
max_node_id : 0
xen_major : 4
xen_minor : 0
xen_extra : .0
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
xen_commandline :
cc_compiler : gcc version 4.4.3 20100127 (Red Hat 4.4.3-4) (GCC)
cc_compile_by : root
cc_compile_domain :
cc_compile_date : Wed Apr 14 16:46:15 MSD 2010
xend_config_format : 4

[root@fedora12a ~]# brctl show
bridge name bridge id STP enabled interfaces
eth0 8000.90e6ba2d11eb no peth0
virbr0 8000.000000000000 yes

Create OSOL 134 PV DomU via profile create_osol134.xml :-

<domain type='xen'>
<name>osol134</name>
<uuid>f80856df-3180-acc5-931d-32190cfe4062</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>2</vcpu>
<bootloader></bootloader>
<os>
<type>linux</type>
<kernel>/home/boris/osol134/unix</kernel>
<initrd>/home/boris/osol134/boot_archive</initrd>
<cmdline>/platform/i86xpv/kernel/amd64/unix - nowin -B install_media=cdrom</cmdline>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sdb5'/>
<target dev='xvda' bus='xen'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='file'/>
<source file='/root/MyDownloads/osol-dev-134.iso'/>
<target dev='xvdc' bus='xen'/>
<readonly/>
</disk>
<interface type='bridge'>
<mac address='00:16:3e:72:da:33'/>
<source bridge='eth0'/>
<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>
</devices>
</domain>

and run

# virsh create create_osol134.xml
# virsh console osol134
At this point activate VNC connection to DomU via script

domid=`virsh domid osol134`
ip=`/usr/bin/xenstore-read /local/domain/$domid/guest/ipv4/0/address`
echo $ip
port=`/usr/bin/xenstore-read /local/domain/$domid/guest/vnc/port`
echo $port
/usr/bin/xenstore-read /local/domain/$domid/guest/vnc/passwd
vncviewer $ip:$port

and go through normal install. When done define new domain via profile :

<domain type='xen'>
<name>OS134</name>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<os>
<type>linux</type>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sdb5'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<mac address='00:16:3e:10:93:61'/>
<source bridge='eth0'/>
<script path='/etc/xen/scripts/vif-bridge'/>
<target dev='vif7.0'/>
</interface>
<console type='pty' tty='/dev/pts/2'>
<source path='/dev/pts/2'/>
<target port='0'/>
</console>
</devices>
</domain>

[root@fedora12a OS134]# virsh start OS134
Domain OS134 started

[root@fedora12a OS134]# virsh console OS134
Connected to domain OS134
Escape character is ^]
v4.0.0 chgset ‘unavailable’
SunOS Release 5.11 Version snv_134 64-bit
Copyright 1983-2010 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: opensolaris134
Reading ZFS config: done.
Mounting ZFS filesystems: (6/6)

opensolaris134 console login: boris
Password:
Last login: Wed Apr 14 13:20:01 on rad/3
Sun Microsystems Inc. SunOS 5.11 snv_134 February 2010
boris@opensolaris134:~$ pfexec ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
xnf0: flags=1004843 mtu 1500 index 2
inet 192.168.1.37 netmask ffffff00 broadcast 192.168.1.255
ether 0:16:3e:10:93:61
lo0: flags=2002000849 mtu 8252 index 1
inet6 ::1/128
xnf0: flags=2004841 mtu 1500 index 2
inet6 fe80::216:3eff:fe10:9361/10
ether 0:16:3e:10:93:61





References
1. http://old.nabble.com/-PATCH–RESUBMIT–sync-up-zfs-boot-support-in-pygrub-p28236835.html

7 Responses to ZFS 24 Support via Pygrub & fsimage.so patch for Xen 4.0 Dom0 (pvops 2.6.32.11) on top of F12

  1. […] other news there appears to have been some success in getting Xen to operate on a ZFS filesystem, and as zfs now supports block level deduplication and instant snapshotting, it’s looking […]

  2. Ilhan says:

    Hi,

    first of all thank you very much for such a source. But I am in trouble with the error /usr/bin/ld: cannot find -lpci after typing “# rpmbuild -ba ./xen.spec”.

    Is there any clue for that?

  3. dbaxps says:

    Make sure you did
    # yum update
    and packages required by rpmbuild have been installed
    One more idea
    # yum install lpci

  4. Ilhan says:

    I tried what you told dbaxps. But it did not work for me. I got the same error

  5. dbaxps says:

    Actually, you have F12 with rpmbuild not working.
    This issue has nothing in common with Xen,PVops,…

  6. Ilhan says:

    do you mean rpmbuild causes that problem in Fedora 12? And do you know if it will work in Fedora 11?

  7. dbaxps says:

    rpmbuild does work on F12. Something is wrong with your installation of F12. I suspect “yum update” has not completed
    properly after initial install.

Leave a comment