3 TEMP=`getopt -o o:n:i:b:s: -n '$0' -- "$@"`
4 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
5 # Note the quotes around `$TEMP': they are essential!
9 -i|-n) instance=$2; shift 2;;
11 -o) old_name=$2; shift 2;;
13 -b) blockdev=$2; shift 2;;
15 -s) swapdev=$2; shift 2;;
19 *) echo "Internal error!"; exit 1;;
22 if [ -z "$instance" -o -z "$blockdev" ]; then
23 echo "Missing OS API Argument"
26 if [ "$0" != "export" -a -z "$swapdev" ]; then
27 echo "Missing OS API Argument"
30 if [ "$0" = "rename" -a -z "$new_name" ]; then
31 echo "Missing OS API Argument"
36 get_api10_arguments() {
37 if [ -z "$INSTANCE" -o -z "$HYPERVISOR" -o -z "$DISK_COUNT" ]; then
38 echo "Missing OS API Variable"
42 if [ $DISK_COUNT -lt 1 -o -z "$DISK_0_PATH" ]; then
43 echo "At least one disk is needed"
47 if [ "$0" = "rename" -a -z "$OLD_INSTANCE_NAME" ]; then
48 echo "Missing OS API Variable"
50 old_name=$OLD_INSTANCE_NAME
53 if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then
56 elif [ "$OS_API_VERSION" = "10" ]; then
58 if [ $0 = "import" -o $0 = "export" ]; then
59 echo "import/export still not compatible with API version 10"
63 echo "Unknown OS API VERSION $OS_API_VERSION"