summaryrefslogtreecommitdiffstats
path: root/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes')
-rw-r--r--remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/check_runvirt_needed_files.inc53
-rw-r--r--remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc (renamed from remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/detect_legacy.inc)4
-rw-r--r--remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/get_xml_file_variables.inc131
-rw-r--r--remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc21
-rw-r--r--remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_variables.inc2
-rw-r--r--remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc81
-rw-r--r--remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc26
-rw-r--r--remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc19
8 files changed, 141 insertions, 196 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/check_runvirt_needed_files.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/check_runvirt_needed_files.inc
deleted file mode 100644
index fbb0bc70..00000000
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/check_runvirt_needed_files.inc
+++ /dev/null
@@ -1,53 +0,0 @@
-#################################################################
-# Include: Check for important files used by vmchooser_run-virt #
-#################################################################
-
-# WARNING: This is perhaps vestigial!
-
-filecheck() {
- filecheck=$(LANG=us ls -lh ${diskfile} 2>&1)
- writelog "Filecheck:\n${filecheck}\n"
- noimage=$(echo ${filecheck} | grep -i "no such file or directory" | wc -l)
- rightsfile=${diskfile}
-
- # check if link
- if [ -L "${diskfile}" ]; then
- # take link target
- rightsfile=$(ls -lh ${diskfile} 2>&1 | awk -F '-> *' '{print $2}')
- rightsfile=${vmdir}/${rightsfile}
- filecheck=$(LANG=us ls -lh ${rightsfile} 2>&1)
- fi
-
- # does file exist
- if [ "${noimage}" -ge "1" ]; then
- writelog "Virtual Machine Image Problem:\c "
- writelog "\tThe image you've specified doesn't exist."
- writelog "Filecheck says:\c "
- writelog "\t\t${diskfile}:\n\t\t\tNo such file or directory"
- writelog "Hint:\c "
- writelog "\t\t\tCompare spelling of the image with your options.\n"
- exit 1
- fi
- # readable by calling user
- if ! [ -r "${diskfile}" >/dev/null 2>&1 \
- -o -r "${diskfile}" >/dev/null 2>&1 ]; then
- writelog "Vmware Image Problem:\c "
- writelog "\tThe image you've specified has wrong rights."
- writelog "Filecheck says:\t\t$(echo ${filecheck} \
- | awk '{print $1" "$3" "$4}') ${rightsfile}"
- writelog "Hint:\t\t\tChange rights with: chmod a+r ${rightsfile}\n"
- exit 1
- fi
-
- # writable (for persistent-mode)?
- if ! [ -w "${diskfile}" >/dev/null 2>&1 \
- -o -w "${diskfile}" >/dev/null 2>&1 ] \
- && [ "${np}" = "independent-persistent" ]; then
- writelog "Vmware Image Problem:\c "
- writelog "\tThe image you have specified has wrong rights."
- writelog "Filecheck says:\t\t$(echo ${filecheck} \
- | awk '{print $1" "$3" "$4}') ${rightsfile}"
- writelog "Hint:\t\t\tUse nonpersistent-mode or change rights to rw\n"
- exit 1
- fi
-}
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/detect_legacy.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc
index 8bdfd8b1..b1995d09 100644
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/detect_legacy.inc
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/download_vm_metadata.inc
@@ -7,8 +7,6 @@
writelog "Detecting current/legacy mode ..."
-# First, let's try to extract an imguuid from xmlfile:
-declare -rg IMGUUID=$(grep -i -o '<uuid param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
declare -rg TMPCONFIG="$TMPDIR/vmconfig.tmp"
writelog "IMGUUID extracted: $IMGUUID"
@@ -32,3 +30,5 @@ else
fi
fi
+readonly LEGACY
+
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/get_xml_file_variables.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/get_xml_file_variables.inc
index b7ed648c..eb699ec0 100644
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/get_xml_file_variables.inc
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/get_xml_file_variables.inc
@@ -1,103 +1,62 @@
-###########################################
-# Include: Set hardware related variables #
-###########################################
+############################################
+# Include: Get needed values from XML file #
+############################################
-writelog "Starting configuration..."
-writelog "\tLogfile:\t\t${LOGFILE}"
-writelog "\t/tmp info:\t\t$(df -h | grep " /tmp$" | awk '{print $2}') \c"
-writelog "$(grep "/tmp " /proc/mounts | awk '{print $1" "$2" "$3" "$4}')"
-writelog "\tVM XML dir:\t\t$(dirname "${xmlfile}")"
-writelog "\tXML file:\t\t${xmlfile}"
-writelog "Enable 3D:\t\t${enable3d}"
-writelog "VM config:"
+writelog "Parsing XML..."
+
+declare -rg VMSTORE_PATH=/mnt/vmstore
+
+# Need some lean and mean xml parser some day in the far future
+get_xml () {
+ grep -Pio "<$1"'\s+param=[^"]*".*' "${xmlfile}" \
+ | awk -F '"' '{ print $2 }' \
+ | sed 's/&amp;/+/g;s/&quot;/"/g;s/&lt;/</g;s/&gt;/>/g'
+}
# # Name of the virt image
-imgname=$(grep -io '<image_path param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
-imgrelpath=$(grep -io '<image_name param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
-# [ -z "$imgname" ] && imgname="${imgrelpath}"
-imgrelpath=${imgrelpath#/mnt/vmstore/}
+SRC_IMG_ABSOLUTE=$(get_xml "image_path")
+SRC_IMG_RELATIVE=$(get_xml "image_name")
-writelog "Virtual image file name: $imgname"
+if [ -z "${SRC_IMG_ABSOLUTE}${SRC_IMG_RELATIVE}" ]; then
+ writelog "Neither relative nor absolute path for image found in xml"
+ cleanexit 1
+fi
-# Imagename w/ full path
-if echo "${imgname}" | grep -q '^/'; then
- imgpath="$(dirname "${imgname}")"
- imgname="$(basename "${imgname}")"
- vmpath="${imgpath}/${imgname}"
- # If old vmchooser binary stuff
- # We do not need folder name as it is already included by vmchooser
-elif echo "${xmlfile}" | grep -q '^/tmp/'; then
- vmpath="$imgname"
- imgname="$(basename "${imgname}")"
- ## Added for persistent support.
-else
- # Else use same path as xml
- imgpath="${xmlpath}"
- vmpath="${imgpath}/${imgname}"
+if [ -n "$SRC_IMG_ABSOLUTE" ] && [ "${SRC_IMG_ABSOLUTE:0:1}" != "/" ]; then
+ writelog "Error parsing XML for absolute image path: given value doesn't start with '/': '$SRC_IMG_ABSOLUTE'"
+ cleanexit 1
fi
-# If ${vm_name} not defined use ${xmlfile}
-vm_name="${vm_name:-${xmlfile%.xml}}"
+if [ -z "$SRC_IMG_ABSOLUTE" ]; then
+ SRC_IMG_ABSOLUTE="${VMSTORE_PATH}/${SRC_IMG_RELATIVE}"
+fi
-# Define vm_shortname since vm_name can be very long
-vm_shortname="$(basename "${xmlfile%.xml}" | sed -e "s, ,-,g")"
+IMG_BASENAME=$(basename "$SRC_IMG_ABSOLUTE")
+writelog "Virtual image file name: $IMG_BASENAME"
-# vm_name = displayname, define for old scripts
-displayname="${vm_name}"
+VM_DISPLAYNAME=$(get_xml "short_description")
+[ -z "$VM_DISPLAYNAME" ] && VM_DISPLAYNAME="${IMG_BASENAME}"
+
+# Define VM_NAME_CLEAN since VM_DISPLAYNAME can be long and contain weird characters
+VM_NAME_CLEAN=$(echo "${VM_DISPLAYNAME:0:32}" | sed -r 's/[^0-9a-zA-Z_-\.]+/_/g')
# image is for the following virtual machine
-xmlvirt=$(grep -o 'virtualmachine param=.*"' "${xmlfile}" \
+PLUGIN_ID=$(grep -o 'virtualmachine param=.*"' "${xmlfile}" \
| sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
-# choose the proper virtualization/emulator plugin
-[ "x${xmlvirt}" != "x" -a "x${xmlvirt}" != "xqemukvm" -a "x${xmlvirt}" != "xvirtualbox" -a "x${xmlvirt}" != "xvmware" ] && xmlvirt="emufe"
-
-# Extracting OS type (vmostype) from xml file. We don't care here whether vmostype is empty, as then
+# Extracting OS type (VM_OS_TYPE) from xml file. We don't care here whether VM_OS_TYPE is empty, as then
# it will yield the default entries later on.
-vmostype=$(grep -io '<os param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+VM_OS_TYPE=$(get_xml "os")
-# make a guess from the filename extension if ${xmlvirt} is empty
-# (not set within the XML file)
-# TODO: implement possibility to submit own configuration files
-if [ -z "${xmlvirt}" ] && [ -n "${additional_config}" ]; then
- writelog "No virtual machine parameter defined in ${xmlfile}"
- writelog "Trying to guess VM...\c"
- case "$(cat ${additional_config} | tr \"[A-Z]\" \"[a-z]\")" in
- *config.version*|*virtualhw.version*|*independent-nonpersistent*|*vmdk*)
- xmlvirt="vmware"
- ;;
- *innotek*|*virtualbox*)
- xmlvirt="virtualbox"
- ;;
- *qemu*|*kvm*)
- xmlvirt="qemukvm"
- ;;
- *)
- xmlvirt="none"
- ;;
- esac
- elif [ -z "${xmlvirt}" ]; then
- case "$(echo ${imgname##*.} | tr \"[A-Z]\" \"[a-z]\")" in
- vmdk)
- xmlvirt="vmware"
- ;;
- vbox|vdi)
- xmlvirt="virtualbox"
- ;;
- qcow*)
- xmlvirt="qemukvm"
- ;;
- *)
- xmlvirt="emufe"
- ;;
- esac
- writelog "result:\t${xmlvirt}"
-fi
+readonly SRC_IMG_ABSOLUTE SRC_IMG_RELATIVE
+readonly IMG_BASENAME
+readonly VM_DISPLAYNAME VM_NAME_CLEAN
+readonly PLUGIN_ID
+readonly VM_OS_TYPE
-# Set redirects to 0, see vmgrid if you want to define some
-redirects=0
+writelog "Virtualization plugin: $PLUGIN_ID"
+writelog "VM name: $VM_DISPLAYNAME"
+writelog "VM short name: $VM_NAME_CLEAN"
+writelog "VM OS: $VM_OS_TYPE"
+writelog "Done parsing XML."
-writelog "\tVirtualization:\t\t$xmlvirt"
-writelog "\tVM name:\t\t$vm_name"
-writelog "\tVM short name:\t\t$vm_shortname"
-writelog "\tVM OS:\t\t$vmostype"
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc
index 9a46bc88..7ef03c1c 100644
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc
@@ -19,6 +19,7 @@ get_vm_id() {
fi
# fallback: take last two digits of current pid...
VM_ID=$(expr substr $$ $(expr ${#$} - 1) 2)
+ [ "${#VM_ID}" -eq 1 ] && VM_ID="0${VM_ID}"
}
get_vm_id
@@ -38,18 +39,18 @@ else
fi
# Calculate absulute amount of RAM that should stay available to the host
-reserve="$[ ( $totalmem * $reserve ) / 100 ]"
+reserve="$(( ( totalmem * reserve ) / 100 ))"
# Respect some upper and lower bounds for the host amount
[ "$reserve" -lt "$min" ] && reserve="$min"
[ "$reserve" -gt "$max" ] && reserve="$max"
# Get a result which can be divided by 4
-mem="$[ ( ( $totalmem - $reserve ) / 4 ) * 4 ]"
+mem="$(( ( ( totalmem - reserve ) / 4 ) * 4 ))"
if [ -n "$mainvirtmem" ]; then
- forcemem="$[ "$mainvirtmem" / 4 * 4 ]"
+ forcemem="$(( mainvirtmem / 4 * 4 ))"
mem="$forcemem"
fi
-hostmem="$[ $totalmem - $mem ]"
+hostmem="$(( totalmem - mem ))"
# Fill in VMID
macaddrsuffix=$(echo "$macaddrsuffix" | sed "s/%VMID%/${VM_ID}/")
@@ -75,17 +76,9 @@ cdrom0=${cdtest:-"FALSE"}
cdtest=${cdrom_1:+"TRUE"}
# if $cdtest not set cdrom1="FALSE", else "TRUE"
cdrom1=${cdtest:-"FALSE"}
-# IDE is expected default, test for the virtual disk image type should
-# be done while creating the runscripts ...
-# TODO enable SCSI support instead of just disabling it.
-ide="TRUE"
-scsi="FALSE"
-hddrv="ide"
-audio="true"
-remotedesktopport="590${VM_ID}"
-# Enable 3D
-enable3d=$(grep -i -o "<enable3d param=.*" "${xmlfile}" | awk -F '"' '{print $2}' | rv_clean_string)
+# RDP/VNC port (59001 - 59099)
+remotedesktopport="590${VM_ID}"
# Add rw share for home dir
homesharepath="${HOME}/PERSISTENT"
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_variables.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_variables.inc
index 4c4ccf1d..cd9a573a 100644
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_variables.inc
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_variables.inc
@@ -4,8 +4,8 @@
VMCHOOSER_DIR="/opt/openslx/vmchooser"
VMCHOOSER_CONF_DIR="$VMCHOOSER_DIR/config"
-LOGFILE="/var/log/openslx/run-virt.${USER}.$$.log"
USER="$(whoami)"
+LOGFILE="/var/log/openslx/run-virt.${USER}.$$.log"
TMPDIR="/tmp/virt/${USER}/$$"
readonly VMCHOOSER_DIR VMCHOOSER_CONF_DIR LOGFILE TMPDIR USER
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc
index 3c4ed330..4eb66028 100644
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_image_access.inc
@@ -2,32 +2,40 @@
# Include: Setup dnbd for image access, nfs/cifs fallback #
###########################################################
-writelog "Now in setup_image_access.inc ..."
+# This will currently make sure that the variable
+# VM_DISKFILE_RO is set which will contain the
+# absolute path to the disk image to use for the vm
+# session.
+# When using DNBD3 this will differ from SRC_IMG_ABSOLUTE,
+# otherwise it will be identical.
+# In the future DNBD3 (or something else) might provide
+# a CoW layer so we don't need snapshots etc. anymore.
+# This include should set VM_DISKFILE_RW in that case to
+# indicate to the virt plugin that it doesn't need to
+# handle creating a temporary CoW layer itself.
+
+writelog "Setting up disk access for virtualizer/emulator ..."
# Try to use dnbd3 to access the image
-unset vm_diskfile
-unset vm_revision
+unset VM_DISKFILE_RO
unset dnbd3_fuse_mount_point
-unset dnbd3_tmplog
-if ! which dnbd3-fuse; then
- writelog "Can't use dnbd3 as dnbd3-fuse binary is not in PATH"
-elif [ -z "$SLX_DNBD3_SERVERS" ] || [ "x$SLX_VM_DNBD3" != "xyes" ]; then
- writelog "Can't use dnbd3 as no servers are given in config, or SLX_VM_DNBD3 is not set to yes"
-else
+
+setup_dnbd3 () {
# Mount path for images mounted with dnbd3-fuse
dnbd3_fuse_mount_point="$TMPDIR/dnbd3fuse.mnt"
mkdir -p "${dnbd3_fuse_mount_point}"
# start dnbd3-fuse in subshell
- dnbd3_tmplog="$TMPDIR/dnbd3fuse.log"
- dnbd3_exitflag="$TMPDIR/dnbd3exit$RANDOM"
+ local dnbd3_tmplog="$TMPDIR/dnbd3fuse.log"
+ local dnbd3_exitflag="$TMPDIR/dnbd3exit$RANDOM"
+ local TIMEOUT vm_revision
rm -f -- "$dnbd3_exitflag"
(
- dnbd3-fuse -f -o allow_other,max_readahead=262144 -h "$SLX_DNBD3_SERVERS" -i "${imgrelpath}" "${dnbd3_fuse_mount_point}" > "$dnbd3_tmplog" 2>&1
+ dnbd3-fuse -f -o allow_other,max_readahead=262144 -h "$SLX_DNBD3_SERVERS" -i "${SRC_IMG_RELATIVE}" "${dnbd3_fuse_mount_point}" > "$dnbd3_tmplog" 2>&1
RET=$?
touch "$dnbd3_exitflag"
if [ "$RET" != "0" ]; then
writelog "dnbd3-fuse stopped working (Exit code $RET)"
- slxlog "virt-dnbd3-fuse" "dnbd3-fuse stopped/refused serving '${imgrelpath}' from '${SLX_DNBD3_SERVERS}' with error code: $RET" "${dnbd3_tmplog}"
+ slxlog "virt-dnbd3-fuse" "dnbd3-fuse stopped/refused serving '${SRC_IMG_RELATIVE}' from '${SLX_DNBD3_SERVERS}' with error code: $RET" "${dnbd3_tmplog}"
fi
) &
# give it a bit of time
@@ -36,36 +44,55 @@ else
for TIMEOUT in 0.5 1 1 OUT; do
if [ -r "${dnbd3_fuse_mount_point}/img" ]; then
vm_revision="$(grep -m 1 "^Revision:" "${dnbd3_fuse_mount_point}/status" | cut -d" " -f2)"
- vm_diskfile="${dnbd3_fuse_mount_point}/img"
- writelog "DNBD3: $imgrelpath on $vm_diskfile with rid $vm_revision"
- vmpath="$vm_diskfile"
+ VM_DISKFILE_RO="${dnbd3_fuse_mount_point}/img"
+ writelog "DNBD3: $SRC_IMG_RELATIVE on $VM_DISKFILE_RO with rid $vm_revision"
break
fi
[ "$TIMEOUT" = "OUT" -o -e "$dnbd3_exitflag" ] && break
sleep "$TIMEOUT"
done
- if [ -z "$vm_diskfile" ]; then
- slxlog "virt-dnbd3" "No dnbd3 server for ${imgrelpath} found, trying NFS/CIFS..." "$dnbd3_tmplog"
+ if [ -z "$VM_DISKFILE_RO" ]; then
+ slxlog "virt-dnbd3" "No dnbd3 server for ${SRC_IMG_RELATIVE} found, trying NFS/CIFS..." "$dnbd3_tmplog"
writelog "No working dnbd3 server found :-("
fi
+}
+
+# See if we should setup dnbd3 image access at all
+if ! which dnbd3-fuse; then
+ writelog "Can't use dnbd3 as dnbd3-fuse binary is not in PATH"
+elif [ -z "$SRC_IMG_RELATIVE" ]; then
+ writelog "Can't use dnbd3 as SRC_IMG_RELATIVE is not set"
+elif [ -z "$SLX_DNBD3_SERVERS" ] || [ "x$SLX_VM_DNBD3" != "xyes" ]; then
+ writelog "Can't use dnbd3 as no servers are given in config, or SLX_VM_DNBD3 is not set to yes"
+else
+ setup_dnbd3
fi
-# $vm_diskfile will be empty if dnbd3 is not used or failed. Let's try to fall back to NFS/CIFS via file system
-if [ -z "$vm_diskfile" ]; then
- new_vmpath=$(ls "${vmpath}.r"* | grep -E -o '\.r[0-9]+$' | grep -o -E '[0-9]+' | sort -n | tail -n 1)
- [ -n "$new_vmpath" ] && vmpath="${vmpath}.r${new_vmpath}"
- vm_diskfile="$vmpath"
+# VM_DISKFILE_RO will be empty if dnbd3 is not used or failed to connect.
+# Let's try to fall back to NFS/CIFS via file system
+if [ -z "$VM_DISKFILE_RO" ]; then
+ # Maybe we're reading a dnbd3 directory with RIDs encoded into the filename - use latest one
+ rid_suffix=$(ls -1 "${SRC_IMG_ABSOLUTE}.r"* | grep -E -o '\.r[0-9]+$' | grep -o -E '[0-9]+$' | sort -n | tail -n 1)
+ if [ -n "$rid_suffix" ]; then
+ # found
+ VM_DISKFILE_RO="${SRC_IMAGE_ABSOLUTE}.r${rid_suffix}"
+ elif [ -e "$SRC_IMAGE_ABSOLUTE" ]; then
+ # try name we got from xml in the first place
+ VM_DISKFILE_RO="$SRC_IMAGE_ABSOLUTE"
+ fi
fi
# Check if virtual machine container file exists
-if ! [ -e "${vmpath}" ]; then
- slxlog "virt-image-missing" "VM image $vmpath not found!"
- writelog "Virtual machine image ${vmpath} not found!"
+if [ -z "$VM_DISKFILE_RO" ] || ! [ -e "${VM_DISKFILE_RO}" ]; then
+ slxlog "virt-image-missing" "VM image $VM_DISKFILE_RO not found!"
+ writelog "Virtual machine image ${VM_DISKFILE_RO} not found!"
error_user "Das Image für die gewählte Virtuelle Maschine konnte nicht gefunden werden.
Versuchen Sie zunächst, den Computer komplett neu zu starten. Sollte das Problem bestehen bleiben, wenden Sie sich bitte an den Support."
cleanexit 1
fi
-writelog "Virtual machine disk file: $vm_diskfile"
+readonly VM_DISKFILE_RO
+
+writelog "Disk file to use: $VM_DISKFILE_RO"
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc
index ce15524f..7709a85d 100644
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/setup_vm_hypervisor.inc
@@ -3,30 +3,30 @@
##########################################################################
# Get all virtual machine specific stuff from the respective include file
-if [ ! -e "$VMCHOOSER_DIR/$xmlvirt/run-virt.include" ] ; then
- slxlog "virt-plugin-missing" "Could not find run-virt.include for $xmlvirt ($VMCHOOSER_DIR/$xmlvirt/run-virt.include)"
- writelog "Failed because of missing ${xmlvirt} plugin."
- error_user "Konnte den Virtualisierer '$xmlvirt' nicht finden. Starten der Virtuellen Maschine fehlgeschlagen.
+if [ ! -e "$VMCHOOSER_DIR/$PLUGIN_ID/run-virt.include" ] ; then
+ slxlog "virt-plugin-missing" "Could not find run-virt.include for $PLUGIN_ID ($VMCHOOSER_DIR/$PLUGIN_ID/run-virt.include)"
+ writelog "Failed because of missing ${PLUGIN_ID} plugin."
+ error_user "Konnte den Virtualisierer '$PLUGIN_ID' nicht finden. Starten der Virtuellen Maschine fehlgeschlagen.
Starten Sie den Computer neu und wenden Sie sich an den Support, wenn das Problem weiterhin besteht."
cleanexit 1
fi
-self="${xmlvirt}"
+self="${PLUGIN_ID}"
-if ! bash -n "$VMCHOOSER_DIR/$xmlvirt/run-virt.include"; then
- slxlog "virt-plugin-syntax" "run-virt.include for $xmlvirt contains syntax errors (bash -n run-virt.include failed)"
- writelog "Erroneous run-virt.include for $xmlvirt (syntax check)"
- error_user "Das Start-Script für den Virtualisierer '$xmlvirt' ist fehlerhaft.
+if ! bash -n "$VMCHOOSER_DIR/$PLUGIN_ID/run-virt.include"; then
+ slxlog "virt-plugin-syntax" "run-virt.include for $PLUGIN_ID contains syntax errors (bash -n run-virt.include failed)"
+ writelog "Erroneous run-virt.include for $PLUGIN_ID (syntax check)"
+ error_user "Das Start-Script für den Virtualisierer '$PLUGIN_ID' ist fehlerhaft.
Starten Sie den Computer neu und wenden Sie sich an den Support, wenn das Problem weiterhin besteht."
cleanexit 1
fi
setup_vm_commandline () {
# Now including the hypervisor specific include file:
- if ! source "$VMCHOOSER_DIR/$xmlvirt/run-virt.include"; then
- slxlog "virt-plugin-error" "run-virt.include for $xmlvirt could not be sourced properly."
- writelog "Erroneous run-virt.include for ${xmlvirt}? Source returned != 0"
- error_user "Das Start-Script für den Virtualisierer '$xmlvirt' hat einen fehlercode zurückgegeben.
+ if ! source "$VMCHOOSER_DIR/$PLUGIN_ID/run-virt.include"; then
+ slxlog "virt-plugin-error" "run-virt.include for $PLUGIN_ID could not be sourced properly."
+ writelog "Erroneous run-virt.include for ${PLUGIN_ID}? Source returned != 0"
+ error_user "Das Start-Script für den Virtualisierer '$PLUGIN_ID' hat einen fehlercode zurückgegeben.
Starten Sie den Computer neu, falls es beim Ausführen der VM zu Problemen kommt
und wenden Sie sich an den Support, wenn das Problem weiterhin besteht."
fi
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
index c0d17dbe..7519a48d 100644
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
@@ -77,3 +77,22 @@ rv_clean_string() {
tr '[A-Z]' '[a-z]' | tr -d -c '[a-z0-9\-]'
fi
}
+
+# Check if the given variables are set (empty or not)
+isset() {
+ while [ $# -gt 0 ]; do
+ [ -z "${!1+x}" ] && return 1
+ shift
+ done
+ return 0
+}
+
+# Check if the given variables are not empty
+notempty() {
+ while [ $# -gt 0 ]; do
+ [ -z "${!1}" ] && return 1
+ shift
+ done
+ return 0
+}
+