Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-image
Commits
09d40120
Commit
09d40120
authored
May 26, 2014
by
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
Changes
4
Hide whitespace changes
Inline
Side-by-side
snf-image-host/common.sh.in
View file @
09d40120
# Copyright (C) 2011 GRNET S.A.
# Copyright (C) 2011
-2014
GRNET S.A.
# Copyright (C) 2007, 2008, 2009 Google Inc.
# Copyright (C) 2007, 2008, 2009 Google Inc.
#
#
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
...
@@ -85,39 +85,6 @@ send_errors() {
...
@@ -85,39 +85,6 @@ send_errors() {
eval "echo $(printf "%q" "$report") >&${MONITOR_FD}"
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() {
get_api10_arguments() {
if [ -z "$INSTANCE_NAME" -o -z "$HYPERVISOR" -o -z "$DISK_COUNT" ]; then
if [ -z "$INSTANCE_NAME" -o -z "$HYPERVISOR" -o -z "$DISK_COUNT" ]; then
log_error "Missing OS API Variable:"
log_error "Missing OS API Variable:"
...
@@ -162,8 +129,7 @@ get_api20_arguments() {
...
@@ -162,8 +129,7 @@ get_api20_arguments() {
get_api10_arguments
get_api10_arguments
if [ "$SCRIPT_NAME" = "create" ]; then
if [ "$SCRIPT_NAME" = "create" ]; then
local required_osparams="IMG_ID IMG_FORMAT IMG_PASSWD"
local osparams="IMG_ID IMG_FORMAT IMG_PASSWD IMG_PROPERTIES IMG_PERSONALITY CONFIG_URL"
local osparams="$required_osparams IMG_PROPERTIES IMG_PERSONALITY CONFIG_URL"
# Store OSP_VAR in VAR
# Store OSP_VAR in VAR
for param in $osparams; do
for param in $osparams; do
...
@@ -177,16 +143,20 @@ get_api20_arguments() {
...
@@ -177,16 +143,20 @@ get_api20_arguments() {
config_params=$(./decode-config.py $osparams <<< "$config")
config_params=$(./decode-config.py $osparams <<< "$config")
eval "$config_params"
eval "$config_params"
fi
fi
for var in $required_osparams; do
if [ -z "${!var}" ]; then
log_error "Missing OS API Parameter: ${var}"
exit 1
fi
done
fi
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() {
map_disk0() {
blockdev="$1"
blockdev="$1"
filesystem_dev_base=$($KPARTX -l -s -p- $blockdev | \
filesystem_dev_base=$($KPARTX -l -s -p- $blockdev | \
...
@@ -286,25 +256,16 @@ canonicalize() {
...
@@ -286,25 +256,16 @@ canonicalize() {
fi
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() {
ganeti_os_main() {
if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then
OS_API_VERSION=5
if [ "$OS_API_VERSION" != "20" ]; then
GETOPT_RESULT=`getopt -o o:n:i:b:s: -n '$0' -- "$@"`
log_error "Unknown OS API VERSION $OS_API_VERSION. Only OS API VERSION 20 is supported"
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"
exit 1
exit 1
fi
fi
get_api20_arguments
if [ -n "$OS_VARIANT" ]; then
if [ -n "$OS_VARIANT" ]; then
if [ ! -d "$VARIANTS_DIR" ]; then
if [ ! -d "$VARIANTS_DIR" ]; then
log_error "OS Variants directory $VARIANTS_DIR doesn't exist"
log_error "OS Variants directory $VARIANTS_DIR doesn't exist"
...
...
snf-image-host/create
View file @
09d40120
#!/bin/bash
#!/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
# 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
# it under the terms of the GNU General Public License as published by
...
@@ -24,6 +24,12 @@ set -o pipefail
...
@@ -24,6 +24,12 @@ set -o pipefail
ganeti_os_main
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
if
[
"
$IMAGE_DEBUG
"
=
"yes"
]
;
then
PS4
=
'$(date "+%s.%N ($LINENO) + ")'
PS4
=
'$(date "+%s.%N ($LINENO) + ")'
set
-x
set
-x
...
...
snf-image-host/defaults.in
View file @
09d40120
# snf-image defaults file
# 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: directory location for disk images
# IMAGE_DIR="@localstatedir@/lib/snf-image"
# IMAGE_DIR="@localstatedir@/lib/snf-image"
...
...
snf-image-host/ganeti_api_version
View file @
09d40120
20
20
15
10
5
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment