revert r714 for speed
[invirt/packages/invirt-remote.git] / files / usr / sbin / sipb-xen-remote
1 #!/bin/sh
2 # sipb-xen-remote TYPE SERVICE [ARGS...]
3 #
4 # We carry out the remctl command proxied to us by the remote-control server.
5
6 TYPE="$1"
7 SERVICE="$2"
8 shift; shift;
9
10 case "$TYPE" in
11     control)
12         # $SERVICE is hostname
13         COMMAND=/usr/sbin/sipb-xen-vmcontrol
14         ;;
15     web)
16         case "$SERVICE" in
17             lvcreate|lvremove|lvrename|lvresize)
18                 COMMAND=/usr/sbin/sipb-xen-lvm
19                 ;;
20             lvcopy)
21                 COMMAND=/usr/sbin/sipb-xen-lvcopy
22                 ;;
23             vmboot)
24                 COMMAND=/usr/sbin/sipb-xen-vmcontrol
25                 ;;
26             install)
27                 COMMAND=/usr/sbin/sipb-xen-install
28                 ;;
29             register|moveregister|unregister|remctl-moira-update)
30                 COMMAND=/usr/sbin/sipb-xen-remctl-update
31                 ;;
32             listvms)
33                 COMMAND=/usr/sbin/sipb-xen-listvms
34                 ;;
35             info)
36                 COMMAND=/usr/sbin/xm
37                 ;;
38             *)
39                 echo "ERROR: invalid subcommand"
40                 exit 1
41                 ;;
42         esac
43         ;;
44     *)
45         echo "ERROR: invalid command"
46         exit 1
47         ;;
48 esac
49
50 #echo $COMMAND "$SERVICE" "$@"
51 $COMMAND "$SERVICE" "$@"