Last change
on this file since 2993 was
2113,
checked in by iannucci, 16 years ago
|
Modified invirt-availability and invirt-vmcontrol to stat /etc/invirt/nocreate.
|
-
Property svn:executable set to
*
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1097] | 1 | #!/bin/bash |
---|
[1239] | 2 | # invirt-vmcontrol MACHINE ACTION |
---|
[121] | 3 | # |
---|
| 4 | # remctl should have already verified that the user is authorized to |
---|
| 5 | # control the machine. So, we just need to execute the action requested. |
---|
| 6 | # |
---|
| 7 | # $0 and $1 come from the trusted remctl source. |
---|
| 8 | # |
---|
[1759] | 9 | # $2 and so on are user-provided, and thus sketchy. |
---|
[121] | 10 | |
---|
[146] | 11 | ORIGMACHINE="$1" |
---|
[196] | 12 | ACTION="$2" |
---|
[146] | 13 | MACHINE="d_$ORIGMACHINE" |
---|
[121] | 14 | |
---|
| 15 | case "$ACTION" in |
---|
[386] | 16 | list|vcpu-list|uptime) |
---|
[121] | 17 | xm "$ACTION" "$MACHINE" |
---|
| 18 | ;; |
---|
[1723] | 19 | destroy|shutdown|reboot) |
---|
[386] | 20 | xm "$ACTION" "$MACHINE" |
---|
[1239] | 21 | /usr/sbin/invirt-update-conserver </dev/null >/dev/null 2>&1 & |
---|
[386] | 22 | ;; |
---|
[1723] | 23 | install|create) |
---|
[1089] | 24 | shift; shift; |
---|
[2113] | 25 | if [ -f "/etc/invirt/nocreate" ]; then |
---|
| 26 | echo "Host $HOSTNAME is currently refusing VM creation." && exit 2 |
---|
| 27 | fi |
---|
[1723] | 28 | xm list "$MACHINE" >/dev/null 2>/dev/null && echo "$MACHINE already exists" && exit 1 |
---|
[223] | 29 | if [ "$ACTION" = "install" ]; then |
---|
[1268] | 30 | xm create invirt-database machine_name="$ORIGMACHINE" installer_options="$(printf '%q ' "$@")" |
---|
[1128] | 31 | elif [ -n "$1" ]; then |
---|
[1268] | 32 | xm create invirt-database machine_name="$ORIGMACHINE" cdrom_image="$1" |
---|
[127] | 33 | else |
---|
[1268] | 34 | xm create invirt-database machine_name="$ORIGMACHINE" |
---|
[127] | 35 | fi |
---|
[1239] | 36 | (sleep 4; /usr/sbin/invirt-update-conserver) </dev/null >/dev/null 2>&1 & |
---|
[127] | 37 | ;; |
---|
[121] | 38 | list-long) |
---|
| 39 | xm list --long "$MACHINE" |
---|
| 40 | ;; |
---|
[1390] | 41 | vnctoken) |
---|
| 42 | invirt-vnc-authtoken "$ORIGMACHINE" |
---|
[1397] | 43 | ;; |
---|
[121] | 44 | *) |
---|
| 45 | echo "ERROR: Invalid Command" |
---|
[1167] | 46 | exit 34 |
---|
[121] | 47 | ;; |
---|
| 48 | esac |
---|
Note: See
TracBrowser
for help on using the repository browser.