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 @@
-#!/bin/bash
-# Main entry point for VM management
-# also negotiator for executing scripts, so for storage
-
-if [ "$(id -u)" != "0" ]; then
- echo "This script must be run as root"
- exit 1
-fi
-
-# Get script directory for relative paths
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-# First argument is the category (compute, network, storage, etc)
-category=$1
-shift
-
-# Exit if no category specified
-if [ -z "$category" ]; then
- echo -e "Usage: ./vm <category> <action> [args...]\n"
- echo -e "Categories: \ncompute\nnetwork\nstorage\ndevice\n"
- echo "Run ./vm <category> for available subactions or tree for all available actions."
- exit 1
-fi
-
-# Second argument is the action
-action=$1
-shift
-
-# Handle each category
-case $category in
- compute)
- case $action in
- create)
- $SCRIPT_DIR/compute/create.sh "$@"
- ;;
- start)
- $SCRIPT_DIR/compute/start.sh "$@"
- ;;
- ls)
- $SCRIPT_DIR/compute/ls.sh "$@"
- ;;
- shutdown)
- $SCRIPT_DIR/compute/shutdown.sh "$@"
- ;;
- rm)
- $SCRIPT_DIR/compute/rm.sh "$@"
- ;;
- *)
- echo -e "Available compute actions: \ncreate\nstart\nls\nshutdown\ndelete"
- exit 1
- ;;
- esac
- ;;
-
- network)
- case $action in
- attach)
- $SCRIPT_DIR/network/attach.sh "$@"
- ;;
- detach)
- $SCRIPT_DIR/network/detach.sh "$@"
- ;;
- list)
- $SCRIPT_DIR/network/list.sh "$@"
- ;;
- create)
- $SCRIPT_DIR/network/create.sh "$@"
- ;;
- delete)
- $SCRIPT_DIR/network/delete.sh "$@"
- ;;
- *)
- echo "Available network actions: \ncreate\nattach\ndetach\nlist\ndelete"
- exit 1
- ;;
- esac
- ;;
-
- disk)
- case $action in
- attach)
- $SCRIPT_DIR/disk/attach.sh "$@"
- ;;
- list)
- $SCRIPT_DIR/disk/list.sh "$@"
- ;;
- *)
- echo "Available disk actions: \ncreate\nattach\ndetach\nlist\ndelete"
- exit 1
- ;;
- esac
- ;;
-
- storage-pool)
- case $action in
- create) # using a directory as a storage pool
- $SCRIPT_DIR/storage-pool/create.sh "$@"
- ;;
- list)
- $SCRIPT_DIR/storage-pool/list.sh "$@"
- ;;
- create-from-device) # initialise and use a devcie as storage pool
- $SCRIPT_DIR/storage-pool/create-from-device.sh "$@"
- ;;
-
- *)
- echo "Available disk actions: \ncreate\nlist\ncreate-from-device\ndelete"
- exit 1
- ;;
- esac
- ;;
-
-
- *)
- echo "Unknown category: $category"
- echo "Available categories: compute, network, storage"
- exit 1
- ;;
-esac