Revision edf5dd1a
/dev/null | ||
---|---|---|
1 |
Nikos Skalkotos <skalkoto@grnet.gr> |
|
2 |
Constantinos Venetsanopoulos <cven@grnet.gr> |
/dev/null | ||
---|---|---|
1 |
if PROGMONSUPPORT |
|
2 |
progress_monitor_support=yes |
|
3 |
else |
|
4 |
progress_monitor_support=no |
|
5 |
endif |
|
6 |
|
|
7 |
osname=$(PACKAGE) |
|
8 |
osdir=$(OS_DIR)/$(osname) |
|
9 |
defaultdir=$(DEFAULT_DIR) |
|
10 |
variantsdir=${sysconfdir}/ganeti/snf-image/variants |
|
11 |
|
|
12 |
dist_os_SCRIPTS = ${srcdir}/create ${srcdir}/import ${srcdir}/export \ |
|
13 |
${srcdir}/rename ${srcdir}/verify |
|
14 |
|
|
15 |
dist_os_DATA = ${srcdir}/ganeti_api_version ${srcdir}/parameters.list \ |
|
16 |
${srcdir}/variants.list |
|
17 |
|
|
18 |
os_DATA = common.sh |
|
19 |
|
|
20 |
edit = sed \ |
|
21 |
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \ |
|
22 |
-e 's|@localstatedir[@]|$(localstatedir)|g' \ |
|
23 |
-e 's|@osdir[@]|$(osdir)|g' \ |
|
24 |
-e 's|@osname[@]|$(osname)|g' \ |
|
25 |
-e 's|@defaultdir[@]|$(defaultdir)|g' \ |
|
26 |
-e 's|@HELPER[@]|$(HELPER)|g' \ |
|
27 |
-e 's|@HELPER_KERNEL[@]|$(HELPER_KERNEL)|g' \ |
|
28 |
-e 's|@HELPER_INITRD[@]|$(HELPER_INITRD)|g' \ |
|
29 |
-e 's|@AWK[@]|$(AWK)|g' \ |
|
30 |
-e 's|@MKDIR_P[@]|$(MKDIR_P)|g' \ |
|
31 |
-e 's|@LOSETUP[@]|$(LOSETUP)|g' \ |
|
32 |
-e 's|@KPARTX[@]|$(KPARTX)|g' \ |
|
33 |
-e 's|@SFDISK[@]|$(SFDISK)|g' \ |
|
34 |
-e 's|@INSTALL_MBR[@]|$(INSTALL_MBR)|g' \ |
|
35 |
-e 's|@progress_monitor_support[@]|$(progress_monitor_support)|g' \ |
|
36 |
-e 's|@PROGRESS_MONITOR[@]|$(PROGRESS_MONITOR)|g' |
|
37 |
|
|
38 |
common.sh: Makefile |
|
39 |
rm -f $@ $@.tmp |
|
40 |
srcdir=''; \ |
|
41 |
test -f ./$@.in || srcdir=$(srcdir)/; \ |
|
42 |
$(edit) $${srcdir}$@.in >$@.tmp |
|
43 |
mv $@.tmp $@ |
|
44 |
|
|
45 |
install-exec-local: |
|
46 |
@mkdir_p@ "$(DESTDIR)$(osdir)" |
|
47 |
@mkdir_p@ "$(DESTDIR)$(variantsdir)" |
|
48 |
touch "$(DESTDIR)$(variantsdir)/default.conf" |
|
49 |
|
|
50 |
|
|
51 |
CLEANFILES = $(os_DATA) |
/dev/null | ||
---|---|---|
1 |
#!/bin/sh |
|
2 |
|
|
3 |
if test ! -f configure.ac ; then |
|
4 |
echo "You must execute this script from the top level directory." |
|
5 |
exit 1 |
|
6 |
fi |
|
7 |
|
|
8 |
set -e |
|
9 |
|
|
10 |
rm -rf config.cache autom4te.cache |
|
11 |
mkdir -p autotools |
|
12 |
|
|
13 |
${ACLOCAL:-aclocal} -I autotools |
|
14 |
${AUTOCONF:-autoconf} |
|
15 |
${AUTOMAKE:-automake} --add-missing |
|
16 |
|
|
17 |
rm -rf autom4te.cache |
/dev/null | ||
---|---|---|
1 |
# Copyright 2011 GRNET S.A. All rights reserved. |
|
2 |
# |
|
3 |
# Redistribution and use in source and binary forms, with or without |
|
4 |
# modification, are permitted provided that the following conditions |
|
5 |
# are met: |
|
6 |
# |
|
7 |
# 1. Redistributions of source code must retain the above copyright |
|
8 |
# notice, this list of conditions and the following disclaimer. |
|
9 |
# |
|
10 |
# 2. Redistributions in binary form must reproduce the above copyright |
|
11 |
# notice, this list of conditions and the following disclaimer in the |
|
12 |
# documentation and/or other materials provided with the distribution. |
|
13 |
# |
|
14 |
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
|
15 |
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
16 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
17 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
|
18 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
19 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|
20 |
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
21 |
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
22 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|
23 |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
24 |
# SUCH DAMAGE. |
|
25 |
# |
|
26 |
# The views and conclusions contained in the software and documentation are |
|
27 |
# those of the authors and should not be interpreted as representing official |
|
28 |
# policies, either expressed or implied, of GRNET S.A. |
|
29 |
|
|
30 |
AWK="awk" |
|
31 |
KPARTX="kpartx" |
|
32 |
LOSETUP="losetup" |
|
33 |
SFDISK="sfdisk" |
|
34 |
PROGRESS_MONITOR="snf-progress-monitor" |
|
35 |
INSTALL_MBR="install-mbr" |
|
36 |
TIMELIMIT="timelimit" |
|
37 |
|
|
38 |
progress_monitor_support="@progress_monitor_support@" |
|
39 |
|
|
40 |
CLEANUP=( ) |
|
41 |
|
|
42 |
log_error() { |
|
43 |
echo "$@" >&2 |
|
44 |
} |
|
45 |
|
|
46 |
get_api5_arguments() { |
|
47 |
GETOPT_RESULT=$* |
|
48 |
# Note the quotes around `$TEMP': they are essential! |
|
49 |
eval set -- "$GETOPT_RESULT" |
|
50 |
while true; do |
|
51 |
case "$1" in |
|
52 |
-i|-n) instance=$2; shift 2;; |
|
53 |
|
|
54 |
-o) old_name=$2; shift 2;; |
|
55 |
|
|
56 |
-b) blockdev=$2; shift 2;; |
|
57 |
|
|
58 |
-s) swapdev=$2; shift 2;; |
|
59 |
|
|
60 |
--) shift; break;; |
|
61 |
|
|
62 |
*) log_error "Internal error!" >&2; exit 1;; |
|
63 |
esac |
|
64 |
done |
|
65 |
if [ -z "$instance" -o -z "$blockdev" ]; then |
|
66 |
log_error "Missing OS API Argument (-i, -n, or -b)" |
|
67 |
exit 1 |
|
68 |
fi |
|
69 |
if [ "$SCRIPT_NAME" != "export" -a -z "$swapdev" ]; then |
|
70 |
log_error "Missing OS API Argument -s (swapdev)" |
|
71 |
exit 1 |
|
72 |
fi |
|
73 |
if [ "$SCRIPT_NAME" = "rename" -a -z "$old_name" ]; then |
|
74 |
log_error "Missing OS API Argument -o (old_name)" |
|
75 |
exit 1 |
|
76 |
fi |
|
77 |
} |
|
78 |
|
|
79 |
get_api10_arguments() { |
|
80 |
if [ -z "$INSTANCE_NAME" -o -z "$HYPERVISOR" -o -z "$DISK_COUNT" ]; then |
|
81 |
log_error "Missing OS API Variable:" |
|
82 |
log_error "(INSTANCE_NAME HYPERVISOR or DISK_COUNT)" |
|
83 |
exit 1 |
|
84 |
fi |
|
85 |
instance=$INSTANCE_NAME |
|
86 |
if [ $DISK_COUNT -lt 1 -o -z "$DISK_0_PATH" ]; then |
|
87 |
log_error "At least one disk is needed" |
|
88 |
exit 1 |
|
89 |
fi |
|
90 |
if [ "$SCRIPT_NAME" = "export" ]; then |
|
91 |
if [ -z "$EXPORT_DEVICE" ]; then |
|
92 |
log_error "Missing OS API Variable EXPORT_DEVICE" |
|
93 |
fi |
|
94 |
blockdev=$EXPORT_DEVICE |
|
95 |
elif [ "$SCRIPT_NAME" = "import" ]; then |
|
96 |
if [ -z "$IMPORT_DEVICE" ]; then |
|
97 |
log_error "Missing OS API Variable IMPORT_DEVICE" |
|
98 |
fi |
|
99 |
blockdev=$IMPORT_DEVICE |
|
100 |
else |
|
101 |
blockdev=$DISK_0_PATH |
|
102 |
fi |
|
103 |
if [ "$SCRIPT_NAME" = "rename" -a -z "$OLD_INSTANCE_NAME" ]; then |
|
104 |
log_error "Missing OS API Variable OLD_INSTANCE_NAME" |
|
105 |
fi |
|
106 |
old_name=$OLD_INSTANCE_NAME |
|
107 |
} |
|
108 |
|
|
109 |
get_api20_arguments() { |
|
110 |
get_api10_arguments |
|
111 |
if [ -z "$OSP_IMG_ID" ]; then |
|
112 |
log_error "Missing OS API Parameter: OSP_IMG_ID" |
|
113 |
exit 1 |
|
114 |
fi |
|
115 |
if [ -z "$OSP_IMG_FORMAT" ]; then |
|
116 |
log_error "Missing OS API Parameter: OSP_IMG_FORMAT" |
|
117 |
exit 1 |
|
118 |
fi |
|
119 |
if [ -z "$OSP_IMG_PASSWD" ]; then |
|
120 |
log_error "Missing OS API Parameter: OSP_IMG_PASSWD" |
|
121 |
exit 1 |
|
122 |
fi |
|
123 |
|
|
124 |
IMG_ID=$OSP_IMG_ID |
|
125 |
IMG_FORMAT=$OSP_IMG_FORMAT |
|
126 |
IMG_PASSWD=$OSP_IMG_PASSWD |
|
127 |
if [ -n "$OSP_IMG_PERSONALITY" ]; then |
|
128 |
IMG_PERSONALITY=$OSP_IMG_PERSONALITY |
|
129 |
fi |
|
130 |
} |
|
131 |
|
|
132 |
map_disk0() { |
|
133 |
blockdev="$1" |
|
134 |
filesystem_dev_base=$($KPARTX -l -p- $blockdev | \ |
|
135 |
grep -m 1 -- "-1.*$blockdev" | \ |
|
136 |
$AWK '{print $1}') |
|
137 |
if [ -z "$filesystem_dev_base" ]; then |
|
138 |
log_error "Cannot interpret kpartx output and get partition mapping" |
|
139 |
exit 1 |
|
140 |
fi |
|
141 |
$KPARTX -a -p- $blockdev > /dev/null |
|
142 |
filesystem_dev="/dev/mapper/${filesystem_dev_base/%-1/}" |
|
143 |
if [ ! -b "/dev/mapper/$filesystem_dev_base" ]; then |
|
144 |
log_error "Can't find kpartx mapped partition:" \ |
|
145 |
"/dev/mapper/$filesystem_dev_base" |
|
146 |
exit 1 |
|
147 |
fi |
|
148 |
echo "$filesystem_dev" |
|
149 |
} |
|
150 |
|
|
151 |
unmap_disk0() { |
|
152 |
$KPARTX -d -p- $1 |
|
153 |
} |
|
154 |
|
|
155 |
format_disk0() { |
|
156 |
local device="$1" |
|
157 |
local image_type="$2" |
|
158 |
|
|
159 |
declare -A part_id=( ['extdump']="83" ["ntfsdump"]="7" ) |
|
160 |
|
|
161 |
# The -f is needed, because we use an optimal alignment and sfdisk complains |
|
162 |
# about partitions not ending on clylinder boundary. |
|
163 |
local sfdisk_cmd="$SFDISK -uS -H 255 -S 63 -f --quiet --Linux --DOS $device" |
|
164 |
|
|
165 |
$sfdisk_cmd > /dev/null <<EOF |
|
166 |
2048,,${part_id["$image_type"]},* |
|
167 |
EOF |
|
168 |
} |
|
169 |
|
|
170 |
create_floppy() { |
|
171 |
local img=$1 |
|
172 |
|
|
173 |
local target=$(mktemp -d) || exit 1 |
|
174 |
CLEANUP+=("rmdir $target") |
|
175 |
|
|
176 |
dd bs=512 count=2880 if=/dev/zero of=$img |
|
177 |
mkfs.ext2 -F $img > /dev/null |
|
178 |
mount $img $target -o loop |
|
179 |
set | egrep ^snf_export_\\w+=|sed -e 's/^snf_export_/SNF_IMAGE_/' | \ |
|
180 |
while read line; do |
|
181 |
echo "export $line" >> $target/rules |
|
182 |
done |
|
183 |
umount $target |
|
184 |
} |
|
185 |
|
|
186 |
cleanup() { |
|
187 |
if [ ${#CLEANUP[*]} -gt 0 ]; then |
|
188 |
LAST_ELEMENT=$((${#CLEANUP[*]}-1)) |
|
189 |
REVERSE_INDEXES=$(seq ${LAST_ELEMENT} -1 0) |
|
190 |
for i in $REVERSE_INDEXES; do |
|
191 |
${CLEANUP[$i]} |
|
192 |
done |
|
193 |
fi |
|
194 |
} |
|
195 |
|
|
196 |
trap cleanup EXIT |
|
197 |
|
|
198 |
DEFAULT_FILE="@sysconfdir@/default/snf-image" |
|
199 |
if [ -f "$DEFAULT_FILE" ]; then |
|
200 |
. "$DEFAULT_FILE" |
|
201 |
fi |
|
202 |
|
|
203 |
: ${ARCH:="x86_64"} |
|
204 |
: ${VARIANTS_DIR:="@sysconfdir@/ganeti/snf-image/variants"} |
|
205 |
: ${IMAGE_DIR:="@localstatedir@/lib/snf-image"} |
|
206 |
: ${HELPER:="@HELPER@"} |
|
207 |
: ${HELPER_KERNEL:="@HELPER_KERNEL@"} |
|
208 |
: ${HELPER_INITRD:="@HELPER_INITRD@"} |
|
209 |
: ${HELPER_SOFT_TIMEOUT=120} |
|
210 |
: ${HELPER_HARD_TIMEOUT=15} |
|
211 |
: ${HELPER_USR="nobody"} |
|
212 |
|
|
213 |
SCRIPT_NAME=$(basename $0) |
|
214 |
|
|
215 |
if [ -f /sbin/blkid -a -x /sbin/blkid ]; then |
|
216 |
VOL_ID="/sbin/blkid -c /dev/null -o value -s UUID" |
|
217 |
VOL_TYPE="/sbin/blkid -c /dev/null -o value -s TYPE" |
|
218 |
else |
|
219 |
for dir in /lib/udev /sbin; do |
|
220 |
if [ -f $dir/vol_id -a -x $dir/vol_id ]; then |
|
221 |
VOL_ID="$dir/vol_id -u" |
|
222 |
VOL_TYPE="$dir/vol_id -t" |
|
223 |
fi |
|
224 |
done |
|
225 |
fi |
|
226 |
|
|
227 |
if [ -z "$VOL_ID" ]; then |
|
228 |
log_error "vol_id or blkid not found, please install udev or util-linux" |
|
229 |
exit 1 |
|
230 |
fi |
|
231 |
|
|
232 |
|
|
233 |
if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then |
|
234 |
OS_API_VERSION=5 |
|
235 |
GETOPT_RESULT=`getopt -o o:n:i:b:s: -n '$0' -- "$@"` |
|
236 |
if [ $? != 0 ] ; then log_error "Terminating..."; exit 1 ; fi |
|
237 |
get_api5_arguments $GETOPT_RESULT |
|
238 |
elif [ "$OS_API_VERSION" = "10" -o "$OS_API_VERSION" = "15" ]; then |
|
239 |
get_api10_arguments |
|
240 |
elif [ "$OS_API_VERSION" = "20" ]; then |
|
241 |
get_api20_arguments |
|
242 |
IMAGE_NAME=$IMG_ID |
|
243 |
IMAGE_TYPE=$IMG_FORMAT |
|
244 |
else |
|
245 |
log_error "Unknown OS API VERSION $OS_API_VERSION" |
|
246 |
exit 1 |
|
247 |
fi |
|
248 |
|
|
249 |
if [ -n "$OS_VARIANT" ]; then |
|
250 |
if [ ! -d "$VARIANTS_DIR" ]; then |
|
251 |
log_error "OS Variants directory $VARIANTS_DIR doesn't exist" |
|
252 |
exit 1 |
|
253 |
fi |
|
254 |
VARIANT_CONFIG="$VARIANTS_DIR/$OS_VARIANT.conf" |
|
255 |
if [ -f "$VARIANT_CONFIG" ]; then |
|
256 |
. "$VARIANT_CONFIG" |
|
257 |
else |
|
258 |
if grep -qxF "$OS_VARIANT" variants.list; then |
|
259 |
log_error "ERROR: instance-image configuration error" |
|
260 |
log_error " Published variant $OS_VARIANT is missing its config" \ |
|
261 |
"file" |
|
262 |
log_error " Please create $VARIANT_CONFIG or unpublish the variant" |
|
263 |
log_error " (by removing $OS_VARIANT from variants.list)" |
|
264 |
else |
|
265 |
log_error "Unofficial variant $OS_VARIANT is unsupported" |
|
266 |
log_error "Most probably this is a user error, forcing a wrong name" |
|
267 |
log_error "To support this variant please create file" \ |
|
268 |
"$VARIANT_CONFIG" |
|
269 |
fi |
|
270 |
exit 1 |
|
271 |
fi |
|
272 |
fi |
|
273 |
|
|
274 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
/dev/null | ||
---|---|---|
1 |
AC_PREREQ(2.59) |
|
2 |
AC_INIT(snf-image, 0.1, synnefo@lists.grnet.gr) |
|
3 |
|
|
4 |
AC_CONFIG_AUX_DIR(autotools) |
|
5 |
AC_CONFIG_SRCDIR(configure) |
|
6 |
|
|
7 |
AM_INIT_AUTOMAKE([1.9 foreign tar-ustar -Wall -Wno-portability]) |
|
8 |
AM_INIT_AUTOMAKE([subdir-objects]) |
|
9 |
|
|
10 |
# --with-progress-monitor |
|
11 |
AC_ARG_WITH([progress-monitor], |
|
12 |
[AS_HELP_STRING([--with-progress-monitor=PRGRM_PATH], |
|
13 |
[path to progress-monitor program] |
|
14 |
[[snf-progress-monitor]])], |
|
15 |
[if test "$withval" = "yes" ; then |
|
16 |
AC_PATH_PROG(PROGRESS_MONITOR, [snf-progress-monitor], [], [$PATH:/usr/sbin:/sbin]) |
|
17 |
if test -z "$PROGRESS_MONITOR" ; then |
|
18 |
AC_MSG_FAILURE([Could not find snf-progress-monitor.]) |
|
19 |
fi |
|
20 |
else |
|
21 |
PROGRESS_MONITOR="$withval" |
|
22 |
fi], |
|
23 |
[AC_MSG_NOTICE(progress-monitor support not enabled)] |
|
24 |
) |
|
25 |
|
|
26 |
AM_CONDITIONAL(PROGMONSUPPORT, [test -n "$PROGRESS_MONITOR"]) |
|
27 |
|
|
28 |
# --with-helper.. |
|
29 |
AC_ARG_WITH([helper], |
|
30 |
[AS_HELP_STRING([--with-helper=IMG_PATH], |
|
31 |
[Path to helper VM image [LOCALSTATEDIR/lib/snf-image/helper.img]] |
|
32 |
)], |
|
33 |
[helper="$withval"], |
|
34 |
[helper="$localstatedir/lib/snf-image/helper.img"]) |
|
35 |
AC_SUBST(HELPER, $helper) |
|
36 |
|
|
37 |
# --with-helper-kernel |
|
38 |
AC_ARG_WITH([helper_kernel], |
|
39 |
[AS_HELP_STRING([--with-helper-kernel=KERNEL_PATH], |
|
40 |
[Path to a kernel to use to boot the helper VM image |
|
41 |
[LOCALSTATEDIR/lib/snf-image/helper-kernel]] |
|
42 |
)], |
|
43 |
[helper_ernel="$withval"], |
|
44 |
[helper_kernel="$localstatedir/lib/snf-image/helper-kernel"]) |
|
45 |
AC_SUBST(HELPER_KERNEL, ${helper_kernel}) |
|
46 |
|
|
47 |
# --with-helper-initrd.. |
|
48 |
AC_ARG_WITH([helper_initrd], |
|
49 |
[AS_HELP_STRING([--with-helper-initrd=INITRD_PATH], |
|
50 |
[Path to an initial ramdisk to use to boot the helper VM image |
|
51 |
[LOCALSTATEDIR/lib/snf-image/helper-initrd]] |
|
52 |
)], |
|
53 |
[helper_initrd="$withval"], |
|
54 |
[helper_initrd="$localstatedir/lib/snf-image/helper-initrd"]) |
|
55 |
AC_SUBST(HELPER_INITRD, ${helper_initrd}) |
|
56 |
|
|
57 |
# --with-os-dir=... |
|
58 |
AC_ARG_WITH([os-dir], |
|
59 |
[AS_HELP_STRING([--with-os-dir=DIR], |
|
60 |
[top-level OS directory under which to install [DATADIR/ganeti/os]] |
|
61 |
)], |
|
62 |
[os_dir="$withval"], |
|
63 |
[os_dir="$datadir/ganeti/os"]) |
|
64 |
AC_SUBST(OS_DIR, $os_dir) |
|
65 |
|
|
66 |
# --with-default-dir=... |
|
67 |
AC_ARG_WITH([default-dir], |
|
68 |
[AS_HELP_STRING([--with-default-dir=DIR], |
|
69 |
[top-level default config directory under which to install] |
|
70 |
[ [SYSCONFDIR/default]] |
|
71 |
)], |
|
72 |
[default_dir="$withval"], |
|
73 |
[default_dir="$sysconfdir/default"]) |
|
74 |
AC_SUBST(DEFAULT_DIR, $default_dir) |
|
75 |
|
|
76 |
# Check common programs |
|
77 |
AC_PROG_INSTALL |
|
78 |
AC_PROG_LN_S |
|
79 |
AC_PROG_AWK |
|
80 |
AC_PROG_MKDIR_P |
|
81 |
|
|
82 |
AC_PATH_PROG(LOSETUP, [losetup], [], [$PATH:/usr/sbin:/sbin]) |
|
83 |
if test -z "$LOSETUP" ; then |
|
84 |
AC_MSG_ERROR([losetup not found in $PATH:/usr/sbin:/sbin]) |
|
85 |
fi |
|
86 |
|
|
87 |
AC_PATH_PROG(KPARTX, [kpartx], [], [$PATH:/usr/sbin:/sbin]) |
|
88 |
if test -z "$KPARTX" ; then |
|
89 |
AC_MSG_ERROR([kpartx not found in $PATH:/usr/sbin:/sbin]) |
|
90 |
fi |
|
91 |
|
|
92 |
AC_PATH_PROG(SFDISK, [sfdisk], [], [$PATH:/usr/sbin:/sbin]) |
|
93 |
if test -z "$SFDISK" ; then |
|
94 |
AC_MSG_ERROR([sfdisk not found in $PATH:/usr/sbin:/sbin]) |
|
95 |
fi |
|
96 |
|
|
97 |
AC_PATH_PROG(TIMELIMIT, [timelimit], [], [$PATH:/usr/sbin:/sbin]) |
|
98 |
if test -z "$TIMELIMIT" ; then |
|
99 |
AC_MSG_ERROR([timelimit not found in $PATH:/usr/sbin:/sbin]) |
|
100 |
fi |
|
101 |
|
|
102 |
AC_CONFIG_FILES([ |
|
103 |
Makefile |
|
104 |
]) |
|
105 |
|
|
106 |
AC_OUTPUT |
|
107 |
|
|
108 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
|
109 |
|
/dev/null | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
# Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
# |
|
5 |
# Redistribution and use in source and binary forms, with or without |
|
6 |
# modification, are permitted provided that the following conditions |
|
7 |
# are met: |
|
8 |
# |
|
9 |
# 1. Redistributions of source code must retain the above copyright |
|
10 |
# notice, this list of conditions and the following disclaimer. |
|
11 |
# |
|
12 |
# 2. Redistributions in binary form must reproduce the above copyright |
|
13 |
# notice, this list of conditions and the following disclaimer in the |
|
14 |
# documentation and/or other materials provided with the distribution. |
|
15 |
# |
|
16 |
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
|
17 |
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
18 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
19 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
|
20 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
21 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|
22 |
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
23 |
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
24 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|
25 |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
26 |
# SUCH DAMAGE. |
|
27 |
# |
|
28 |
# The views and conclusions contained in the software and documentation are |
|
29 |
# those of the authors and should not be interpreted as representing official |
|
30 |
# policies, either expressed or implied, of GRNET S.A. |
|
31 |
|
|
32 |
set -e |
|
33 |
|
|
34 |
. common.sh |
|
35 |
|
|
36 |
case "$IMAGE_TYPE" in |
|
37 |
extdump) |
|
38 |
IMAGE_FILE="${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}.extdump";; |
|
39 |
ntfsdump) |
|
40 |
IMAGE_FILE="${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}.ntfsdump";; |
|
41 |
*) |
|
42 |
log_error "Unknown image type: \`$IMAGE_TYPE'."; |
|
43 |
exit 1 |
|
44 |
esac |
|
45 |
|
|
46 |
if [ ! -e "$IMAGE_FILE" ]; then |
|
47 |
log_error "Image file \`$IMAGE_FILE' does not exit." |
|
48 |
exit 1 |
|
49 |
fi |
|
50 |
|
|
51 |
MONITOR="" #Empty if progress monitor support is disabled |
|
52 |
if [ "$progress_monitor_support" = "yes" ]; then |
|
53 |
IMAGE_SIZE="$(stat -L -c %s ${IMAGE_FILE})" |
|
54 |
MONITOR="$PROGRESS_MONITOR -i ${INSTANCE_NAME} -r ${IMAGE_SIZE}" |
|
55 |
fi |
|
56 |
|
|
57 |
# If the target device is not a real block device we'll first losetup it. |
|
58 |
# This is needed for file disks. |
|
59 |
if [ ! -b $blockdev ]; then |
|
60 |
ORIGINAL_BLOCKDEV=$blockdev |
|
61 |
blockdev=$($LOSETUP -sf $blockdev) |
|
62 |
CLEANUP+=("$LOSETUP -d $blockdev") |
|
63 |
fi |
|
64 |
|
|
65 |
format_disk0 $blockdev ${IMAGE_TYPE} |
|
66 |
|
|
67 |
filesystem_dev=$(map_disk0 $blockdev) |
|
68 |
CLEANUP+=("unmap_disk0 $blockdev") |
|
69 |
|
|
70 |
root_dev="${filesystem_dev}-1" |
|
71 |
|
|
72 |
# dd the dump to its new home :-) |
|
73 |
# Deploying an image file on a target block device is a streaming |
|
74 |
# copy operation. Enable the direct I/O flag on the output fd to |
|
75 |
# avoid polluting the host cache with useless data. |
|
76 |
$MONITOR dd bs=4M if=$IMAGE_FILE of=$root_dev oflag=direct |
|
77 |
|
|
78 |
# Create a floppy image |
|
79 |
floppy=$(mktemp --tmpdir floppy.XXXXXXXX) |
|
80 |
CLEANUP+=("rm -f $floppy") |
|
81 |
|
|
82 |
snf_export_DEV=/dev/vda |
|
83 |
snf_export_TYPE=${IMG_FORMAT} |
|
84 |
snf_export_PASSWORD=${IMG_PASSWD} |
|
85 |
snf_export_HOSTNAME=${instance} |
|
86 |
if [ -n "$IMG_PERSONALITY" ]; then |
|
87 |
snf_export_PERSONALITY=${IMG_PERSONALITY} |
|
88 |
fi |
|
89 |
|
|
90 |
create_floppy $floppy |
|
91 |
|
|
92 |
# Invoke the helper vm to do the dirty job... |
|
93 |
result_file=$(mktemp --tmpdir result.XXXXXXXX) |
|
94 |
CLEANUP+=("rm -f $result_file") |
|
95 |
|
|
96 |
$TIMELIMIT -t $HELPER_SOFT_TIMEOUT -T $HELPER_HARD_TIMEOUT \ |
|
97 |
kvm -runas $HELPER_USR -drive file=${HELPER},snapshot=on \ |
|
98 |
-drive file=$root_dev,format=raw,if=virtio,cache=none \ |
|
99 |
-boot c -serial stdio -serial file:$result_file -fda $floppy \ |
|
100 |
-vga none -nographic -parallel none -monitor null -nographic \ |
|
101 |
-kernel ${HELPER_KERNEL} -initrd ${HELPER_INITRD} \ |
|
102 |
-append "quiet ro root=/dev/sda1 console=ttyS0,9600n8" \ |
|
103 |
2>&1 | sed 's|^|HELPER: |g' |
|
104 |
|
|
105 |
if [ $? -ne 0 ]; then |
|
106 |
if [ $? -gt 128 ]; then |
|
107 |
log_error "Helper was terminated. Did not finish on time." |
|
108 |
fi |
|
109 |
exit 1 |
|
110 |
fi |
|
111 |
|
|
112 |
# Read the first line. This will remove \r and \n chars |
|
113 |
result=$(sed 's|\r||g' $result_file | xargs echo) |
|
114 |
|
|
115 |
if [ "x$result" != "xSUCCESS" ]; then |
|
116 |
log_error "Helper VM returned error" |
|
117 |
exit 1 |
|
118 |
fi |
|
119 |
|
|
120 |
# Install a new MBR |
|
121 |
$INSTALL_MBR -p 1 -i n ${blockdev} |
|
122 |
|
|
123 |
# Execute cleanups |
|
124 |
cleanup |
|
125 |
trap - EXIT |
|
126 |
|
|
127 |
exit 0 |
|
128 |
|
|
129 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
/dev/null | ||
---|---|---|
1 |
# snf-image defaults file |
|
2 |
|
|
3 |
# IMAGE_NAME: Name of the image to use |
|
4 |
# Generally you use the name of the image with the version of the OS included. |
|
5 |
# Examples include: |
|
6 |
# centos-5.4 debian-4.0 fedora-12 |
|
7 |
# IMAGE_NAME="" |
|
8 |
|
|
9 |
# IMAGE_DIR: directory location for disk images |
|
10 |
# ( default is @localstatedir@/cache/ganeti-instance-image ) |
|
11 |
# IMAGE_DIR="" |
|
12 |
|
|
13 |
# ARCH: Define the ARCH of the image to use |
|
14 |
# Use either x86 or x86_64 |
|
15 |
# ARCH="x86_64" |
|
16 |
|
|
17 |
# IMAGE_DEBUG: turn on debugging output for the scripts |
|
18 |
# IMAGE_DEBUG=0 |
|
19 |
|
|
20 |
# HELPER: path to the image file of the helper vm |
|
21 |
# HELPER="var/lib/snf-image/helper.img" |
|
22 |
|
|
23 |
# HELPER_KERNEL: path to the kernel, kvm should use to run the helper image |
|
24 |
# HELPER_KERNEL="/var/lib/snf-image/helper-kernel" |
|
25 |
|
|
26 |
# HELPER_INITRD: path to the init ramdisk the helper vm should use. |
|
27 |
# HELPER_INITRD="/var/lib/snf-image/helper-initrd" |
|
28 |
|
|
29 |
# HELPER_TIMOUT: Soft and hard timeout limits for helper instance. |
|
30 |
# Helper instance will be terminated after a given time if it hasn't exited by |
|
31 |
# itself. The time to wait before killing the process is specified by those |
|
32 |
# variables. When soft/hard limit expires, a SIGTERM/SIGKILL is sent. |
|
33 |
# HELPER_SOFT_TIMEOUT="120" |
|
34 |
# HELPER_HARD_TIMEOUT="15" |
|
35 |
|
|
36 |
# HELPER_USR: For security reasons, the helper vm is not adviced to to run as |
|
37 |
# root. It should drop privileges just before the guest execution starts. The |
|
38 |
# user the helper vm should run as is specifies by HELPER_USR variable. |
|
39 |
# HELPER_USR="nobody" |
|
40 |
|
|
41 |
# Paths for needed programs. Uncommend and change the variables below, if you |
|
42 |
# don't want to use the default one. |
|
43 |
# LOSETUP="losetup" |
|
44 |
# KPARTX="kpartx" |
|
45 |
# SFDISK="sfdisk" |
|
46 |
# INSTALL_MBR="install-mbr" |
|
47 |
# TIMELIMIT="timelimit" |
|
48 |
# if [ "$windows_support" = "yes" ] ; then |
|
49 |
# PROGRESS_MONITOR="snf-progress-monitor" |
|
50 |
# fi |
/dev/null | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
exit 0 |
/dev/null | ||
---|---|---|
1 |
20 |
|
2 |
15 |
|
3 |
10 |
|
4 |
5 |
/dev/null | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
exit 0 |
/dev/null | ||
---|---|---|
1 |
img_id The id of the image to be installed (the id will be the image's file name prefix) |
|
2 |
img_format The format of the image to be installed |
|
3 |
img_passwd The root password which will be injected into the image |
|
4 |
img_personality The files to be injected into the image (base64 encoded in a json.dumps format) |
/dev/null | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
exit 0 |
/dev/null | ||
---|---|---|
1 |
default |
/dev/null | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
exit 0 |
b/snf-image-host/AUTHORS | ||
---|---|---|
1 |
Nikos Skalkotos <skalkoto@grnet.gr> |
|
2 |
Constantinos Venetsanopoulos <cven@grnet.gr> |
b/snf-image-host/COPYING | ||
---|---|---|
1 |
Copyright 2011 GRNET S.A. All rights reserved. |
|
2 |
|
|
3 |
Redistribution and use in source and binary forms, with or |
|
4 |
without modification, are permitted provided that the following |
|
5 |
conditions are met: |
|
6 |
|
|
7 |
1. Redistributions of source code must retain the above |
|
8 |
copyright notice, this list of conditions and the following |
|
9 |
disclaimer. |
|
10 |
|
|
11 |
2. Redistributions in binary form must reproduce the above |
|
12 |
copyright notice, this list of conditions and the following |
|
13 |
disclaimer in the documentation and/or other materials |
|
14 |
provided with the distribution. |
|
15 |
|
|
16 |
THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
17 |
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
18 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
19 |
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
20 |
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
21 |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
22 |
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
23 |
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
24 |
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
25 |
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
26 |
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
27 |
POSSIBILITY OF SUCH DAMAGE. |
|
28 |
|
|
29 |
The views and conclusions contained in the software and |
|
30 |
documentation are those of the authors and should not be |
|
31 |
interpreted as representing official policies, either expressed |
|
32 |
or implied, of GRNET S.A. |
b/snf-image-host/ChangeLog | ||
---|---|---|
1 |
2011-10-04 Nikos Skalkotos <skalkoto@grnet.gr> |
|
2 |
* Initial release v0.1 |
b/snf-image-host/Makefile.am | ||
---|---|---|
1 |
if PROGMONSUPPORT |
|
2 |
progress_monitor_support=yes |
|
3 |
else |
|
4 |
progress_monitor_support=no |
|
5 |
endif |
|
6 |
|
|
7 |
osname=$(PACKAGE) |
|
8 |
osdir=$(OS_DIR)/$(osname) |
|
9 |
defaultdir=$(DEFAULT_DIR) |
|
10 |
variantsdir=${sysconfdir}/ganeti/snf-image/variants |
|
11 |
|
|
12 |
dist_os_SCRIPTS = ${srcdir}/create ${srcdir}/import ${srcdir}/export \ |
|
13 |
${srcdir}/rename ${srcdir}/verify |
|
14 |
|
|
15 |
dist_os_DATA = ${srcdir}/ganeti_api_version ${srcdir}/parameters.list \ |
|
16 |
${srcdir}/variants.list |
|
17 |
|
|
18 |
os_DATA = common.sh |
|
19 |
|
|
20 |
edit = sed \ |
|
21 |
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \ |
|
22 |
-e 's|@localstatedir[@]|$(localstatedir)|g' \ |
|
23 |
-e 's|@osdir[@]|$(osdir)|g' \ |
|
24 |
-e 's|@osname[@]|$(osname)|g' \ |
|
25 |
-e 's|@defaultdir[@]|$(defaultdir)|g' \ |
|
26 |
-e 's|@HELPER[@]|$(HELPER)|g' \ |
|
27 |
-e 's|@HELPER_KERNEL[@]|$(HELPER_KERNEL)|g' \ |
|
28 |
-e 's|@HELPER_INITRD[@]|$(HELPER_INITRD)|g' \ |
|
29 |
-e 's|@AWK[@]|$(AWK)|g' \ |
|
30 |
-e 's|@MKDIR_P[@]|$(MKDIR_P)|g' \ |
|
31 |
-e 's|@LOSETUP[@]|$(LOSETUP)|g' \ |
|
32 |
-e 's|@KPARTX[@]|$(KPARTX)|g' \ |
|
33 |
-e 's|@SFDISK[@]|$(SFDISK)|g' \ |
|
34 |
-e 's|@INSTALL_MBR[@]|$(INSTALL_MBR)|g' \ |
|
35 |
-e 's|@progress_monitor_support[@]|$(progress_monitor_support)|g' \ |
|
36 |
-e 's|@PROGRESS_MONITOR[@]|$(PROGRESS_MONITOR)|g' |
|
37 |
|
|
38 |
common.sh: Makefile |
|
39 |
rm -f $@ $@.tmp |
|
40 |
srcdir=''; \ |
|
41 |
test -f ./$@.in || srcdir=$(srcdir)/; \ |
|
42 |
$(edit) $${srcdir}$@.in >$@.tmp |
|
43 |
mv $@.tmp $@ |
|
44 |
|
|
45 |
install-exec-local: |
|
46 |
@mkdir_p@ "$(DESTDIR)$(osdir)" |
|
47 |
@mkdir_p@ "$(DESTDIR)$(variantsdir)" |
|
48 |
touch "$(DESTDIR)$(variantsdir)/default.conf" |
|
49 |
|
|
50 |
|
|
51 |
CLEANFILES = $(os_DATA) |
b/snf-image-host/autogen.sh | ||
---|---|---|
1 |
#!/bin/sh |
|
2 |
|
|
3 |
if test ! -f configure.ac ; then |
|
4 |
echo "You must execute this script from the top level directory." |
|
5 |
exit 1 |
|
6 |
fi |
|
7 |
|
|
8 |
set -e |
|
9 |
|
|
10 |
rm -rf config.cache autom4te.cache |
|
11 |
mkdir -p autotools |
|
12 |
|
|
13 |
${ACLOCAL:-aclocal} -I autotools |
|
14 |
${AUTOCONF:-autoconf} |
|
15 |
${AUTOMAKE:-automake} --add-missing |
|
16 |
|
|
17 |
rm -rf autom4te.cache |
b/snf-image-host/common.sh.in | ||
---|---|---|
1 |
# Copyright 2011 GRNET S.A. All rights reserved. |
|
2 |
# |
|
3 |
# Redistribution and use in source and binary forms, with or without |
|
4 |
# modification, are permitted provided that the following conditions |
|
5 |
# are met: |
|
6 |
# |
|
7 |
# 1. Redistributions of source code must retain the above copyright |
|
8 |
# notice, this list of conditions and the following disclaimer. |
|
9 |
# |
|
10 |
# 2. Redistributions in binary form must reproduce the above copyright |
|
11 |
# notice, this list of conditions and the following disclaimer in the |
|
12 |
# documentation and/or other materials provided with the distribution. |
|
13 |
# |
|
14 |
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
|
15 |
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
16 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
17 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
|
18 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
19 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|
20 |
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
21 |
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
22 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|
23 |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
24 |
# SUCH DAMAGE. |
|
25 |
# |
|
26 |
# The views and conclusions contained in the software and documentation are |
|
27 |
# those of the authors and should not be interpreted as representing official |
|
28 |
# policies, either expressed or implied, of GRNET S.A. |
|
29 |
|
|
30 |
AWK="awk" |
|
31 |
KPARTX="kpartx" |
|
32 |
LOSETUP="losetup" |
|
33 |
SFDISK="sfdisk" |
|
34 |
PROGRESS_MONITOR="snf-progress-monitor" |
|
35 |
INSTALL_MBR="install-mbr" |
|
36 |
TIMELIMIT="timelimit" |
|
37 |
|
|
38 |
progress_monitor_support="@progress_monitor_support@" |
|
39 |
|
|
40 |
CLEANUP=( ) |
|
41 |
|
|
42 |
log_error() { |
|
43 |
echo "$@" >&2 |
|
44 |
} |
|
45 |
|
|
46 |
get_api5_arguments() { |
|
47 |
GETOPT_RESULT=$* |
|
48 |
# Note the quotes around `$TEMP': they are essential! |
|
49 |
eval set -- "$GETOPT_RESULT" |
|
50 |
while true; do |
|
51 |
case "$1" in |
|
52 |
-i|-n) instance=$2; shift 2;; |
|
53 |
|
|
54 |
-o) old_name=$2; shift 2;; |
|
55 |
|
|
56 |
-b) blockdev=$2; shift 2;; |
|
57 |
|
|
58 |
-s) swapdev=$2; shift 2;; |
|
59 |
|
|
60 |
--) shift; break;; |
|
61 |
|
|
62 |
*) log_error "Internal error!" >&2; exit 1;; |
|
63 |
esac |
|
64 |
done |
|
65 |
if [ -z "$instance" -o -z "$blockdev" ]; then |
|
66 |
log_error "Missing OS API Argument (-i, -n, or -b)" |
|
67 |
exit 1 |
|
68 |
fi |
|
69 |
if [ "$SCRIPT_NAME" != "export" -a -z "$swapdev" ]; then |
|
70 |
log_error "Missing OS API Argument -s (swapdev)" |
|
71 |
exit 1 |
|
72 |
fi |
|
73 |
if [ "$SCRIPT_NAME" = "rename" -a -z "$old_name" ]; then |
|
74 |
log_error "Missing OS API Argument -o (old_name)" |
|
75 |
exit 1 |
|
76 |
fi |
|
77 |
} |
|
78 |
|
|
79 |
get_api10_arguments() { |
|
80 |
if [ -z "$INSTANCE_NAME" -o -z "$HYPERVISOR" -o -z "$DISK_COUNT" ]; then |
|
81 |
log_error "Missing OS API Variable:" |
|
82 |
log_error "(INSTANCE_NAME HYPERVISOR or DISK_COUNT)" |
|
83 |
exit 1 |
|
84 |
fi |
|
85 |
instance=$INSTANCE_NAME |
|
86 |
if [ $DISK_COUNT -lt 1 -o -z "$DISK_0_PATH" ]; then |
|
87 |
log_error "At least one disk is needed" |
|
88 |
exit 1 |
|
89 |
fi |
|
90 |
if [ "$SCRIPT_NAME" = "export" ]; then |
|
91 |
if [ -z "$EXPORT_DEVICE" ]; then |
|
92 |
log_error "Missing OS API Variable EXPORT_DEVICE" |
|
93 |
fi |
|
94 |
blockdev=$EXPORT_DEVICE |
|
95 |
elif [ "$SCRIPT_NAME" = "import" ]; then |
|
96 |
if [ -z "$IMPORT_DEVICE" ]; then |
|
97 |
log_error "Missing OS API Variable IMPORT_DEVICE" |
|
98 |
fi |
|
99 |
blockdev=$IMPORT_DEVICE |
|
100 |
else |
|
101 |
blockdev=$DISK_0_PATH |
|
102 |
fi |
|
103 |
if [ "$SCRIPT_NAME" = "rename" -a -z "$OLD_INSTANCE_NAME" ]; then |
|
104 |
log_error "Missing OS API Variable OLD_INSTANCE_NAME" |
|
105 |
fi |
|
106 |
old_name=$OLD_INSTANCE_NAME |
|
107 |
} |
|
108 |
|
|
109 |
get_api20_arguments() { |
|
110 |
get_api10_arguments |
|
111 |
if [ -z "$OSP_IMG_ID" ]; then |
|
112 |
log_error "Missing OS API Parameter: OSP_IMG_ID" |
|
113 |
exit 1 |
|
114 |
fi |
|
115 |
if [ -z "$OSP_IMG_FORMAT" ]; then |
|
116 |
log_error "Missing OS API Parameter: OSP_IMG_FORMAT" |
|
117 |
exit 1 |
|
118 |
fi |
|
119 |
if [ -z "$OSP_IMG_PASSWD" ]; then |
|
120 |
log_error "Missing OS API Parameter: OSP_IMG_PASSWD" |
|
121 |
exit 1 |
|
122 |
fi |
|
123 |
|
|
124 |
IMG_ID=$OSP_IMG_ID |
|
125 |
IMG_FORMAT=$OSP_IMG_FORMAT |
|
126 |
IMG_PASSWD=$OSP_IMG_PASSWD |
|
127 |
if [ -n "$OSP_IMG_PERSONALITY" ]; then |
|
128 |
IMG_PERSONALITY=$OSP_IMG_PERSONALITY |
|
129 |
fi |
|
130 |
} |
|
131 |
|
|
132 |
map_disk0() { |
|
133 |
blockdev="$1" |
|
134 |
filesystem_dev_base=$($KPARTX -l -p- $blockdev | \ |
|
135 |
grep -m 1 -- "-1.*$blockdev" | \ |
|
136 |
$AWK '{print $1}') |
|
137 |
if [ -z "$filesystem_dev_base" ]; then |
|
138 |
log_error "Cannot interpret kpartx output and get partition mapping" |
|
139 |
exit 1 |
|
140 |
fi |
|
141 |
$KPARTX -a -p- $blockdev > /dev/null |
|
142 |
filesystem_dev="/dev/mapper/${filesystem_dev_base/%-1/}" |
|
143 |
if [ ! -b "/dev/mapper/$filesystem_dev_base" ]; then |
|
144 |
log_error "Can't find kpartx mapped partition:" \ |
|
145 |
"/dev/mapper/$filesystem_dev_base" |
|
146 |
exit 1 |
|
147 |
fi |
|
148 |
echo "$filesystem_dev" |
|
149 |
} |
|
150 |
|
|
151 |
unmap_disk0() { |
|
152 |
$KPARTX -d -p- $1 |
|
153 |
} |
|
154 |
|
|
155 |
format_disk0() { |
|
156 |
local device="$1" |
|
157 |
local image_type="$2" |
|
158 |
|
|
159 |
declare -A part_id=( ['extdump']="83" ["ntfsdump"]="7" ) |
|
160 |
|
|
161 |
# The -f is needed, because we use an optimal alignment and sfdisk complains |
|
162 |
# about partitions not ending on clylinder boundary. |
|
163 |
local sfdisk_cmd="$SFDISK -uS -H 255 -S 63 -f --quiet --Linux --DOS $device" |
|
164 |
|
|
165 |
$sfdisk_cmd > /dev/null <<EOF |
|
166 |
2048,,${part_id["$image_type"]},* |
|
167 |
EOF |
|
168 |
} |
|
169 |
|
|
170 |
create_floppy() { |
|
171 |
local img=$1 |
|
172 |
|
|
173 |
local target=$(mktemp -d) || exit 1 |
|
174 |
CLEANUP+=("rmdir $target") |
|
175 |
|
|
176 |
dd bs=512 count=2880 if=/dev/zero of=$img |
|
177 |
mkfs.ext2 -F $img > /dev/null |
|
178 |
mount $img $target -o loop |
|
179 |
set | egrep ^snf_export_\\w+=|sed -e 's/^snf_export_/SNF_IMAGE_/' | \ |
|
180 |
while read line; do |
|
181 |
echo "export $line" >> $target/rules |
|
182 |
done |
|
183 |
umount $target |
|
184 |
} |
|
185 |
|
|
186 |
cleanup() { |
|
187 |
if [ ${#CLEANUP[*]} -gt 0 ]; then |
|
188 |
LAST_ELEMENT=$((${#CLEANUP[*]}-1)) |
|
189 |
REVERSE_INDEXES=$(seq ${LAST_ELEMENT} -1 0) |
|
190 |
for i in $REVERSE_INDEXES; do |
|
191 |
${CLEANUP[$i]} |
|
192 |
done |
|
193 |
fi |
|
194 |
} |
|
195 |
|
|
196 |
trap cleanup EXIT |
|
197 |
|
|
198 |
DEFAULT_FILE="@sysconfdir@/default/snf-image" |
|
199 |
if [ -f "$DEFAULT_FILE" ]; then |
|
200 |
. "$DEFAULT_FILE" |
|
201 |
fi |
|
202 |
|
|
203 |
: ${ARCH:="x86_64"} |
|
204 |
: ${VARIANTS_DIR:="@sysconfdir@/ganeti/snf-image/variants"} |
|
205 |
: ${IMAGE_DIR:="@localstatedir@/lib/snf-image"} |
|
206 |
: ${HELPER:="@HELPER@"} |
|
207 |
: ${HELPER_KERNEL:="@HELPER_KERNEL@"} |
|
208 |
: ${HELPER_INITRD:="@HELPER_INITRD@"} |
|
209 |
: ${HELPER_SOFT_TIMEOUT=120} |
|
210 |
: ${HELPER_HARD_TIMEOUT=15} |
|
211 |
: ${HELPER_USR="nobody"} |
|
212 |
|
|
213 |
SCRIPT_NAME=$(basename $0) |
|
214 |
|
|
215 |
if [ -f /sbin/blkid -a -x /sbin/blkid ]; then |
|
216 |
VOL_ID="/sbin/blkid -c /dev/null -o value -s UUID" |
|
217 |
VOL_TYPE="/sbin/blkid -c /dev/null -o value -s TYPE" |
|
218 |
else |
|
219 |
for dir in /lib/udev /sbin; do |
|
220 |
if [ -f $dir/vol_id -a -x $dir/vol_id ]; then |
|
221 |
VOL_ID="$dir/vol_id -u" |
|
222 |
VOL_TYPE="$dir/vol_id -t" |
|
223 |
fi |
|
224 |
done |
|
225 |
fi |
|
226 |
|
|
227 |
if [ -z "$VOL_ID" ]; then |
|
228 |
log_error "vol_id or blkid not found, please install udev or util-linux" |
|
229 |
exit 1 |
|
230 |
fi |
|
231 |
|
|
232 |
|
|
233 |
if [ -z "$OS_API_VERSION" -o "$OS_API_VERSION" = "5" ]; then |
|
234 |
OS_API_VERSION=5 |
|
235 |
GETOPT_RESULT=`getopt -o o:n:i:b:s: -n '$0' -- "$@"` |
|
236 |
if [ $? != 0 ] ; then log_error "Terminating..."; exit 1 ; fi |
|
237 |
get_api5_arguments $GETOPT_RESULT |
|
238 |
elif [ "$OS_API_VERSION" = "10" -o "$OS_API_VERSION" = "15" ]; then |
|
239 |
get_api10_arguments |
|
240 |
elif [ "$OS_API_VERSION" = "20" ]; then |
|
241 |
get_api20_arguments |
|
242 |
IMAGE_NAME=$IMG_ID |
|
243 |
IMAGE_TYPE=$IMG_FORMAT |
|
244 |
else |
|
245 |
log_error "Unknown OS API VERSION $OS_API_VERSION" |
|
246 |
exit 1 |
|
247 |
fi |
|
248 |
|
|
249 |
if [ -n "$OS_VARIANT" ]; then |
|
250 |
if [ ! -d "$VARIANTS_DIR" ]; then |
|
251 |
log_error "OS Variants directory $VARIANTS_DIR doesn't exist" |
|
252 |
exit 1 |
|
253 |
fi |
|
254 |
VARIANT_CONFIG="$VARIANTS_DIR/$OS_VARIANT.conf" |
|
255 |
if [ -f "$VARIANT_CONFIG" ]; then |
|
256 |
. "$VARIANT_CONFIG" |
|
257 |
else |
|
258 |
if grep -qxF "$OS_VARIANT" variants.list; then |
|
259 |
log_error "ERROR: instance-image configuration error" |
|
260 |
log_error " Published variant $OS_VARIANT is missing its config" \ |
|
261 |
"file" |
|
262 |
log_error " Please create $VARIANT_CONFIG or unpublish the variant" |
|
263 |
log_error " (by removing $OS_VARIANT from variants.list)" |
|
264 |
else |
|
265 |
log_error "Unofficial variant $OS_VARIANT is unsupported" |
|
266 |
log_error "Most probably this is a user error, forcing a wrong name" |
|
267 |
log_error "To support this variant please create file" \ |
|
268 |
"$VARIANT_CONFIG" |
|
269 |
fi |
|
270 |
exit 1 |
|
271 |
fi |
|
272 |
fi |
|
273 |
|
|
274 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
b/snf-image-host/configure.ac | ||
---|---|---|
1 |
AC_PREREQ(2.59) |
|
2 |
AC_INIT(snf-image, 0.1, synnefo@lists.grnet.gr) |
|
3 |
|
|
4 |
AC_CONFIG_AUX_DIR(autotools) |
|
5 |
AC_CONFIG_SRCDIR(configure) |
|
6 |
|
|
7 |
AM_INIT_AUTOMAKE([1.9 foreign tar-ustar -Wall -Wno-portability]) |
|
8 |
AM_INIT_AUTOMAKE([subdir-objects]) |
|
9 |
|
|
10 |
# --with-progress-monitor |
|
11 |
AC_ARG_WITH([progress-monitor], |
|
12 |
[AS_HELP_STRING([--with-progress-monitor=PRGRM_PATH], |
|
13 |
[path to progress-monitor program] |
|
14 |
[[snf-progress-monitor]])], |
|
15 |
[if test "$withval" = "yes" ; then |
|
16 |
AC_PATH_PROG(PROGRESS_MONITOR, [snf-progress-monitor], [], [$PATH:/usr/sbin:/sbin]) |
|
17 |
if test -z "$PROGRESS_MONITOR" ; then |
|
18 |
AC_MSG_FAILURE([Could not find snf-progress-monitor.]) |
|
19 |
fi |
|
20 |
else |
|
21 |
PROGRESS_MONITOR="$withval" |
|
22 |
fi], |
|
23 |
[AC_MSG_NOTICE(progress-monitor support not enabled)] |
|
24 |
) |
|
25 |
|
|
26 |
AM_CONDITIONAL(PROGMONSUPPORT, [test -n "$PROGRESS_MONITOR"]) |
|
27 |
|
|
28 |
# --with-helper.. |
|
29 |
AC_ARG_WITH([helper], |
|
30 |
[AS_HELP_STRING([--with-helper=IMG_PATH], |
|
31 |
[Path to helper VM image [LOCALSTATEDIR/lib/snf-image/helper.img]] |
|
32 |
)], |
|
33 |
[helper="$withval"], |
|
34 |
[helper="$localstatedir/lib/snf-image/helper.img"]) |
|
35 |
AC_SUBST(HELPER, $helper) |
|
36 |
|
|
37 |
# --with-helper-kernel |
|
38 |
AC_ARG_WITH([helper_kernel], |
|
39 |
[AS_HELP_STRING([--with-helper-kernel=KERNEL_PATH], |
|
40 |
[Path to a kernel to use to boot the helper VM image |
|
41 |
[LOCALSTATEDIR/lib/snf-image/helper-kernel]] |
|
42 |
)], |
|
43 |
[helper_ernel="$withval"], |
|
44 |
[helper_kernel="$localstatedir/lib/snf-image/helper-kernel"]) |
|
45 |
AC_SUBST(HELPER_KERNEL, ${helper_kernel}) |
|
46 |
|
|
47 |
# --with-helper-initrd.. |
|
48 |
AC_ARG_WITH([helper_initrd], |
|
49 |
[AS_HELP_STRING([--with-helper-initrd=INITRD_PATH], |
|
50 |
[Path to an initial ramdisk to use to boot the helper VM image |
|
51 |
[LOCALSTATEDIR/lib/snf-image/helper-initrd]] |
|
52 |
)], |
|
53 |
[helper_initrd="$withval"], |
|
54 |
[helper_initrd="$localstatedir/lib/snf-image/helper-initrd"]) |
|
55 |
AC_SUBST(HELPER_INITRD, ${helper_initrd}) |
|
56 |
|
|
57 |
# --with-os-dir=... |
|
58 |
AC_ARG_WITH([os-dir], |
|
59 |
[AS_HELP_STRING([--with-os-dir=DIR], |
|
60 |
[top-level OS directory under which to install [DATADIR/ganeti/os]] |
|
61 |
)], |
|
62 |
[os_dir="$withval"], |
|
63 |
[os_dir="$datadir/ganeti/os"]) |
|
64 |
AC_SUBST(OS_DIR, $os_dir) |
|
65 |
|
|
66 |
# --with-default-dir=... |
|
67 |
AC_ARG_WITH([default-dir], |
|
68 |
[AS_HELP_STRING([--with-default-dir=DIR], |
|
69 |
[top-level default config directory under which to install] |
|
70 |
[ [SYSCONFDIR/default]] |
|
71 |
)], |
|
72 |
[default_dir="$withval"], |
|
73 |
[default_dir="$sysconfdir/default"]) |
|
74 |
AC_SUBST(DEFAULT_DIR, $default_dir) |
|
75 |
|
|
76 |
# Check common programs |
|
77 |
AC_PROG_INSTALL |
|
78 |
AC_PROG_LN_S |
|
79 |
AC_PROG_AWK |
|
80 |
AC_PROG_MKDIR_P |
|
81 |
|
|
82 |
AC_PATH_PROG(LOSETUP, [losetup], [], [$PATH:/usr/sbin:/sbin]) |
|
83 |
if test -z "$LOSETUP" ; then |
|
84 |
AC_MSG_ERROR([losetup not found in $PATH:/usr/sbin:/sbin]) |
|
85 |
fi |
|
86 |
|
|
87 |
AC_PATH_PROG(KPARTX, [kpartx], [], [$PATH:/usr/sbin:/sbin]) |
|
88 |
if test -z "$KPARTX" ; then |
|
89 |
AC_MSG_ERROR([kpartx not found in $PATH:/usr/sbin:/sbin]) |
|
90 |
fi |
|
91 |
|
|
92 |
AC_PATH_PROG(SFDISK, [sfdisk], [], [$PATH:/usr/sbin:/sbin]) |
|
93 |
if test -z "$SFDISK" ; then |
|
94 |
AC_MSG_ERROR([sfdisk not found in $PATH:/usr/sbin:/sbin]) |
|
95 |
fi |
|
96 |
|
|
97 |
AC_PATH_PROG(TIMELIMIT, [timelimit], [], [$PATH:/usr/sbin:/sbin]) |
|
98 |
if test -z "$TIMELIMIT" ; then |
|
99 |
AC_MSG_ERROR([timelimit not found in $PATH:/usr/sbin:/sbin]) |
|
100 |
fi |
|
101 |
|
|
102 |
AC_CONFIG_FILES([ |
|
103 |
Makefile |
|
104 |
]) |
|
105 |
|
|
106 |
AC_OUTPUT |
|
107 |
|
|
108 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
|
109 |
|
b/snf-image-host/create | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
# Copyright 2011 GRNET S.A. All rights reserved. |
|
4 |
# |
|
5 |
# Redistribution and use in source and binary forms, with or without |
|
6 |
# modification, are permitted provided that the following conditions |
|
7 |
# are met: |
|
8 |
# |
|
9 |
# 1. Redistributions of source code must retain the above copyright |
|
10 |
# notice, this list of conditions and the following disclaimer. |
|
11 |
# |
|
12 |
# 2. Redistributions in binary form must reproduce the above copyright |
|
13 |
# notice, this list of conditions and the following disclaimer in the |
|
14 |
# documentation and/or other materials provided with the distribution. |
|
15 |
# |
|
16 |
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
|
17 |
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
18 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
19 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
|
20 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
21 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|
22 |
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
23 |
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
24 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|
25 |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
26 |
# SUCH DAMAGE. |
|
27 |
# |
|
28 |
# The views and conclusions contained in the software and documentation are |
|
29 |
# those of the authors and should not be interpreted as representing official |
|
30 |
# policies, either expressed or implied, of GRNET S.A. |
|
31 |
|
|
32 |
set -e |
|
33 |
|
|
34 |
. common.sh |
|
35 |
|
|
36 |
case "$IMAGE_TYPE" in |
|
37 |
extdump) |
|
38 |
IMAGE_FILE="${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}.extdump";; |
|
39 |
ntfsdump) |
|
40 |
IMAGE_FILE="${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}.ntfsdump";; |
|
41 |
*) |
|
42 |
log_error "Unknown image type: \`$IMAGE_TYPE'."; |
|
43 |
exit 1 |
|
44 |
esac |
|
45 |
|
|
46 |
if [ ! -e "$IMAGE_FILE" ]; then |
|
47 |
log_error "Image file \`$IMAGE_FILE' does not exit." |
|
48 |
exit 1 |
|
49 |
fi |
|
50 |
|
|
51 |
MONITOR="" #Empty if progress monitor support is disabled |
|
52 |
if [ "$progress_monitor_support" = "yes" ]; then |
|
53 |
IMAGE_SIZE="$(stat -L -c %s ${IMAGE_FILE})" |
|
54 |
MONITOR="$PROGRESS_MONITOR -i ${INSTANCE_NAME} -r ${IMAGE_SIZE}" |
|
55 |
fi |
|
56 |
|
|
57 |
# If the target device is not a real block device we'll first losetup it. |
|
58 |
# This is needed for file disks. |
|
59 |
if [ ! -b $blockdev ]; then |
|
60 |
ORIGINAL_BLOCKDEV=$blockdev |
|
61 |
blockdev=$($LOSETUP -sf $blockdev) |
|
62 |
CLEANUP+=("$LOSETUP -d $blockdev") |
|
63 |
fi |
|
64 |
|
|
65 |
format_disk0 $blockdev ${IMAGE_TYPE} |
|
66 |
|
|
67 |
filesystem_dev=$(map_disk0 $blockdev) |
|
68 |
CLEANUP+=("unmap_disk0 $blockdev") |
|
69 |
|
|
70 |
root_dev="${filesystem_dev}-1" |
|
71 |
|
|
72 |
# dd the dump to its new home :-) |
|
73 |
# Deploying an image file on a target block device is a streaming |
|
74 |
# copy operation. Enable the direct I/O flag on the output fd to |
|
75 |
# avoid polluting the host cache with useless data. |
|
76 |
$MONITOR dd bs=4M if=$IMAGE_FILE of=$root_dev oflag=direct |
|
77 |
|
|
78 |
# Create a floppy image |
|
79 |
floppy=$(mktemp --tmpdir floppy.XXXXXXXX) |
|
80 |
CLEANUP+=("rm -f $floppy") |
|
81 |
|
|
82 |
snf_export_DEV=/dev/vda |
|
83 |
snf_export_TYPE=${IMG_FORMAT} |
|
84 |
snf_export_PASSWORD=${IMG_PASSWD} |
|
85 |
snf_export_HOSTNAME=${instance} |
|
86 |
if [ -n "$IMG_PERSONALITY" ]; then |
|
87 |
snf_export_PERSONALITY=${IMG_PERSONALITY} |
|
88 |
fi |
|
89 |
|
|
90 |
create_floppy $floppy |
|
91 |
|
|
92 |
# Invoke the helper vm to do the dirty job... |
|
93 |
result_file=$(mktemp --tmpdir result.XXXXXXXX) |
|
94 |
CLEANUP+=("rm -f $result_file") |
|
95 |
|
|
96 |
$TIMELIMIT -t $HELPER_SOFT_TIMEOUT -T $HELPER_HARD_TIMEOUT \ |
|
97 |
kvm -runas $HELPER_USR -drive file=${HELPER},snapshot=on \ |
|
98 |
-drive file=$root_dev,format=raw,if=virtio,cache=none \ |
|
99 |
-boot c -serial stdio -serial file:$result_file -fda $floppy \ |
|
100 |
-vga none -nographic -parallel none -monitor null -nographic \ |
|
101 |
-kernel ${HELPER_KERNEL} -initrd ${HELPER_INITRD} \ |
|
102 |
-append "quiet ro root=/dev/sda1 console=ttyS0,9600n8" \ |
|
103 |
2>&1 | sed 's|^|HELPER: |g' |
|
104 |
|
|
105 |
if [ $? -ne 0 ]; then |
|
106 |
if [ $? -gt 128 ]; then |
|
107 |
log_error "Helper was terminated. Did not finish on time." |
|
108 |
fi |
|
109 |
exit 1 |
|
110 |
fi |
|
111 |
|
|
112 |
# Read the first line. This will remove \r and \n chars |
|
113 |
result=$(sed 's|\r||g' $result_file | xargs echo) |
|
114 |
|
|
115 |
if [ "x$result" != "xSUCCESS" ]; then |
|
116 |
log_error "Helper VM returned error" |
|
117 |
exit 1 |
|
118 |
fi |
|
119 |
|
|
120 |
# Install a new MBR |
|
121 |
$INSTALL_MBR -p 1 -i n ${blockdev} |
|
122 |
|
|
123 |
# Execute cleanups |
|
124 |
cleanup |
|
125 |
trap - EXIT |
|
126 |
|
|
127 |
exit 0 |
|
128 |
|
|
129 |
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai : |
b/snf-image-host/defaults | ||
---|---|---|
1 |
# snf-image defaults file |
|
2 |
|
|
3 |
# IMAGE_NAME: Name of the image to use |
|
4 |
# Generally you use the name of the image with the version of the OS included. |
|
5 |
# Examples include: |
|
6 |
# centos-5.4 debian-4.0 fedora-12 |
|
7 |
# IMAGE_NAME="" |
|
8 |
|
|
9 |
# IMAGE_DIR: directory location for disk images |
|
10 |
# ( default is @localstatedir@/cache/ganeti-instance-image ) |
|
11 |
# IMAGE_DIR="" |
|
12 |
|
|
13 |
# ARCH: Define the ARCH of the image to use |
|
14 |
# Use either x86 or x86_64 |
|
15 |
# ARCH="x86_64" |
|
16 |
|
|
17 |
# IMAGE_DEBUG: turn on debugging output for the scripts |
|
18 |
# IMAGE_DEBUG=0 |
|
19 |
|
|
20 |
# HELPER: path to the image file of the helper vm |
|
21 |
# HELPER="var/lib/snf-image/helper.img" |
|
22 |
|
|
23 |
# HELPER_KERNEL: path to the kernel, kvm should use to run the helper image |
|
24 |
# HELPER_KERNEL="/var/lib/snf-image/helper-kernel" |
|
25 |
|
|
26 |
# HELPER_INITRD: path to the init ramdisk the helper vm should use. |
|
27 |
# HELPER_INITRD="/var/lib/snf-image/helper-initrd" |
|
28 |
|
|
29 |
# HELPER_TIMOUT: Soft and hard timeout limits for helper instance. |
|
30 |
# Helper instance will be terminated after a given time if it hasn't exited by |
|
31 |
# itself. The time to wait before killing the process is specified by those |
|
32 |
# variables. When soft/hard limit expires, a SIGTERM/SIGKILL is sent. |
|
33 |
# HELPER_SOFT_TIMEOUT="120" |
|
34 |
# HELPER_HARD_TIMEOUT="15" |
|
35 |
|
|
36 |
# HELPER_USR: For security reasons, the helper vm is not adviced to to run as |
|
37 |
# root. It should drop privileges just before the guest execution starts. The |
|
38 |
# user the helper vm should run as is specifies by HELPER_USR variable. |
|
39 |
# HELPER_USR="nobody" |
|
40 |
|
|
41 |
# Paths for needed programs. Uncommend and change the variables below, if you |
|
42 |
# don't want to use the default one. |
|
43 |
# LOSETUP="losetup" |
|
44 |
# KPARTX="kpartx" |
|
45 |
# SFDISK="sfdisk" |
|
46 |
# INSTALL_MBR="install-mbr" |
|
47 |
# TIMELIMIT="timelimit" |
|
48 |
# if [ "$windows_support" = "yes" ] ; then |
|
49 |
# PROGRESS_MONITOR="snf-progress-monitor" |
|
50 |
# fi |
b/snf-image-host/export | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
exit 0 |
b/snf-image-host/ganeti_api_version | ||
---|---|---|
1 |
20 |
|
2 |
15 |
|
3 |
10 |
|
4 |
5 |
b/snf-image-host/import | ||
---|---|---|
1 |
#!/bin/bash |
|
2 |
|
|
3 |
exit 0 |
Also available in: Unified diff