diff options
author | Manuel Bentele | 2021-02-02 10:42:07 +0100 |
---|---|---|
committer | Manuel Bentele | 2021-02-02 10:42:07 +0100 |
commit | eaeb75d858f45447c4b3d17f33b6183f95b98466 (patch) | |
tree | 6846441981fa5fd43b24b3e973d38144d92f578e /core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc | |
parent | [hardware-stats] Add ID45 to status updates (diff) | |
download | mltk-eaeb75d858f45447c4b3d17f33b6183f95b98466.tar.gz mltk-eaeb75d858f45447c4b3d17f33b6183f95b98466.tar.xz mltk-eaeb75d858f45447c4b3d17f33b6183f95b98466.zip |
[qemu] Rename 'qemukvm' core module to 'qemu'
Diffstat (limited to 'core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc')
-rw-r--r-- | core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc new file mode 100644 index 00000000..32637e5d --- /dev/null +++ b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/setup_rw_layer.inc @@ -0,0 +1,25 @@ + +setup_rw_layer() { + if isempty VM_DISKFILE_RO; then + writelog "No source diskfile found! This should be specified in the given XML file. Is it valid?" + EXIT_TYPE="user" EXIT_REASON="Keine virtuelle Festplatte zu dieser Veranstaltung angegeben!" cleanexit 1 + fi + + # 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+=("-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! + # How is this supposed to even work without a disk? + VIRTCMDOPTS+=( "-snapshot" ) + fi +} + +call_post_source setup_rw_layer |