Commit 09d40120 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Remove support for OS API version 5, 10 and 15

snf-image wasn't working correctly with API versions prior to 20 anyway.
parent 7bb6f4c1
# Copyright (C) 2011 GRNET S.A.
# Copyright (C) 2011-2014 GRNET S.A.
# Copyright (C) 2007, 2008, 2009 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
......@@ -85,39 +85,6 @@ send_errors() {
eval "echo $(printf "%q" "$report") >&${MONITOR_FD}"
}
get_api5_arguments() {
GETOPT_RESULT=$*
# Note the quotes around `$TEMP': they are essential!
eval set -- "$GETOPT_RESULT"
while true; do
case "$1" in
-i|-n) instance=$2; shift 2;;
-o) old_name=$2; shift 2;;
-b) blockdev=$2; shift 2;;
-s) swapdev=$2; shift 2;;
--) shift; break;;
*) log_error "Internal error!" >&2; exit 1;;
esac
done
if [ -z "$instance" -o -z "$blockdev" ]; then
log_error "Missing OS API Argument (-i, -n, or -b)"
exit 1
fi
if [ "$SCRIPT_NAME" != "export" -a -z "$swapdev" ]; then
log_error "Missing OS API Argument -s (swapdev)"
exit 1
fi
if [ "$SCRIPT_NAME" = "rename" -a -z "$old_name" ]; then
log_error "Missing OS API Argument -o (old_name)"
exit 1
fi
}
get_api10_arguments() {
if [ -z "$INSTANCE_NAME" -o -z "$HYPERVISOR" -o -z "$DISK_COUNT" ]; then
log_error "Missing OS API Variable:"
......@@ -162,8 +129,7 @@ get_api20_arguments() {
get_api10_arguments
if [ "$SCRIPT_NAME" = "create" ]; then
local required_osparams="IMG_ID IMG_FORMAT IMG_PASSWD"
local osparams="$required_osparams IMG_PROPERTIES IMG_PERSONALITY CONFIG_URL"
local osparams="IMG_ID IMG_FORMAT IMG_PASSWD IMG_PROPERTIES IMG_PERSONALITY CONFIG_URL"
# Store OSP_VAR in VAR
for param in $osparams; do
......@@ -177,16 +143,20 @@ get_api20_arguments() {
config_params=$(./decode-config.py $osparams <<< "$config")
eval "$config_params"
fi
for var in $required_osparams; do
if [ -z "${!var}" ]; then
log_error "Missing OS API Parameter: ${var}"
exit 1
fi
done
fi
}
parameter_check() {
local required_osparams="IMG_ID IMG_FORMAT IMG_PASSWD"
for var in $required_osparams; do
if [ -z "${!var}" ]; then
log_error "Missing OS API Parameter: ${var}"
exit 1
fi
done
}
map_disk0() {
blockdev="$1"
filesystem_dev_base=$($KPARTX -l -s -p- $blockdev | \
......@@ -286,25 +256,16 @@ canonicalize() {
fi
}
# this one is only to be called by create
# this one is only to be called by ganeti OS interface scripts
ganeti_os_main() {
if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then
OS_API_VERSION=5
GETOPT_RESULT=`getopt -o o:n:i:b:s: -n '$0' -- "$@"`
if [ $? != 0 ] ; then log_error "Terminating..."; exit 1 ; fi
get_api5_arguments $GETOPT_RESULT
elif [ "$OS_API_VERSION" = "10" -o "$OS_API_VERSION" = "15" ]; then
get_api10_arguments
elif [ "$OS_API_VERSION" = "20" ]; then
get_api20_arguments
IMAGE_NAME="$IMG_ID"
IMAGE_TYPE="$IMG_FORMAT"
BACKEND_TYPE=$(get_backend_type $IMG_ID)
else
log_error "Unknown OS API VERSION $OS_API_VERSION"
if [ "$OS_API_VERSION" != "20" ]; then
log_error "Unknown OS API VERSION $OS_API_VERSION. Only OS API VERSION 20 is supported"
exit 1
fi
get_api20_arguments
if [ -n "$OS_VARIANT" ]; then
if [ ! -d "$VARIANTS_DIR" ]; then
log_error "OS Variants directory $VARIANTS_DIR doesn't exist"
......
#!/bin/bash
# Copyright (C) 2011 GRNET S.A.
# Copyright (C) 2011-2014 GRNET S.A.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -24,6 +24,12 @@ set -o pipefail
ganeti_os_main
parameter_check
IMAGE_NAME="$IMG_ID"
IMAGE_TYPE="$IMG_FORMAT"
BACKEND_TYPE=$(get_backend_type $IMG_ID)
if [ "$IMAGE_DEBUG" = "yes" ]; then
PS4='$(date "+%s.%N ($LINENO) + ")'
set -x
......
# snf-image defaults file
# IMAGE_NAME: Name of the image to use
# Generally you use the name of the image with the version of the OS included.
# Examples include:
# centos-5.4 debian-4.0 fedora-12
# IMAGE_NAME=""
# IMAGE_DIR: directory location for disk images
# IMAGE_DIR="@localstatedir@/lib/snf-image"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment