Storage driver domains: Difference between revisions
No edit summary |
No edit summary |
||
Line 52: | Line 52: | ||
[[Category:Tutorial]] |
[[Category:Tutorial]] |
||
[[Category:HowTo]] |
[[Category:HowTo]] |
||
[[Category:FreeBSD]] |
Revision as of 09:57, 28 May 2013
This guide will focus on setting up a Linux or FreeBSD guest that will serve disk backends to other guests.
Linux storage domain set up
The first step is to create a Linux PV guest, this will not be explained in this guide since it's assumed that the user has the basic knowledge about how to create new guests. Once the guest is set up, you will need to clone the Xen source code inside the guest:
$ git clone git://xenbits.xen.org/xen.git $ cd xen
Now we will install the hotplug scripts, udev rules and the necessary Xen tools in order to detect and attach the storage devices to the guest, we need to install a couple of dependencies in order to install all this tools:
# apt-get install build-essential python-dev gettext bcc bin86 iasl uuid-dev ncurses-dev libglib2.0-dev libyajl-dev # ./configure # make -C tools/include/ install # make -C tools/libxc/ install # make -C tools/xenstore/ install # make -C tools/hotplug/ install # mkdir -p /var/log/xen
Now we have the store domain correctly set up, but we have to manually mount xenfs each time the system boots, using the following command:
# mount -t xenfs xenfs /proc/xen
This can be added to /etc/rc.local so it is executed automatically at system boot.
FreeBSD storage domain set up
Setting up a FreeBSD storage driver domain using ZFS is easier than doing it with Linux, first we need a FreeBSD DomU that's running the XENHVM kernel. In the next steps we will setup a ZFS RAIDZ and we will create a volume that will be used as a disk for another DomU:
# echo 'zfs_enable="YES"' >> /etc/rc.conf # zpool create tank raidz ad1 ad2 # zfs create -V 5g tank/guest
Replace ad1 and ad2 with the physical disks you would like to use to setup the RAIDZ, and guest with the desired name of the volume you wish to create. This are the only steps necessary to setup the volumes inside the driver domain, now on your DomU config file you should use the following path: /dev/zvol/tank/guest.
Guest configuration
In order to use a disk that resides in a domain different than Dom0, the guest config file should use a disk specification similar to the following:
'format=raw,backendtype=phy,backend=<driver_domain_name>,vdev=xvda,target=<block_device_path_in_driver_domain>',
It is not possible to use driver domains with pygrub or HVM guests yet, so it will only work with PV guests that have the kernel in Dom0.