File: block-enbd

package info (click to toggle)
xen-common 4.0.0-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 876 kB
  • ctags: 362
  • sloc: sh: 3,061; makefile: 403; perl: 186; python: 174; xml: 2
file content (27 lines) | stat: -rw-r--r-- 498 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

# Usage: block-enbd [bind server ctl_port |unbind node]
#
# 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!

dir=$(dirname "$0")
. "$dir/block-common.sh"

case "$command" in
  add)
    for dev in /dev/nd*; do
      if nbd-client $2:$3 $dev; then
        write_dev $dev
        exit 0
      fi
    done
    exit 1
    ;;
  remove)
    nbd-client -d $2
    exit 0
    ;;
esac