Files
xen/tools/examples/block-enbd
T
cl349@firebug.cl.cam.ac.uk b93e7f7e8b bitkeeper revision 1.1426.1.1 (4289cc8cPUM98bLJs4TV93NHY9LOKg)
Many files:
  Make interface to network/block scripts consistent:
  - output on stdout is returned to the script caller
  - output on stderr is logged at the error level, messages with a '-' prefix
    are logged at the debug level and messages with a '*' prefix are logged
    at the info level.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-05-17 10:50:52 +00:00

34 lines
644 B
Bash
Executable File

#!/bin/sh
# Usage: block-enbd [bind server ctl_port |unbind node]
#
# The file argument to the bind command is the file we are to bind to a
# loop device. We print the path to the loop device node to stdout.
#
# The node argument to unbind is the name of the device node we are to
# unbind.
#
# This assumes you're running a correctly configured server at the other end!
case $1 in
bind)
for dev in /dev/nd*; do
if nbd-client $2:$3 $dev; then
echo $dev
exit 0
fi
done
exit 1
;;
unbind)
nbd-client -d $2
exit 0
;;
*)
echo 'Unknown command: ' $1 >&2
echo 'Valid commands are: bind, unbind' >&2
exit 1
esac