2 SCRIPT_NAME=$(basename $0)
4 for dir in /lib/udev /sbin; do
5 if [ -f $dir/vol_id -a -x $dir/vol_id ]; then
10 if [ -z "$VOL_ID" ]; then
11 echo "vol_id not found, please install udev"
15 get_api5_arguments() {
16 TEMP=`getopt -o o:n:i:b:s: -n '$0' -- "$@"`
17 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
18 # Note the quotes around `$TEMP': they are essential!
22 -i|-n) instance=$2; shift 2;;
24 -o) old_name=$2; shift 2;;
26 -b) blockdev=$2; shift 2;;
28 -s) swapdev=$2; shift 2;;
32 *) echo "Internal error!"; exit 1;;
35 if [ -z "$instance" -o -z "$blockdev" ]; then
36 echo "Missing OS API Argument"
39 if [ "$SCRIPT_NAME" != "export" -a -z "$swapdev" ]; then
40 echo "Missing OS API Argument"
43 if [ "$SCRIPT_NAME" = "rename" -a -z "$new_name" ]; then
44 echo "Missing OS API Argument"
49 get_api10_arguments() {
50 if [ -z "$INSTANCE_NAME" -o -z "$HYPERVISOR" -o -z "$DISK_COUNT" ]; then
51 echo "Missing OS API Variable"
54 instance=$INSTANCE_NAME
55 if [ $DISK_COUNT -lt 1 -o -z "$DISK_0_PATH" ]; then
56 echo "At least one disk is needed"
60 if [ "$SCRIPT_NAME" = "rename" -a -z "$OLD_INSTANCE_NAME" ]; then
61 echo "Missing OS API Variable"
63 old_name=$OLD_INSTANCE_NAME
66 if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then
69 elif [ "$OS_API_VERSION" = "10" ]; then
71 if [ $SCRIPT_NAME = "import" -o $SCRIPT_NAME = "export" ]; then
72 echo "import/export still not compatible with API version 10"
76 echo "Unknown OS API VERSION $OS_API_VERSION"