summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-10 16:52:07 +0200
committerSimon Rettberg2019-07-10 16:52:07 +0200
commitf6f7848eaa5bdd69e03608fc2b9898eab3ce599b (patch)
tree21035ac8d7cb31873f9e8c61b2c5f7be79b1db8f /core
parent[mltk] minor formatting (diff)
downloadmltk-f6f7848eaa5bdd69e03608fc2b9898eab3ce599b.tar.gz
mltk-f6f7848eaa5bdd69e03608fc2b9898eab3ce599b.tar.xz
mltk-f6f7848eaa5bdd69e03608fc2b9898eab3ce599b.zip
[run-virt/*] Make VIRTCMDOPTS an array for space safeness
Diffstat (limited to 'core')
-rw-r--r--core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/determine_hardware_limitations.inc37
-rw-r--r--core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/finalize_start_command.inc24
-rw-r--r--core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/init_core.inc8
-rw-r--r--core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_network.inc26
-rw-r--r--core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc7
-rwxr-xr-xcore/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt7
-rwxr-xr-xcore/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include8
-rw-r--r--core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc4
-rw-r--r--core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include3
9 files changed, 61 insertions, 63 deletions
diff --git a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/determine_hardware_limitations.inc b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/determine_hardware_limitations.inc
index becb2a80..890f956e 100644
--- a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/determine_hardware_limitations.inc
+++ b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/determine_hardware_limitations.inc
@@ -18,67 +18,62 @@ set_vm_hw_limits() {
# FIXME depending on the guest OS for now
# (sadly does not support all the exotic OSs the
# the world has even seen like vmware plugin :<)
- declare -g VIRTCMD=
+ local bits=64
case "${VM_OS_TYPE}" in
beos*)
- VIRTCMD="qemu-system-i386"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=tcg"
+ bits=32
SOUND_DEV="sb16"
;;
win3*|win*3*|Win*3*)
- VIRTCMD="qemu-system-i386"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=tcg"
+ bits=32
SOUND_DEV="sb16"
MAXMEM=32
;;
win95*|Win*95)
- VIRTCMD="qemu-system-i386"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=tcg"
+ bits=32
MAXMEM=96
;;
win98)
- VIRTCMD="qemu-system-i386"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=tcg"
+ bits=32
MAXMEM=256
;;
winme*|windowsme*)
- VIRTCMD="qemu-system-i386"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=tcg"
+ bits=32
SOUND_DEV="ac97"
MAXMEM=384
;;
winxp*64|windowsxp*64)
- VIRTCMD="qemu-system-x86_64"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=kvm"
SOUND_DEV="ac97"
;;
windows7|windows8|windows9)
- VIRTCMD="qemu-system-x86_64"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=kvm"
SOUND_DEV="ac97"
MAXMEM="8000"
MAXCORES="4"
;;
windows7-64|windows8-64|windows9-64)
- VIRTCMD="qemu-system-x86_64"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=kvm"
SOUND_DEV="ac97"
MAXMEM="32000"
MAXCORES="8"
;;
*64)
- VIRTCMD="qemu-system-x86_64"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=kvm"
MAXMEM="16000"
MAXCORES="4"
;;
*)
- VIRTCMD="qemu-system-i386"
- VIRTCMDOPTS="${VIRTCMDOPTS} -machine accel=kvm"
+ bits=32
MAXMEM="8000"
MAXCORES="1"
;;
esac
+ declare -g VIRTCMD
+ if [ "$bits" = 32 ]; then
+ declare -rg VIRTCMD="qemu-system-i386"
+ VIRTCMDOPTS+=( "-machine" "accel=tcg" ) # TODO: 32bit VMs can't use kvm!?
+ else # 64 bit
+ declare -rg VIRTCMD="qemu-system-x86_64"
+ VIRTCMDOPTS+=( "-machine" "accel=kvm" )
+ fi
+
# check for allocated cores
declare -rg HOST_CORE_COUNT="${CPU_CORES}"
diff --git a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/finalize_start_command.inc b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/finalize_start_command.inc
index a458f255..6d9df363 100644
--- a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/finalize_start_command.inc
+++ b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/finalize_start_command.inc
@@ -21,27 +21,27 @@
finalize_start_command() {
# set cpu type
- VIRTCMDOPTS="${VIRTCMDOPTS} -cpu host"
+ VIRTCMDOPTS+=( "-cpu" "host" )
# set cpu cores
- VIRTCMDOPTS="${VIRTCMDOPTS} -smp ${CPU_CORES}"
+ VIRTCMDOPTS+=( "-smp" "${CPU_CORES}" )
# set RAM
- VIRTCMDOPTS="${VIRTCMDOPTS} -m ${VM_MEM}"
-
+ VIRTCMDOPTS+=( "-m" "${VM_MEM}" )
+
# special feature for real and virtual floppy disks
- isset FLOPPY_0 && VIRTCMDOPTS="${VIRTCMDOPTS} -fda ${FLOPPY_0}"
- isset SLX_FLOPPY_IMG && VIRTCMDOPTS="${VIRTCMDOPTS} -fdb ${SLX_FLOPPY_IMG}"
-
+ isset FLOPPY_0 && VIRTCMDOPTS+=( "-fda" "${FLOPPY_0}" )
+ isset SLX_FLOPPY_IMG && VIRTCMDOPTS+=( "-fdb" "${SLX_FLOPPY_IMG}" )
+
# add optical drive if available
- isset CDROM_0 && VIRTCMDOPTS="${VIRTCMDOPTS} -cdrom ${CDROM_0}"
-
+ isset CDROM_0 && VIRTCMDOPTS+=( "-cdrom" "${CDROM_0}" )
+
# audio
- isset SOUND_DEV && VIRTCMDOPTS="${VIRTCMDOPTS} -soundhw ${SOUND_DEV}"
-
+ isset SOUND_DEV && VIRTCMDOPTS+=( "-soundhw" "${SOUND_DEV}" )
+
# serial devices TODO test
if isset SERIAL_PORTS; then
for DEV in $SERIAL_PORTS; do
- : # buggeh: VIRTCMDOPTS="${VIRTCMDOPTS} -serial ${DEV}"
+ : # buggeh: VIRTCMDOPTS+=( "-serial" "${DEV}" )
done
fi
}
diff --git a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/init_core.inc b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/init_core.inc
index 7666bedd..fee2cd1c 100644
--- a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/init_core.inc
+++ b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/init_core.inc
@@ -40,15 +40,15 @@ fi
# display name, remove blanks because of cmdline problems
declare -rg CMD_DISPLAYNAME=$(echo ${VM_DISPLAYNAME} | sed -e "s, ,-,g;s,(,[,g;s,),],g")
-declare -g VIRTCMDOPTS="-name ${CMD_DISPLAYNAME}"
+VIRTCMDOPTS+=( "-name" "${CMD_DISPLAYNAME}" )
# graphical start: vga, vmware, qxl, spice?
-VIRTCMDOPTS="${VIRTCMDOPTS} -vga std -full-screen"
+VIRTCMDOPTS+=( "-vga" "std" "-full-screen" )
# hot keys ALT+CTRL+SHIFT (does not work properly!?)
-VIRTCMDOPTS="${VIRTCMDOPTS} -alt-grab"
+VIRTCMDOPTS+=( "-alt-grab" )
# TODO support other types of boot? any usecase for network boot?
# for now just boot from disk
-VIRTCMDOPTS="${VIRTCMDOPTS} -boot c"
+VIRTCMDOPTS+=( "-boot" "c" )
diff --git a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_network.inc b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_network.inc
index 13fcbdf2..73fb2518 100644
--- a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_network.inc
+++ b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_network.inc
@@ -13,7 +13,7 @@ setup_network() {
declare -rg NIC_MODEL="e1000"
# add MAC address and network card model
- VIRTCMDOPTS="${VIRTCMDOPTS} -device ${NIC_MODEL},mac=${VM_MAC_ADDR},netdev=guestnet0"
+ VIRTCMDOPTS+=( "-device" "${NIC_MODEL},mac=${VM_MAC_ADDR},netdev=guestnet0" )
# TODO support different network kinds for lectures in bwlehrpool-suite, just NAT for now
declare -g NETWORK_MODE="nat"
@@ -37,18 +37,18 @@ setup_network() {
fi
case "${NETWORK_MODE}" in
- nat*)
- VIRTCMDOPTS="${VIRTCMDOPTS} -netdev bridge,br=nat1,id=guestnet0,helper=${QEMU_BRIDGE_HELPER}"
- ;;
- bridge*)
- VIRTCMDOPTS="${VIRTCMDOPTS} -netdev bridge,br=br0,id=guestnet0,helper=${QEMU_BRIDGE_HELPER}"
- ;;
- host*)
- VIRTCMDOPTS="${VIRTCMDOPTS} -netdev bridge,br=vsw2,id=guestnet0,helper=${QEMU_BRIDGE_HELPER}"
- ;;
- user*|*)
- VIRTCMDOPTS="${VIRTCMDOPTS} -netdev user,id=guestnet0"
- ;;
+ nat*)
+ VIRTCMDOPTS+=( "-netdev" "bridge,br=nat1,id=guestnet0,helper=${QEMU_BRIDGE_HELPER}" )
+ ;;
+ bridge*)
+ VIRTCMDOPTS+=( "-netdev" "bridge,br=br0,id=guestnet0,helper=${QEMU_BRIDGE_HELPER}" )
+ ;;
+ host*)
+ VIRTCMDOPTS+=( "-netdev" "bridge,br=vsw2,id=guestnet0,helper=${QEMU_BRIDGE_HELPER}" )
+ ;;
+ user*|*)
+ VIRTCMDOPTS+=( "-netdev" "user,id=guestnet0" )
+ ;;
esac
}
diff --git a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc
index e066a55c..32637e5d 100644
--- a/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc
+++ b/core/modules/qemukvm/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc
@@ -7,15 +7,18 @@ setup_rw_layer() {
# setup qcow2 backing file for that disk file
writelog "Creating backing file for '${VM_DISKFILE_RO}'..."
+ # TODO: WTF? This is fucked up, VM_DISKFILE_RW is set if we want to run in persistent mode,
+ # this plugin shouldn't mess around with it....
declare -rg VM_DISKFILE_RW="${TMPDIR}/$(basename ${VM_DISKFILE_RO}).qcow2"
if qemu-img create -f qcow2 -b "${VM_DISKFILE_RO}" "${VM_DISKFILE_RW}"; then
# all good, use it as main disk drive
# TODO: determine the proper type of controller to use, ideally virtio?
- VIRTCMDOPTS="${VIRTCMDOPTS} -drive if=virtio,format=qcow2,file=${VM_DISKFILE_RW}"
+ VIRTCMDOPTS+=("-drive" "if=virtio,format=qcow2,file=${VM_DISKFILE_RW}" )
else
writelog "Error creating backing file for '${VM_DISKFILE_RO}'"
# TODO use -snapshot as fallback, test it!
- VIRTCMDOPTS="${VIRTCMDOPTS} -snapshot"
+ # How is this supposed to even work without a disk?
+ VIRTCMDOPTS+=( "-snapshot" )
fi
}
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt b/core/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt
index 9d7020ed..a2d0f3cb 100755
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/vmchooser-run_virt
@@ -160,6 +160,9 @@ main() {
notify_user "Feature '$FEAT' nicht unterstützt"
fi
done
+ # Prepare array for the command line options
+ unset VIRTCMDOPTS
+ declare -a VIRTCMDOPTS
# The features should now be initialized, call the main 'run_plugin' function of the hypervisor
writelog "#################### Plugin run: $PLUGIN_ID ####################"
writelog "Calling 'run_plugin' of '$PLUGIN_ID'..."
@@ -174,9 +177,9 @@ main() {
cleanexit 1
fi
- writelog "VM command: ${VIRTCMD} ${VIRTCMDOPTS}"
+ writelog "VM command: ${VIRTCMD} ${VIRTCMDOPTS[*]}"
# This will start the VM (no eval needed!)
- ${VIRTCMD} ${VIRTCMDOPTS}
+ "${VIRTCMD}" "${VIRTCMDOPTS[@]}"
writelog "Virtualizer exited with '$?'. Bye."
diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include
index 5ac7ab51..bca5c250 100755
--- a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include
+++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include
@@ -42,11 +42,11 @@ run_plugin() {
# set the variables appropriately (several interfaces with different names)
declare -rg VIRTCMD="${VBOX_BASE_DIR}/VirtualBoxVM"
- declare -rg VIRTCMDOPTS="--startvm ${MACHINE_UUID} --start-running --fullscreen"
+ VIRTCMDOPTS+=( "--startvm" "${MACHINE_UUID}" "--start-running" "--fullscreen" )
- # set headless mode (-v off to disable vrdp)
- declare -rg VIRTCMDHL="${VBOX_BASE_DIR}/VBoxHeadless"
- declare -rg VIRTCMDOPTSHL="-s ${MACHINE_UUID}"
+ # set headless mode (-v off to disable vrdp) XXX currently not supported/used
+ #declare -rg VIRTCMDHL="${VBOX_BASE_DIR}/VBoxHeadless"
+ #declare -rg VIRTCMDOPTSHL="-s ${MACHINE_UUID}"
# for debugging purposes
cp "$VBOX_MACHINE_CONFIG" "/tmp/vbox-last-config.$USER"
diff --git a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc
index 2aba4cdf..8a71a21b 100644
--- a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc
+++ b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc
@@ -46,10 +46,6 @@ fi
[ -n "$gmax" ] && maxhardwareversion="$gmax"
-# VMware start options
-# "-X": start in fullscreen
-declare -rg VM_START_OPTIONS="-X"
-
# create vmware directories
mkdir -p "$VM_REDO_DIR" >/dev/null 2>&1
mkdir -p "$VM_CONF_DIR" >/dev/null 2>&1
diff --git a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
index e98595b7..33d9de29 100644
--- a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
+++ b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
@@ -58,5 +58,6 @@ run_plugin() {
# HACK: using the modified version of the wrapper script
declare -rg VIRTCMD="/opt/openslx/bin/vmplayer"
- declare -rg VIRTCMDOPTS="${VM_START_OPTIONS} ${VM_RUN_FILE}"
+ # -X for fullscreen, plus VMX file
+ VIRTCMDOPTS+=( "-X" "${VM_RUN_FILE}" )
}