diff options
author | Simon Rettberg | 2016-10-21 17:27:16 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-10-21 17:27:16 +0200 |
commit | daa8b9fd8255d9033637c304241deba8d7f3bd58 (patch) | |
tree | ffec7fdfdb95c04f6b5e38c2767ba23996eb95a5 /remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc | |
parent | [nvidia_kernel] Actually build nvidia-drm.ko (diff) | |
download | tm-scripts-daa8b9fd8255d9033637c304241deba8d7f3bd58.tar.gz tm-scripts-daa8b9fd8255d9033637c304241deba8d7f3bd58.tar.xz tm-scripts-daa8b9fd8255d9033637c304241deba8d7f3bd58.zip |
[run-virt/...] More cleanup, refactoring, comments
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 | 34 |
1 files changed, 34 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..b1995d09 --- /dev/null +++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc @@ -0,0 +1,34 @@ +######################################################## +# 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" + +writelog "IMGUUID extracted: $IMGUUID" + +# 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 + |