ia64/xen-unstable

view tools/examples/block-enbd @ 4895:24dfd18ea63e

bitkeeper revision 1.1159.258.120 (42848bfe8kMyWWcBA64rq7h7l7AyoA)

Shadow code bug fix (found by Ian) that was breaking refcounts, and subsequently
causing migration problems.
author mafetter@fleming.research
date Fri May 13 11:14:06 2005 +0000 (2005-05-13)
parents 3eebdef21285
children 0a4b76b6b5a0
line source
1 #!/bin/sh
3 # Usage: block-enbd [bind server ctl_port |unbind node]
4 #
5 # The file argument to the bind command is the file we are to bind to a
6 # loop device. We print the path to the loop device node to stdout.
7 #
8 # The node argument to unbind is the name of the device node we are to
9 # unbind.
10 #
11 # This assumes you're running a correctly configured server at the other end!
13 case $1 in
14 bind)
15 for dev in /dev/nd*; do
16 if nbd-client $2:$3 $dev; then
17 echo $dev
18 exit 0
19 fi
20 done
21 exit 1
22 ;;
24 unbind)
25 nbd-client -d $2
26 exit 0
27 ;;
29 *)
30 echo 'Unknown command: ' $1
31 echo 'Valid commands are: bind, unbind'
32 exit 1
33 esac