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
e9413eab
Commit
e9413eab
authored
Sep 28, 2012
by
Dimitris Aragiorgis
Browse files
Make use of XenStore to export SUCCESS msg
Signed-off-by:
Dimitris Aragiorgis
<
dimara@grnet.gr
>
parent
72052003
Changes
6
Hide whitespace changes
Inline
Side-by-side
snf-image-helper/common.sh
View file @
e9413eab
...
...
@@ -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
...
...
snf-image-helper/snf-image-helper.in
View file @
e9413eab
...
...
@@ -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
...
...
snf-image-host/common.sh.in
View file @
e9413eab
...
...
@@ -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:=""}
...
...
snf-image-host/defaults
View file @
e9413eab
...
...
@@ -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"
...
...
snf-image-host/snf-image-update-helper.in
View file @
e9413eab
...
...
@@ -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
...
...
snf-image-host/xen-common.sh
View file @
e9413eab
...
...
@@ -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
)
}
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