summaryrefslogtreecommitdiff
path: root/others/vm3/vm.sh
diff options
context:
space:
mode:
Diffstat (limited to 'others/vm3/vm.sh')
-rwxr-xr-xothers/vm3/vm.sh119
1 files changed, 0 insertions, 119 deletions
diff --git a/others/vm3/vm.sh b/others/vm3/vm.sh
deleted file mode 100755
index a043f89..0000000
--- a/others/vm3/vm.sh
+++ /dev/null
@@ -1,119 +0,0 @@
1#!/bin/bash
2# Main entry point for VM management
3# also negotiator for executing scripts, so for storage
4
5if [ "$(id -u)" != "0" ]; then
6 echo "This script must be run as root"
7 exit 1
8fi
9
10# Get script directory for relative paths
11SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
12
13# First argument is the category (compute, network, storage, etc)
14category=$1
15shift
16
17# Exit if no category specified
18if [ -z "$category" ]; then
19 echo -e "Usage: ./vm <category> <action> [args...]\n"
20 echo -e "Categories: \ncompute\nnetwork\nstorage\ndevice\n"
21 echo "Run ./vm <category> for available subactions or tree for all available actions."
22 exit 1
23fi
24
25# Second argument is the action
26action=$1
27shift
28
29# Handle each category
30case $category in
31 compute)
32 case $action in
33 create)
34 $SCRIPT_DIR/compute/create.sh "$@"
35 ;;
36 start)
37 $SCRIPT_DIR/compute/start.sh "$@"
38 ;;
39 ls)
40 $SCRIPT_DIR/compute/ls.sh "$@"
41 ;;
42 shutdown)
43 $SCRIPT_DIR/compute/shutdown.sh "$@"
44 ;;
45 rm)
46 $SCRIPT_DIR/compute/rm.sh "$@"
47 ;;
48 *)
49 echo -e "Available compute actions: \ncreate\nstart\nls\nshutdown\ndelete"
50 exit 1
51 ;;
52 esac
53 ;;
54
55 network)
56 case $action in
57 attach)
58 $SCRIPT_DIR/network/attach.sh "$@"
59 ;;
60 detach)
61 $SCRIPT_DIR/network/detach.sh "$@"
62 ;;
63 list)
64 $SCRIPT_DIR/network/list.sh "$@"
65 ;;
66 create)
67 $SCRIPT_DIR/network/create.sh "$@"
68 ;;
69 delete)
70 $SCRIPT_DIR/network/delete.sh "$@"
71 ;;
72 *)
73 echo "Available network actions: \ncreate\nattach\ndetach\nlist\ndelete"
74 exit 1
75 ;;
76 esac
77 ;;
78
79 disk)
80 case $action in
81 attach)
82 $SCRIPT_DIR/disk/attach.sh "$@"
83 ;;
84 list)
85 $SCRIPT_DIR/disk/list.sh "$@"
86 ;;
87 *)
88 echo "Available disk actions: \ncreate\nattach\ndetach\nlist\ndelete"
89 exit 1
90 ;;
91 esac
92 ;;
93
94 storage-pool)
95 case $action in
96 create) # using a directory as a storage pool
97 $SCRIPT_DIR/storage-pool/create.sh "$@"
98 ;;
99 list)
100 $SCRIPT_DIR/storage-pool/list.sh "$@"
101 ;;
102 create-from-device) # initialise and use a devcie as storage pool
103 $SCRIPT_DIR/storage-pool/create-from-device.sh "$@"
104 ;;
105
106 *)
107 echo "Available disk actions: \ncreate\nlist\ncreate-from-device\ndelete"
108 exit 1
109 ;;
110 esac
111 ;;
112
113
114 *)
115 echo "Unknown category: $category"
116 echo "Available categories: compute, network, storage"
117 exit 1
118 ;;
119esac