diff options
author | Simon Rettberg | 2024-05-08 18:45:20 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-05-08 18:45:20 +0200 |
commit | b57f124784e5bcf4b025a27e20392bafc1ac0546 (patch) | |
tree | 05ac2a718a265b9554b4441c8a57f9c041db49d3 /core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes | |
parent | [lightdm-greeter-bwlp/vmchooser2] Handle cow token (diff) | |
download | mltk-b57f124784e5bcf4b025a27e20392bafc1ac0546.tar.gz mltk-b57f124784e5bcf4b025a27e20392bafc1ac0546.tar.xz mltk-b57f124784e5bcf4b025a27e20392bafc1ac0546.zip |
[run-virt/vmchooser2] Initial support for CoW-sessions
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes')
3 files changed, 9 insertions, 6 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc index b18b8a66..c378cd5b 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc @@ -79,7 +79,7 @@ download_metadata_default() { writelog "No cow token found in edit mode" EXIT_TYPE=user EXIT_REASON="Admin-Modus aktiviert, aber kein cow-token vorgefunden." cleanexit 1 fi - argx="?cow-user=$cow_token" + argx="?cow-user=$cow_token&cow-type=$VMCHOOSER_ADMIN_TYPE" fi # Try new unified .tar.gz way @@ -102,6 +102,9 @@ download_metadata_default() { writelog "Downloading metadata.tgz failed (RET=$RET, HTTP=$ERRCODE). Cannot start VM. $( cat $WLOG )" # + if [ -s "$TMPFILE" ] && grep -q --binary-files=without-match -E '[a-z]'; then + EXTRA_ERROR="$( cat "$TMPFILE" )" + fi fi } diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc index 9be00cfa..9f18d0ec 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc @@ -58,7 +58,7 @@ setup_dnbd3_cow () { local dnbd3_diskfile= mkdir "${TMPDIR}/cow" - setup_dnbd3_common -L "${TMPDIR}/cow" -C "${SLX_VMCHOOSER_BASE_URL//"/vmchooser/"/"/cow/"}" --upload-uuid "$DMSD_COW_SESSION" --cow-stats-file --merge + setup_dnbd3_common -c "${TMPDIR}/cow" -C "${SLX_VMCHOOSER_BASE_URL//"/vmchooser/"/"/cow/"}" --upload-uuid "$DMSD_COW_SESSION" --cow-stats-file --merge if isempty dnbd3_diskfile; then slxlog "virt-dnbd3" "Failed to setup dnbd3-fuse with copy-on-write" "$dnbd3_tmplog" @@ -77,8 +77,8 @@ setup_dnbd3_common () { local TIMEOUT VM_DISKFILE_REVISION rm -f -- "${DNBD3_EXITFLAG}" ( - trap 'kill $dnbd3pid; exit' SIGTERM - trap 'kill -SIGQUIT $dnbd3pid' SIGQUIT + trap 'writelog "[dnbd3-fuse] Received TERM"; kill $dnbd3pid; exit' SIGTERM + trap 'writelog "[dnbd3-fuse] Received QUIT"; kill -SIGQUIT $dnbd3pid' SIGQUIT startup="$( date +%s )" while [ "$( date +%s )" -lt "$(( startup + 4 ))" ]; do dnbd3-fuse -f -o allow_other,max_readahead=262144 -h "${SLX_DNBD3_SERVERS}" -i "${SRC_IMG_RELATIVE}" "$@" "${DNBD3_MOUNT_POINT}" &> "${dnbd3_tmplog}" & diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc index 3bfa8bb5..80403356 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc @@ -151,7 +151,7 @@ cleanexit() { done fi - # kill potential remaining background jobs + writelog "Killing remaining background jobs" kill $(jobs -p) # If we're not in debug mode AND got a clean exit code, remove all temporary files @@ -276,7 +276,7 @@ safesource() { while [ $# -gt 0 ]; do # sanitze filename just to be sure as it is part of the eval coming later # alphanumeric and - _ . should be enough for common file naming scheme - if [[ ! "$1" =~ ^[a-zA-Z0-9./_-]+$ ]]; then + if [[ ! "$1" =~ ^[a-zA-Z0-9./_@-]+$ ]]; then writelog "'$1' is a weird filename to source! Ignoring." return 1 fi |