ia64/xen-unstable

changeset 7523:cd1cfbadb75f

NBD scripts, courtesy of Kurt Garloff:

For domain migration, unless you use a rootless setup, you need
to have network storage available. For the poor people like me that
have no SAN, one easy possibility to have it is to use nbd.

Find attached the block-nbd script (in /etc/xen/scripts/) and
an example config file. The block-nbd script is based on the -enbd one.
They have been used successfully in the Xen Tutorial at Linux Kongress.

Signed-off-by: Kurt Garloff <garloff@suse.de>
author emellor@leeni.uk.xensource.com
date Tue Oct 25 11:52:56 2005 +0100 (2005-10-25)
parents f2ad4e0a7259
children 34b4068704c5
files tools/examples/block-nbd tools/examples/xmexample.nbd
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/examples/block-nbd	Tue Oct 25 11:52:56 2005 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# Usage: block-enbd [bind server ctl_port |unbind node]
     1.7 +#
     1.8 +# The file argument to the bind command is the file we are to bind to a
     1.9 +# loop device.
    1.10 +#
    1.11 +# The node argument to unbind is the name of the device node we are to
    1.12 +# unbind.
    1.13 +#
    1.14 +# This assumes you're running a correctly configured server at the other end!
    1.15 +
    1.16 +set -e
    1.17 +
    1.18 +#echo "block-enbd: $@" | logger -t xen
    1.19 +
    1.20 +case $1 in
    1.21 +  bind)
    1.22 +    for dev in /dev/nbd*; do
    1.23 +      if nbd-client $2 $3 $dev; then
    1.24 +        major=$(stat -L -c %t "$dev")
    1.25 +        minor=$(stat -L -c %T "$dev")
    1.26 +        pdev=$(printf "0x%02x%02x" 0x$major 0x$minor)
    1.27 +        xenstore-write "$XENBUS_PATH"/physical-device $pdev \
    1.28 +          "$XENBUS_PATH"/node $dev
    1.29 +        exit 0
    1.30 +      fi
    1.31 +    done
    1.32 +    exit 1
    1.33 +    ;;
    1.34 +  unbind)
    1.35 +    nbd-client -d $2
    1.36 +    exit 0
    1.37 +    ;;
    1.38 +esac
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/examples/xmexample.nbd	Tue Oct 25 11:52:56 2005 +0100
     2.3 @@ -0,0 +1,13 @@
     2.4 +kernel = "/boot/vmlinuz-2.6.13-15b-xen"
     2.5 +ramdisk = "/boot/initrd-2.6.13-15b-xen"
     2.6 +memory = 128
     2.7 +name = "nbd4"
     2.8 +nics=1
     2.9 +# Please change MAC
    2.10 +vif = [ 'mac=aa:cc:10:10:00:a0, bridge=xenbr0' ]
    2.11 +# Please change PORT
    2.12 +disk = [ 'nbd:134.100.233.115 20004,hda1,w' ]
    2.13 +dhcp = "dhcp"
    2.14 +hostname= "nbd4" 
    2.15 +root = "/dev/hda1 ro"
    2.16 +extra = "3"