The qemu driver does support qcow2 images for the firmware and nvram pflash devices, but we do not do the full backing chain setup for them as we don't expect that those images would actually have a backing store. We don't tell that to qemu though which theoretically can lead to qemu probing the backing store from the image itself. We don't want that for now. Deny qemu probing the backing store by installing a "terminator" empty virStorageSource as 'backingStore' for pflash and nvram. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 2 ++ .../firmware-auto-efi-aarch64.aarch64-latest.abi-update.args | 4 ++-- ...auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.args | 4 ++-- .../firmware-auto-efi-format-loader-qcow2.x86_64-latest.args | 4 ++-- ...auto-efi-format-nvram-qcow2-network-nbd.x86_64-latest.args | 4 ++-- ...rmware-auto-efi-format-nvram-qcow2-path.x86_64-latest.args | 4 ++-- .../firmware-auto-efi-format-nvram-qcow2.x86_64-latest.args | 4 ++-- ...mware-auto-efi-loader-secure.x86_64-latest.abi-update.args | 4 ++-- .../firmware-auto-efi-riscv64.riscv64-latest.abi-update.args | 4 ++-- .../firmware-auto-efi.x86_64-latest.abi-update.args | 4 ++-- 10 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7b702cfc6b..a256775960 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -12069,11 +12069,13 @@ qemuDomainInitializePflashStorageSource(virDomainObj *vm, pflash0->format = def->os.loader->format; pflash0->path = g_strdup(def->os.loader->path); pflash0->readonly = false; + pflash0->backingStore = virStorageSourceNew(); /* terminator */ virTristateBoolToBool(def->os.loader->readonly, &pflash0->readonly); qemuBlockStorageSourceSetFormatNodename(pflash0, g_strdup("libvirt-pflash0-format")); qemuBlockStorageSourceSetStorageNodename(pflash0, g_strdup("libvirt-pflash0-storage")); if (def->os.loader->nvram) { + def->os.loader->nvram->backingStore = virStorageSourceNew(); /* terminator */ if (qemuDomainPrepareStorageSourceBlockdevNodename(NULL, def->os.loader->nvram, "libvirt-pflash1", diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-aarch64.aarch64-latest.abi-update.args b/tests/qemuxmlconfdata/firmware-auto-efi-aarch64.aarch64-latest.abi-update.args index 30f86aa046..3e20cb4aa5 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi-aarch64.aarch64-latest.abi-update.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi-aarch64.aarch64-latest.abi-update.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine virt-4.0,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \ -accel tcg \ -cpu cortex-a15 \ diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.args b/tests/qemuxmlconfdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.args index e8d7d580f7..2694e0676f 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-loader-qcow2-nvram-path.x86_64-latest.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"file","filename":"/path/to/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \ -accel kvm \ -cpu qemu64 \ diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-loader-qcow2.x86_64-latest.args b/tests/qemuxmlconfdata/firmware-auto-efi-format-loader-qcow2.x86_64-latest.args index 790fb619e8..2bc7a1b9d5 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi-format-loader-qcow2.x86_64-latest.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-loader-qcow2.x86_64-latest.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \ -accel kvm \ -cpu qemu64 \ diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2-network-nbd.x86_64-latest.args b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2-network-nbd.x86_64-latest.args index f78b4e7abf..e8e6157f67 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2-network-nbd.x86_64-latest.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2-network-nbd.x86_64-latest.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine pc-i440fx-4.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \ -accel tcg \ -cpu qemu64 \ diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2-path.x86_64-latest.args b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2-path.x86_64-latest.args index e8d7d580f7..2694e0676f 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2-path.x86_64-latest.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2-path.x86_64-latest.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"file","filename":"/path/to/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \ -accel kvm \ -cpu qemu64 \ diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2.x86_64-latest.args b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2.x86_64-latest.args index 790fb619e8..2bc7a1b9d5 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2.x86_64-latest.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-qcow2.x86_64-latest.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \ -accel kvm \ -cpu qemu64 \ diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-loader-secure.x86_64-latest.abi-update.args b/tests/qemuxmlconfdata/firmware-auto-efi-loader-secure.x86_64-latest.abi-update.args index 790fb619e8..2bc7a1b9d5 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi-loader-secure.x86_64-latest.abi-update.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi-loader-secure.x86_64-latest.abi-update.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \ -accel kvm \ -cpu qemu64 \ diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-riscv64.riscv64-latest.abi-update.args b/tests/qemuxmlconfdata/firmware-auto-efi-riscv64.riscv64-latest.abi-update.args index e10575bf81..f467f71d72 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi-riscv64.riscv64-latest.abi-update.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi-riscv64.riscv64-latest.abi-update.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/riscv/RISCV_VIRT_CODE.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine virt,usb=off,dump-guest-core=off,memory-backend=riscv_virt_board.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=off \ -accel tcg \ -cpu rv64 \ diff --git a/tests/qemuxmlconfdata/firmware-auto-efi.x86_64-latest.abi-update.args b/tests/qemuxmlconfdata/firmware-auto-efi.x86_64-latest.abi-update.args index 790fb619e8..2bc7a1b9d5 100644 --- a/tests/qemuxmlconfdata/firmware-auto-efi.x86_64-latest.abi-update.args +++ b/tests/qemuxmlconfdata/firmware-auto-efi.x86_64-latest.abi-update.args @@ -11,9 +11,9 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ -blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE_4M.secboot.qcow2","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"qcow2","file":"libvirt-pflash0-storage","backing":null}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/guest_VARS.qcow2","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver":"qcow2","file":"libvirt-pflash1-storage","backing":null}' \ -machine pc-q35-4.0,usb=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format,acpi=on \ -accel kvm \ -cpu qemu64 \ -- 2.47.0