Revision e9413eab
b/snf-image-helper/common.sh | ||
---|---|---|
420 | 420 |
return 0 |
421 | 421 |
} |
422 | 422 |
|
423 |
|
|
424 |
return_success() { |
|
425 |
|
|
426 |
case $hypervisor in |
|
427 |
kvm) |
|
428 |
echo "SUCCESS" > "$RESULT" |
|
429 |
;; |
|
430 |
xen-pvm|xen-kvm) |
|
431 |
domid=$(xenstore-read domid) |
|
432 |
xenstore-write /local/domain/0/helper/$domid SUCCESS |
|
433 |
;; |
|
434 |
esac |
|
435 |
|
|
436 |
} |
|
437 |
|
|
423 | 438 |
trap cleanup EXIT |
424 | 439 |
set -o pipefail |
425 | 440 |
|
b/snf-image-helper/snf-image-helper.in | ||
---|---|---|
97 | 97 |
# Disable the trap. If code reaches here, the filesystem is unmounted. |
98 | 98 |
trap - ERR |
99 | 99 |
|
100 |
echo "SUCCESS" > "$RESULT"
|
|
100 |
return_success
|
|
101 | 101 |
|
102 | 102 |
cleanup |
103 | 103 |
trap - EXIT |
b/snf-image-host/common.sh.in | ||
---|---|---|
388 | 388 |
: ${HELPER_USER:="nobody"} |
389 | 389 |
: ${HELPER_CACHE_FILE:="@HELPER_DIR@/cache.tar"} |
390 | 390 |
: ${HELPER_CACHE_PKGS:="@HELPER_DIR@/packages"} |
391 |
: ${HELPER_EXTRA_PKGS:="e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux"} |
|
391 |
: ${HELPER_EXTRA_PKGS:="xenstore-utils,e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux"}
|
|
392 | 392 |
: ${HELPER_LINUX_IMAGE_PKG:="linux-image-amd64"} |
393 | 393 |
: ${HELPER_LINUX_IMAGE_XEN_PKG:="linux-image-xen-amd64"} |
394 | 394 |
: ${HELPER_MIRROR:=""} |
b/snf-image-host/defaults | ||
---|---|---|
53 | 53 |
# HELPER_EXTRA_PKGS: Extra packages that will need to be supplied |
54 | 54 |
# to debootstrap to make the resulting helper image workable. |
55 | 55 |
# DO NOT OVERWRITE THIS UNLESS YOU KNOW WHAT YOU ARE DOING |
56 |
# HELPER_EXTRA_PKGS="e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux" |
|
56 |
# HELPER_EXTRA_PKGS="xenstore-utils,e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux"
|
|
57 | 57 |
# HELPER_LINUX_IMAGE_PKG="linux-image-amd64" |
58 | 58 |
# HELPER_LINUX_XEN_IMAGE_PKG="linux-image-xen-amd64" |
59 | 59 |
|
b/snf-image-host/snf-image-update-helper.in | ||
---|---|---|
289 | 289 |
;; |
290 | 290 |
esac |
291 | 291 |
done |
292 |
case \$hypervisor in |
|
293 |
xen-pvm|xen-kvm) mount -t xenfs xenfs /proc/xen ;; |
|
294 |
esac |
|
292 | 295 |
/usr/bin/snf-image-helper --force |
293 | 296 |
fi |
294 | 297 |
|
b/snf-image-host/xen-common.sh | ||
---|---|---|
9 | 9 |
} |
10 | 10 |
|
11 | 11 |
launch_helper() { |
12 |
|
|
13 |
helper_name=helper$$ |
|
14 |
xm create /dev/null \ |
|
15 |
kernel="$HELPER_KERNEL" ramdisk="$HELPER_INITRD" \ |
|
16 |
disk="file:$snapshot,xvda,w" \ |
|
17 |
disk="phy:$blockdev,xvdb,w" \ |
|
18 |
disk="file:$floppy,xvdc1,w" \ |
|
19 |
extra="console=hvc0 hypervisor=$HYPERVISOR snf_image_activate_helper" \ |
|
20 |
memory="256" root="/dev/xvda1 quiet ro boot=local" boot="c" vcpus=1 \ |
|
21 |
name="$helper_name" |
|
22 |
|
|
23 |
if ! xenstore-exists helper; |
|
24 |
xenstore-write helper "" |
|
25 |
fi |
|
26 |
helperid=$(xm domid $helper_name) |
|
27 |
xenstore-write helper/$helperid "" |
|
28 |
xenstore-chmod helper/$helperid r0 w$helperid |
|
29 |
|
|
12 | 30 |
tail -f --pid=$$ "$result_file" | sed -u 's|^|HELPER: |' & |
13 | 31 |
$TIMEOUT -k $HELPER_HARD_TIMEOUT $HELPER_SOFT_TIMEOUT \ |
14 |
screen -D -m -c /etc/screenrc bash -c 'xm create /dev/null \ |
|
15 |
kernel="'$HELPER_KERNEL'" ramdisk="'$HELPER_INITRD'" \ |
|
16 |
disk="file:'$snapshot',xvda,w" \ |
|
17 |
disk="phy:'$blockdev',xvdb,w" \ |
|
18 |
disk="file:'$floppy',xvdc1,w" \ |
|
19 |
extra="console=hvc0 hypervisor='$HYPERVISOR' snf_image_activate_helper" \ |
|
20 |
memory="256" root="/dev/xvda1 quiet ro boot=local" boot="c" vcpus=1 \ |
|
21 |
name="snf-image-helper" -c > '$result_file'' |
|
32 |
screen -D -m -c /etc/screenrc bash -c ' xm console '$helper_name' > '$result_file'' |
|
22 | 33 |
} |
23 | 34 |
|
24 | 35 |
get_helper_result() { |
25 | 36 |
|
26 |
result=$(sed 's|\r||g' "$result_file" | grep ^SUCCESS$)
|
|
37 |
result=$(xenstore-read helper/$helperid)
|
|
27 | 38 |
|
28 | 39 |
} |
Also available in: Unified diff