summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2021-07-05 09:00:55 +0200
committerManuel Bentele2021-07-05 09:00:55 +0200
commitdf503b8ea498a7d69ce622425a36424a2594457d (patch)
tree9fb38cbbafb6ad164769d313f57500761287f5fb
parent[qemu] Fix hard-coded path to run-virt Java tool (diff)
downloadmltk-df503b8ea498a7d69ce622425a36424a2594457d.tar.gz
mltk-df503b8ea498a7d69ce622425a36424a2594457d.tar.xz
mltk-df503b8ea498a7d69ce622425a36424a2594457d.zip
[qemu] Fix usage of wrong run-virt variables
-rw-r--r--core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemu/run-virt.include20
-rw-r--r--core/modules/qemu/module.conf.ubuntu1
2 files changed, 17 insertions, 4 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 f35afd04..c3dfd21d 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
@@ -23,6 +23,18 @@ declare -rg QEMU_INCLUDE_DIR="${QEMU_PLUGIN_DIR}/includes"
declare -rg PLUGIN_FEATURES="firewall printer usb slxfloppy sound netshares"
run_plugin() {
+ # setup RW image access for operation
+ local vm_diskfile
+ if notempty VM_DISKFILE_RO; then
+ # create copy-on-write layer for readonly image
+ vm_diskfile="${TMPDIR}/$(basename ${VM_DISKFILE_RO}).cow.qcow2"
+ local vm_diskfile_type="$(qemu-img info --output=json ${VM_DISKFILE_RO} | jq -r '.format')"
+ qemu-img create -F "${vm_diskfile_type}" -b "${VM_DISKFILE_RO}" -f qcow2 "${vm_diskfile}"
+ elif notempty VM_DISKFILE_RW; then
+ # use supplied RW disk image from run-virt
+ vm_diskfile="${VM_DISKFILE_RW}"
+ fi
+
# write finalized config to temporary folder for debugging purposes
local vm_final_run_file="/tmp/qemu-last-config.xml"
@@ -34,14 +46,14 @@ run_plugin() {
notempty VM_CLEANNAME && VIRTCMDOPTS+=( "-vmname" "${VM_CLEANNAME}" )
notempty VM_DISPLAYNAME && VIRTCMDOPTS+=( "-vmdsplname" "${VM_DISPLAYNAME}" )
notempty VM_OS_TYPE && VIRTCMDOPTS+=( "-vmos" "${VM_OS_TYPE}" )
- notempty VM_RUN_FILE && VIRTCMDOPTS+=( "-vmcfginp" "${VM_RUN_FILE}" )
+ notempty TMPCONFIG && VIRTCMDOPTS+=( "-vmcfginp" "${TMPCONFIG}" )
notempty vm_final_run_file && VIRTCMDOPTS+=( "-vmcfgout" "${vm_final_run_file}" )
notempty IMGUUID && VIRTCMDOPTS+=( "-vmuuid" "${IMGUUID}" )
- notempty CPU_CORES && VIRTCMDOPTS+=( "-vmncpus" "${CPU_CORES}" )
+ notempty HW_CORES && VIRTCMDOPTS+=( "-vmncpus" "${HW_CORES}" )
notempty VM_MEM && VIRTCMDOPTS+=( "-vmmem" "${VM_MEM}" )
notempty VM_MAC_ADDR && VIRTCMDOPTS+=( "-vmmac0" "${VM_MAC_ADDR}" )
- notempty VM_DISKFILE_RO && VIRTCMDOPTS+=( "-vmhdd0" "${VM_DISKFILE_RO}" )
- notempty FLOPPY_0 && VIRTCMDOPTS+=( "-vmfloppy0" "${FLOPPY_0}" )
+ notempty vm_diskfile && VIRTCMDOPTS+=( "-vmhdd0" "${vm_diskfile}" )
+ VIRTCMDOPTS+=( "-vmfloppy0" "${FLOPPY_0}" )
notempty SLX_FLOPPY_IMG && VIRTCMDOPTS+=( "-vmfloppy1" "${SLX_FLOPPY_IMG}" )
notempty CDROM_0 && VIRTCMDOPTS+=( "-vmcdrom0" "${CDROM_0}" )
notempty CDROM_1 && VIRTCMDOPTS+=( "-vmcdrom1" "${CDROM_1}" )
diff --git a/core/modules/qemu/module.conf.ubuntu b/core/modules/qemu/module.conf.ubuntu
index 3b1089e0..360c6c18 100644
--- a/core/modules/qemu/module.conf.ubuntu
+++ b/core/modules/qemu/module.conf.ubuntu
@@ -14,4 +14,5 @@ REQUIRED_CONTENT_PACKAGES="
qemu-utils
seabios
ovmf
+ jq
"