source: trunk/packages/invirt-remote-host/files/usr/sbin/invirt-vmcontrol @ 1723

Last change on this file since 1723 was 1723, checked in by broder, 16 years ago

Use xm reboot instead of a destroy and create to reboot VMs

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/bash
2# invirt-vmcontrol MACHINE ACTION
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#
9# $2 and so on are user-provided, and thus sketchy.  I don't think we
10# need them for this script.
11
12ORIGMACHINE="$1"
13ACTION="$2"
14MACHINE="d_$ORIGMACHINE"
15
16case "$ACTION" in
17    list|vcpu-list|uptime)
18        xm "$ACTION" "$MACHINE"
19        ;;
20    destroy|shutdown|reboot)
21        xm "$ACTION" "$MACHINE"
22        /usr/sbin/invirt-update-conserver </dev/null >/dev/null 2>&1 &
23        ;;
24    install|create)
25        shift; shift;
26        xm list "$MACHINE" >/dev/null 2>/dev/null && echo "$MACHINE already exists" && exit 1
27        if [ "$ACTION" = "install" ]; then
28            xm create invirt-database machine_name="$ORIGMACHINE" installer_options="$(printf '%q ' "$@")"
29        elif [ -n "$1" ]; then
30            xm create invirt-database machine_name="$ORIGMACHINE" cdrom_image="$1"
31        else
32            xm create invirt-database machine_name="$ORIGMACHINE"
33        fi
34        (sleep 4; /usr/sbin/invirt-update-conserver) </dev/null >/dev/null 2>&1 &
35        ;;
36    list-long)
37        xm list --long "$MACHINE"
38        ;;
39    vnctoken)
40        invirt-vnc-authtoken "$ORIGMACHINE"
41        ;;
42    *)
43        echo "ERROR: Invalid Command"
44        exit 34
45        ;;
46esac
Note: See TracBrowser for help on using the repository browser.