Revision a6d3644b

b/tools/vcluster-setup.in
23 23

  
24 24
readonly self=$(readlink -f $0)
25 25
readonly ensure_dirs=@PKGLIBDIR@/ensure-dirs
26
readonly action_shortcuts=( start stop restart status )
26
readonly action_shortcuts=( start stop restart status watcher )
27 27
readonly default_nodecount=5
28 28
readonly default_instcount=10
29 29
readonly default_netprefix=192.0.2
30 30
readonly default_netdev=eth0
31
readonly default_initscript=@SYSCONFDIR@/init.d/ganeti
31 32
readonly cluster_name=cluster
32 33

  
33 34
# IP address space:
......
42 43

  
43 44
usage() {
44 45
  echo "Usage: $0 [-E] [-N] [-c <number>] [-i <number>] [-p <prefix>]"\
45
       '[-n <netdev>] <directory>'
46
       '[-n <netdev>] [-I <path>] <directory>'
46 47
  echo
47 48
  echo 'Options:'
48 49
  echo "  -c  Number of virtual nodes (defaults to $default_nodecount)"
......
50 51
  echo "  -p  IPv4 network prefix (defaults to $default_netprefix)"
51 52
  echo '  -n  Network device for virtual IP addresses (defaults to'\
52 53
       "$default_netdev)"
54
  echo "  -I  Path to init script (defaults to $default_initscript)"
53 55
  echo '  -E  Do not modify /etc/hosts'
54 56
  echo '  -N  Do not configure networking'
55 57
}
......
59 61
instcount=$default_instcount
60 62
netprefix=$default_netprefix
61 63
netdev=$default_netdev
64
initscript=$default_initscript
62 65
etchosts=1
63 66
networking=1
64 67

  
65 68
# Parse options
66
while getopts :hENc:p:n:i: opt; do
69
while getopts :hENc:p:n:i:I: opt; do
67 70
  case "$opt" in
68 71
    h)
69 72
      usage
......
103 106
        exit 1
104 107
      fi
105 108
    ;;
109
    I)
110
      initscript="$OPTARG"
111
      if [[ ! -x $initscript ]]; then
112
        echo "Init script '$initscript' is not executable" >&2
113
        exit 1
114
      fi
115
      ;;
106 116
    E)
107 117
      etchosts=
108 118
      ;;
......
252 262
      echo '#!/bin/bash'
253 263
      for ((i=0; i < nodecount; ++i)); do
254 264
        local name=$(node_hostname $i)
255
        echo "echo 'Action \"$action\" for virtual node \"$name\" ...'"
256
        echo "$name/cmd /etc/init.d/ganeti $action"
265
        if [[ $action = watcher ]]; then
266
          echo "echo 'Running watcher for virtual node \"$name\" ..."
267
          echo "$name/cmd ganeti-watcher \"\$@\""
268
        else
269
          echo "echo 'Action \"$action\" for virtual node \"$name\" ...'"
270
          echo "$name/cmd $initscript $action \"\$@\""
271
        fi
257 272
      done
258 273
    } > $rootdir/$action-all
259 274
    chmod +x $rootdir/$action-all

Also available in: Unified diff