From db718d9c2be08c873790236cb9456a31b59abc99 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Tue, 9 Feb 2021 10:40:55 +0100 Subject: [qemu] Call Java run-virt tool to finalize Libvirt configuration --- .../vmchooser/plugins/qemu/run-virt.include | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemu/run-virt.include b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemu/run-virt.include index 9f2b1291..ee9d8e36 100644 --- a/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemu/run-virt.include +++ b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemu/run-virt.include @@ -19,26 +19,32 @@ declare -rg QEMU_PLUGIN_DIR="$(dirname "${BASH_SOURCE[0]}")" declare -rg QEMU_INCLUDE_DIR="${QEMU_PLUGIN_DIR}/includes" -# TODO make this part of the metadata coming from the server -# TBD: "firewall printer usb slxfloppy sound netshares" -declare -rg PLUGIN_FEATURES="slxfloppy" +# Define which features the VMware plugin supports +declare -rg PLUGIN_FEATURES="firewall printer usb slxfloppy sound netshares" run_plugin() { - # declaration of default functions and variables for vmware - $(safesource --exit "${QEMU_INCLUDE_DIR}/init_core.inc") - - # determine limitations wrt RAM and CPU count of VM - $(safesource "${QEMU_INCLUDE_DIR}/determine_hardware_limitations.inc") + # write finalized config to temporary folder for debugging purposes + local vm_final_run_file="/tmp/qemu-last-config.xml" - # setup networking - $(safesource "${QEMU_INCLUDE_DIR}/setup_network.inc") - - # setup rw layer for ro image - $(safesource "${QEMU_INCLUDE_DIR}/setup_rw_layer.inc") + # call the Libvirt Java tool to finalize configuration and start VM + declare -rg VIRTCMD="java -jar /opt/openslx/share/java/runvirt-plugin-qemu.jar" - # build the final start command - $(safesource "${QEMU_INCLUDE_DIR}/finalize_start_command.inc") - - # print summary - needs writelog() from vmchooser-run_virt - $(safesource "${QEMU_INCLUDE_DIR}/log_config_summary.inc") + isset VM_CLEANNAME && VIRTCMDOPTS+=( "-vmname" "${VM_CLEANNAME}" ) + isset VM_DISPLAYNAME && VIRTCMDOPTS+=( "-vmdsplname" "${VM_DISPLAYNAME}" ) + isset VM_OS_TYPE && VIRTCMDOPTS+=( "-vmos" "${VM_OS_TYPE}" ) + isset VM_RUN_FILE && VIRTCMDOPTS+=( "-vminpcfg" "${VM_RUN_FILE}" ) + isset vm_final_run_file && VIRTCMDOPTS+=( "-vmoutcfg" "${vm_final_run_file}" ) + isset IMGUUID && VIRTCMDOPTS+=( "-vmuuid" "${IMGUUID}" ) + isset CPU_CORES && VIRTCMDOPTS+=( "-vmncpus" "${CPU_CORES}" ) + isset VM_MEM && VIRTCMDOPTS+=( "-vmmem" "${VM_MEM}" ) + isset VM_MAC_ADDR && VIRTCMDOPTS+=( "-vmmac0" "${VM_MAC_ADDR}" ) + isset VM_ETH0_NETWORK && VIRTCMDOPTS+=( "-vmeth0" "${VM_ETH0_NETWORK}" ) + isset VM_DISKFILE_RO && VIRTCMDOPTS+=( "-vmhdd0" "${VM_DISKFILE_RO}" ) + isset FLOPPY_0 && VIRTCMDOPTS+=( "-vmfloppy0" "${FLOPPY_0}" ) + isset SLX_FLOPPY_IMG && VIRTCMDOPTS+=( "-vmfloppy1" "${SLX_FLOPPY_IMG}" ) + isset CDROM_0 && VIRTCMDOPTS+=( "-vmcdrom0" "${CDROM_0}" ) + isset CDROM_1 && VIRTCMDOPTS+=( "-vmcdrom1" "${CDROM_1}" ) + isset SERIAL0 && VIRTCMDOPTS+=( "-vmserial0" "${SERIAL0}" ) + isset PARALLEL0 && VIRTCMDOPTS+=( "-vmparallel0" "${PARALLEL0}" ) + isset SOUND_DEV && VIRTCMDOPTS+=( "-vmsound0" "${SOUND_DEV}" ) } -- cgit v1.2.3-55-g7522