quickemu: Support $disk_format var for $disk_img
This adds disk_format=${disk_format:-qcow2} variable that defaults to qcow2 format, so the vm.conf files can use $disk_format to specify the format of the $disk_img when this is different from the default qcow2.
This commit is contained in:
parent
41fe0093c8
commit
5d497ed2a0
8
quickemu
8
quickemu
|
@ -1164,7 +1164,7 @@ function vm_boot() {
|
||||||
else
|
else
|
||||||
# shellcheck disable=SC2054,SC2206
|
# shellcheck disable=SC2054,SC2206
|
||||||
args+=(-device virtio-blk-pci,drive=SystemDisk
|
args+=(-device virtio-blk-pci,drive=SystemDisk
|
||||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
|
-drive id=SystemDisk,if=none,format=${disk_format:-qcow2},file="${disk_img}" ${STATUS_QUO})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# https://wiki.qemu.org/Documentation/9psetup
|
# https://wiki.qemu.org/Documentation/9psetup
|
||||||
|
@ -1494,6 +1494,7 @@ function monitor_send_cmd {
|
||||||
boot="efi"
|
boot="efi"
|
||||||
cpu_cores=""
|
cpu_cores=""
|
||||||
disk_img=""
|
disk_img=""
|
||||||
|
disk_format=""
|
||||||
disk_size=""
|
disk_size=""
|
||||||
display=""
|
display=""
|
||||||
extra_args=""
|
extra_args=""
|
||||||
|
@ -1784,6 +1785,11 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
|
||||||
disk_size="${disk}"
|
disk_size="${disk}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set the default disk_format if not provided by user
|
||||||
|
if [ -z "${disk_format}" ]; then
|
||||||
|
disk_format=$(${QEMU_IMG} info "${disk_img}" | grep 'file format' | cut -d ':' -f 2 | tr -cd '[:graph:]')
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${display}" ]; then
|
if [ -n "${display}" ]; then
|
||||||
OUTPUT="${display}"
|
OUTPUT="${display}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue