+for dir in /lib/udev /sbin; do
+ if [ -f $dir/vol_id -a -x $dir/vol_id ]; then
+ VOL_ID=$dir/vol_id
+ fi
+done
+
+if [ -z "$VOL_ID" ]; then
+ echo "vol_id not found, please install udev"
+ exit 1
+fi
+
get_api5_arguments() {
TEMP=`getopt -o o:n:i:b:s: -n '$0' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$TEMP"
while true; do
case "$1" in
- -i|-o) instance=$2; shift 2;;
+ -i|-n) instance=$2; shift 2;;
- -n) new_name=$2; shift 2;;
+ -o) old_name=$2; shift 2;;
-b) blockdev=$2; shift 2;;
fi
}
-get_api5_arguments
+get_api10_arguments() {
+ if [ -z "$INSTANCE_NAME" -o -z "$HYPERVISOR" -o -z "$DISK_COUNT" ]; then
+ echo "Missing OS API Variable"
+ exit 1
+ fi
+ instance=$INSTANCE_NAME
+ if [ $DISK_COUNT -lt 1 -o -z "$DISK_0_PATH" ]; then
+ echo "At least one disk is needed"
+ exit 1
+ fi
+ blockdev=$DISK_0_PATH
+ if [ "$0" = "rename" -a -z "$OLD_INSTANCE_NAME" ]; then
+ echo "Missing OS API Variable"
+ fi
+ old_name=$OLD_INSTANCE_NAME
+}
+if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then
+ OS_API_VERSION=5
+ get_api5_arguments
+elif [ "$OS_API_VERSION" = "10" ]; then
+ get_api10_arguments
+ if [ $0 = "import" -o $0 = "export" ]; then
+ echo "import/export still not compatible with API version 10"
+ exit 1
+ fi
+else
+ echo "Unknown OS API VERSION $OS_API_VERSION"
+ exit 1
+fi