Commit e9413eab authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis
Browse files

Make use of XenStore to export SUCCESS msg


Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent 72052003
......@@ -420,6 +420,21 @@ check_if_excluded() {
return 0
}
return_success() {
case $hypervisor in
kvm)
echo "SUCCESS" > "$RESULT"
;;
xen-pvm|xen-kvm)
domid=$(xenstore-read domid)
xenstore-write /local/domain/0/helper/$domid SUCCESS
;;
esac
}
trap cleanup EXIT
set -o pipefail
......
......@@ -97,7 +97,7 @@ fi
# Disable the trap. If code reaches here, the filesystem is unmounted.
trap - ERR
echo "SUCCESS" > "$RESULT"
return_success
cleanup
trap - EXIT
......
......@@ -388,7 +388,7 @@ fi
: ${HELPER_USER:="nobody"}
: ${HELPER_CACHE_FILE:="@HELPER_DIR@/cache.tar"}
: ${HELPER_CACHE_PKGS:="@HELPER_DIR@/packages"}
: ${HELPER_EXTRA_PKGS:="e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux"}
: ${HELPER_EXTRA_PKGS:="xenstore-utils,e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux"}
: ${HELPER_LINUX_IMAGE_PKG:="linux-image-amd64"}
: ${HELPER_LINUX_IMAGE_XEN_PKG:="linux-image-xen-amd64"}
: ${HELPER_MIRROR:=""}
......
......@@ -53,7 +53,7 @@
# HELPER_EXTRA_PKGS: Extra packages that will need to be supplied
# to debootstrap to make the resulting helper image workable.
# DO NOT OVERWRITE THIS UNLESS YOU KNOW WHAT YOU ARE DOING
# HELPER_EXTRA_PKGS="e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux"
# HELPER_EXTRA_PKGS="xenstore-utils,e2fsprogs,ntfs-3g,ntfsprogs,xmlstarlet,python,parted,reglookup,chntpw,util-linux"
# HELPER_LINUX_IMAGE_PKG="linux-image-amd64"
# HELPER_LINUX_XEN_IMAGE_PKG="linux-image-xen-amd64"
......
......@@ -289,6 +289,9 @@ else
;;
esac
done
case \$hypervisor in
xen-pvm|xen-kvm) mount -t xenfs xenfs /proc/xen ;;
esac
/usr/bin/snf-image-helper --force
fi
......
......@@ -9,20 +9,31 @@ mk_snapshot() {
}
launch_helper() {
helper_name=helper$$
xm create /dev/null \
kernel="$HELPER_KERNEL" ramdisk="$HELPER_INITRD" \
disk="file:$snapshot,xvda,w" \
disk="phy:$blockdev,xvdb,w" \
disk="file:$floppy,xvdc1,w" \
extra="console=hvc0 hypervisor=$HYPERVISOR snf_image_activate_helper" \
memory="256" root="/dev/xvda1 quiet ro boot=local" boot="c" vcpus=1 \
name="$helper_name"
if ! xenstore-exists helper;
xenstore-write helper ""
fi
helperid=$(xm domid $helper_name)
xenstore-write helper/$helperid ""
xenstore-chmod helper/$helperid r0 w$helperid
tail -f --pid=$$ "$result_file" | sed -u 's|^|HELPER: |' &
$TIMEOUT -k $HELPER_HARD_TIMEOUT $HELPER_SOFT_TIMEOUT \
screen -D -m -c /etc/screenrc bash -c 'xm create /dev/null \
kernel="'$HELPER_KERNEL'" ramdisk="'$HELPER_INITRD'" \
disk="file:'$snapshot',xvda,w" \
disk="phy:'$blockdev',xvdb,w" \
disk="file:'$floppy',xvdc1,w" \
extra="console=hvc0 hypervisor='$HYPERVISOR' snf_image_activate_helper" \
memory="256" root="/dev/xvda1 quiet ro boot=local" boot="c" vcpus=1 \
name="snf-image-helper" -c > '$result_file''
screen -D -m -c /etc/screenrc bash -c ' xm console '$helper_name' > '$result_file''
}
get_helper_result() {
result=$(sed 's|\r||g' "$result_file" | grep ^SUCCESS$)
result=$(xenstore-read helper/$helperid)
}
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