diff options
author | Christian Rößler | 2016-11-04 15:59:25 +0100 |
---|---|---|
committer | Christian Rößler | 2016-11-04 15:59:25 +0100 |
commit | 13a665d7317615b472a66ce08fe6c0d126cdea39 (patch) | |
tree | d5fd4b5f9879f97b5032fc99951d6d3aafc7e7df /remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc | |
parent | [run-virt] resolution scripts now detect first connected output device (not o... (diff) | |
parent | [rfs-stage32] Run update-issue after setup_partitions for proper /tmp display (diff) | |
download | tm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.tar.gz tm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.tar.xz tm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.zip |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc')
-rw-r--r-- | remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc new file mode 100644 index 00000000..974a5626 --- /dev/null +++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc @@ -0,0 +1,32 @@ +######################################################## +# Include: Detect, whether runvirt runs in legacy mode # +######################################################## + +# Legacy mode: As runvirt has been before. +# New mode: uuid in xml _and_ vmx given via http. + +writelog "Detecting current/legacy mode ..." + +declare -rg TMPCONFIG="$TMPDIR/vmconfig.tmp" + +# Assume legacy mode by default, only trigger "current" mode if everything else below worked +LEGACY=yes +if [ -z "$IMGUUID" ]; then # Keine uuid: Abbruch, Legacy + writelog "Could not extract a uuid param from ${xmlfile}. Triggering legacy mode." +else + # Now getting template file: + if ! wget -T 6 -O "$TMPCONFIG" "${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID}" 2>/dev/null >&2; then + writelog "wget ${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID}. Triggering legacy mode." + else + writelog "wget ${SLX_VMCHOOSER_BASE_URL}/lecture/${IMGUUID} successful." + if [ ! -s "$TMPCONFIG" ]; then + writelog "Server sent zero byte virtual machine description file. Triggering legacy mode." + else + writelog "Triggering current (non-legacy) mode." + LEGACY= # everything worked - clear legacy mode variable (so we use the "current" mode) + fi + fi +fi + +readonly LEGACY + |