This is just a summary of my notes on how I got xen integration with FreeNAS. There wasn't much I could find on google regarding how to do this so I thought someone else might be interested. I will start by assuming a working build environment capable of successfully building 9.1.1-RELEASE.
In nanobsd/FREENAS.amd64 I added:
options NO_ADAPTIVE_MUTEXES
options NO_ADAPTIVE_RWLOCKS
options NO_ADAPTIVE_SX
# Xen HVM support
options XENHVM
device xenpci
which are taken from /usr/src/sys/amd64/conf/XENHVM on my FreeBSD build system. In the file nanobsd/os-base:
add_port sysutils/xen-tools
add_port sysutils/xe-guest-utilities
When I tried the build with only these changes, I got an error during the build of xen-tools. I 'fixed' the problem by hacking nanobsd/common to remove any mention of TARGET_ARCH from the do_add_port function. Specifically the command on Line 236 is now:
CR "make \
__MAKE_CONF=${NANO_MAKE_CONF_BUILD} \
SRC_BASE=/usr/src \
WRKDIRPREFIX=/usr/workdir -C /usr/ports/$port_path \
clean package BATCH=yes -DUSE_PACKAGE_DEPENDS \
$* clean -DFORCE_PACKAGE -DFORCE_PKG_REGISTER"
With those changes I was successfully able to build FreeNAS. Of course, there is an issue with XenServer 6.2 which prevents FreeBSD from booting using the XenHVM kernel so installing from the iso is not an option. Instead, I used vhd-util to convert the raw disk image to vhd as described in this thread. I was then able to upload this vhd file to xen using the XenCenter import wizard.
My patched freenas system successfully booted however, xenguest_enable was not set in /etc/rc.conf so the guest utilities were not starting. I just edited /conf/base/etc/rc.conf to include xenguest_enable="YES" underneath the open-vm-tools lines and rebooted.
I can now see the disk and memory info in the performance tab of XenCenter. I can also shut down and restart the vm. Suspend and memory snapshots don't seem to work.
In nanobsd/FREENAS.amd64 I added:
options NO_ADAPTIVE_MUTEXES
options NO_ADAPTIVE_RWLOCKS
options NO_ADAPTIVE_SX
# Xen HVM support
options XENHVM
device xenpci
which are taken from /usr/src/sys/amd64/conf/XENHVM on my FreeBSD build system. In the file nanobsd/os-base:
add_port sysutils/xen-tools
add_port sysutils/xe-guest-utilities
When I tried the build with only these changes, I got an error during the build of xen-tools. I 'fixed' the problem by hacking nanobsd/common to remove any mention of TARGET_ARCH from the do_add_port function. Specifically the command on Line 236 is now:
CR "make \
__MAKE_CONF=${NANO_MAKE_CONF_BUILD} \
SRC_BASE=/usr/src \
WRKDIRPREFIX=/usr/workdir -C /usr/ports/$port_path \
clean package BATCH=yes -DUSE_PACKAGE_DEPENDS \
$* clean -DFORCE_PACKAGE -DFORCE_PKG_REGISTER"
With those changes I was successfully able to build FreeNAS. Of course, there is an issue with XenServer 6.2 which prevents FreeBSD from booting using the XenHVM kernel so installing from the iso is not an option. Instead, I used vhd-util to convert the raw disk image to vhd as described in this thread. I was then able to upload this vhd file to xen using the XenCenter import wizard.
My patched freenas system successfully booted however, xenguest_enable was not set in /etc/rc.conf so the guest utilities were not starting. I just edited /conf/base/etc/rc.conf to include xenguest_enable="YES" underneath the open-vm-tools lines and rebooted.
I can now see the disk and memory info in the performance tab of XenCenter. I can also shut down and restart the vm. Suspend and memory snapshots don't seem to work.
Last edited by a moderator: