WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-users] [SCRIPT] Using iSCSI in your xen setup

To: Xen Users <xen-users@xxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-users] [SCRIPT] Using iSCSI in your xen setup
From: Stefan de Konink <skinkie@xxxxxxxxx>
Date: Sun, 25 Nov 2007 23:41:50 +0100
Delivery-date: Sun, 25 Nov 2007 14:42:33 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.6 (X11/20070911)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,


This is my first version of the block-iscsi script. Easy to setup, easy
to work with.

> #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
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-users] [SCRIPT] Using iSCSI in your xen setup, Stefan de Konink <=