Using iSCSI in your xen setup
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Hi,
This is my first version of the block-iscsi script. Easy to setup, easy to work with.
Quoted 10 lines
#general
name = "skinkie_gentoo_old";
memory = 256;# booting kernel = "/home/skinkie/xen/boot/gentoo";# virtual harddisk disk = [ "iscsi:/dev/disk/by-path/ip-192.168.0.2:3260-iscsi-iqn.1986-03.com.sun:02:c6719b9f-7993-444d-c6d2-80d4e15ee52c-lun-0,hda,w" ]; root = "/dev/hda ro"
The script parses the structure used by udev, so it will extract the IP address and ISCSI target from the parameter. It starts a discovery based on the IP target, login to the server upon create/migration. And logout from the server is the domain is migrated or destroyed.
The sleep in the script could probably reduced to 1 or 2 seconds, but udev needs to populate the /dev/disk/by-path directory. It borks without the wait. Probably next implementations will include a returncode, with a prettier wait function.
Yes, it lacks basic chap/pap authentication but since nothing was provided, it is a nice first attempt to get ISCSI to work in the Xen opensource environment. It assumes you don't use the same iscsi target anywhere else otherwise you will have a problem upon destroy ;)
Howto install: copy the script to /etc/xen/scripts/ and make it executable with chmod +x block-iscsi.
My setup now:
Gentoo Linux NFS client (Xen Node)
Gentoo Linux Development (Provides DHCP/PXE boot/Monitoring) OpenSolaris with ZFS (Provides iSCSI/NFS storage)
Upon start the NFS client registers itself with the Monitoring server to join the to be monitored pool and gets a callback from the XenAPI.
Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHSfouYH1+F2Rqwn0RClo1AJ9JHN2ocYp8E0O1lrb43XfbLlkN2gCfeCSb Sx0ThJa/lDQWGvmbz2HNZHI=
=VHIr
-----END PGP SIGNATURE-----
#!/bin/bash
# Usage: block-iscsi
dir=$(dirname "$0")
. "$dir/block-common.sh"
p=$(xenstore_read "$XENBUS_PATH/params") udev=basename $p
ip=echo $udev | sed "s/ip-\(.*\)-iscsi.*/\1/g" target=echo $udev | sed "s/.*iscsi-\(.*\)-lun.*/\1/g"
case "$command" in
add)
if [ ! -a $p ]
then
/usr/sbin/iscsiadm -m discovery -t sendtargets -p $ip
/usr/sbin/iscsiadm -m node -T $target -p $ip --login
sleep 4
fi
if [ -a $p ]
then
write_dev $p
exit 0
fi
exit 1
;;remove)
if [ -a $p ]
then
/usr/sbin/iscsiadm -m node -T $target -p $ip --logout
fi
exit 0
;;esac
_______________________________________________
Xen-users mailing list
[email protected]
http://lists.xensource.com/xen-users