mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemuFirmwareEnsureNVRAM: Don't try to setup non-local nvram
'qemuFirmwareEnsureNVRAM' which fills the NVRAM configuration bits which may be missing was basing its decision to do something based on whether the 'path' field was set. This is insufficient if remote storage is to be considered. Use 'virStorageSourceIsEmpty()' instead as that properly considers remote filesystems and explain why the source is unref'd when the function decides to rewrite the config. The 'firmware-auto-efi-format-nvram-qcow2-network-nbd' is modified to omit filling the 'path' field, which without this fix would result in the nvram to be reset to a local file. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
273157dd9f
commit
6a8bcd1110
@ -1054,13 +1054,14 @@ qemuFirmwareEnsureNVRAM(virDomainDef *def,
|
|||||||
if (loader->nvram && !loader->nvram->format)
|
if (loader->nvram && !loader->nvram->format)
|
||||||
loader->nvram->format = loader->format;
|
loader->nvram->format = loader->format;
|
||||||
|
|
||||||
/* If the source already exists and is fully specified, including
|
if (loader->nvram) {
|
||||||
* the path, leave it alone */
|
/* Nothing to do if a proper NVRAM backend is already configured */
|
||||||
if (loader->nvram && loader->nvram->path)
|
if (!virStorageSourceIsEmpty(loader->nvram))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (loader->nvram)
|
/* otherwise we want to reset and re-populate the definition */
|
||||||
virObjectUnref(loader->nvram);
|
virObjectUnref(loader->nvram);
|
||||||
|
}
|
||||||
|
|
||||||
loader->nvram = virStorageSourceNew();
|
loader->nvram = virStorageSourceNew();
|
||||||
loader->nvram->type = VIR_STORAGE_TYPE_FILE;
|
loader->nvram->type = VIR_STORAGE_TYPE_FILE;
|
||||||
|
@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
|
|||||||
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
|
-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 '{"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"}' \
|
||||||
-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"export":"bar","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
|
-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"}' \
|
||||||
-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 \
|
-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 \
|
-accel tcg \
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</firmware>
|
</firmware>
|
||||||
<loader readonly='yes' type='pflash' format='qcow2'>/usr/share/edk2/ovmf/OVMF_CODE_4M.qcow2</loader>
|
<loader readonly='yes' type='pflash' format='qcow2'>/usr/share/edk2/ovmf/OVMF_CODE_4M.qcow2</loader>
|
||||||
<nvram type='network' format='qcow2'>
|
<nvram type='network' format='qcow2'>
|
||||||
<source protocol='nbd' name='bar'>
|
<source protocol='nbd'>
|
||||||
<host name='example.org' port='6000'/>
|
<host name='example.org' port='6000'/>
|
||||||
</source>
|
</source>
|
||||||
</nvram>
|
</nvram>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<os firmware='efi'>
|
<os firmware='efi'>
|
||||||
<type arch='x86_64' machine='pc-i440fx-4.0'>hvm</type>
|
<type arch='x86_64' machine='pc-i440fx-4.0'>hvm</type>
|
||||||
<nvram type='network' format='qcow2'>
|
<nvram type='network' format='qcow2'>
|
||||||
<source protocol='nbd' name='bar'>
|
<source protocol='nbd'>
|
||||||
<host name='example.org' port='6000'/>
|
<host name='example.org' port='6000'/>
|
||||||
</source>
|
</source>
|
||||||
</nvram>
|
</nvram>
|
||||||
|
Loading…
Reference in New Issue
Block a user