Citrix XenServer: Full xs-tools support with a note on ZFS o

Over the past couple of days I wanted to start using FreeBSD as my base install for my VMs. This had three problems I had to first address before I could consider it acceptable:


To get ZFS as the root filesystem while also having PV drivers, this presented an issue where I needed the install ISO to use an Xen kernel because there was no /etc/fstab to edit to change ada0 to ad0 (or in the case of i386, xbd0) before rebooting so I had the export/import the cachefile somewhere with the Xen kernel. Conveniently, this also allows for a fresh install with the xenhvm kernel already installed.

ZFS on root is covered elsewhere. By installing from an ISO with a baked in Xen kernel you will automatically already have XENHVM support (PV drivers). Kill two birds with one stone!

Building an Xen Installation ISO with ZFS support

Building an ISO is covered elsewhere (particularly release(7)) so there is only one minor change that needs to be made. In the kernel conf ( /usr/src/sys/amd64/conf/XENHVM ) add these to MODULES_OVERRIDE

Code:
opensolaris zfs krpc

Add other kernel modules as required as there will be none by default. Don't do what I did and have to end up recompiling the kernel 5+ times because you forgot a module (so for future's sake, it's easier to just rebuild the whole damn thing)

When building the kernel or release, make sure you specify KERNCONF=XENHVM ( i386 = XEN )

For ease of use, you can download prebuilt ISOs with baked in Xen support. These were compiled with the modules

Code:
opensolaris zfs krpc pf pflog nfs_common nfscl nfsclient nfscommon nfsd nfslock nfslockd nfsserver nfssvc ahci

Note that this was built using CVS for 9.1-PRERELEASE

http://zero.mcstats.org/freebsd-xen/

XenCenter xen tools integration

NOTE: This is neither supported or probably even recommended by Citrix. I cannot provide any kind of guarantee or endorsement for this. I ported functions in the Linux version of Citrix's Xen Tools and left as much as possible as untouched. This SHOULD work without a hitch however again, Citrix cannot and most definitely will not support you with this on an unsupported OS

With that said, let's get hacking.

Install the open source xen-tools

# cd /usr/ports/sysutils/xen-tools
# make install clean

Install bash

One of the scripts utilizes bash. In an effort to leave as much untouched, I installed bash.

# cd /usr/ports/shells/bash
# make install clean

Install free (requires perl!)

Source: http://www.cyberciti.biz/faq/freebsd-command-to-get-ram-information/

# fetch [url]http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt[/url]
# mv freebsd-memory.pl.txt /usr/local/bin/free
# chmod +x /usr/local/bin/free

Install the ported Linux Citrix scripts

NOTE: Scripts downloaded here are licensed under the GPL by Citrix which is why I can redistribute these to you!

I used XenServer 6.0.2 and 6.0.0 for testing -- it works on both. Additionally, I used the xen tools distribution for Debian and ported it to use BSD commands. The xenstore API is identical, only the commands to get memory usage / IP interfaces+addresses needed to be ported. Also, OS detection needed to be added for FreeBSD.

The script tar I've provided contains the following files.

Code:
etc/rc.d/xen
usr/local/sbin/xe-daemon
usr/local/sbin/xe-linux-distribution
usr/local/sbin/xe-update-guest-attrs
usr/share/doc/xe-guest-utilities/
usr/share/doc/xe-guest-utilities/copyright
usr/share/doc/xe-guest-utilities/COPYING.LGPL.gz
usr/share/doc/xe-guest-utilities/COPYING.gz

Extract the following file into /

http://zero.mcstats.org/freebsd-xen/freebsd-xenserver-support.tar.gz

# tar xvf freebsd-xenserver-support.tar.gz -C /

Enable xen on startup

# echo 'xen_enable="YES"' >> /etc/rc.conf

Reboot & enjoy!


(fresh install using release iso and above script: http://puu.sh/JqUC http://puu.sh/JqUT)
 
question

I'm trying this now with Xenserver 6.1.

Most of the tutorials I find talk about copying the kernel to dom0 and changing the vm info like:

PV-args="boot_vervose=1,vfs.root.mountfrom=ufs:/dev/xbd0s1a....
HVM-boot-policy=""
etc....

and changing the mountpoints for the xbd-style disks.

a la: http://forums.freebsd.org/archive/index.php/t-24936.html

this method skips all of that. which is nice because I couldn't get the others to work.

but what drawback is there to not changing the vm's args with the xe commands?
 
Back
Top