if (loader->nvram && !loader->nvram->format)
loader->nvram->format = loader->format;
- /* If the source already exists and is fully specified, including
- * the path, leave it alone */
- if (loader->nvram && loader->nvram->path)
- return;
+ if (loader->nvram) {
+ /* Nothing to do if a proper NVRAM backend is already configured */
+ if (!virStorageSourceIsEmpty(loader->nvram))
+ return;
- if (loader->nvram)
+ /* otherwise we want to reset and re-populate the definition */
virObjectUnref(loader->nvram);
+ }
loader->nvram = virStorageSourceNew();
loader->nvram->type = VIR_STORAGE_TYPE_FILE;
-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 '{"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"}' \
-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 \
</firmware>
<loader readonly='yes' type='pflash' format='qcow2'>/usr/share/edk2/ovmf/OVMF_CODE_4M.qcow2</loader>
<nvram type='network' format='qcow2'>
- <source protocol='nbd' name='bar'>
+ <source protocol='nbd'>
<host name='example.org' port='6000'/>
</source>
</nvram>
<os firmware='efi'>
<type arch='x86_64' machine='pc-i440fx-4.0'>hvm</type>
<nvram type='network' format='qcow2'>
- <source protocol='nbd' name='bar'>
+ <source protocol='nbd'>
<host name='example.org' port='6000'/>
</source>
</nvram>