When undefining a VM, we must optionally delete any NVRAM that might exist. When using firmware auto-select we always check the generated path, ignoring any user specified path. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e417d358cd..b74b0375a7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6615,11 +6615,10 @@ qemuDomainUndefineFlags(virDomainPtr dom, } } - if (vm->def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI) { + if (vm->def->os.loader->nvram) { + nvram_path = g_strdup(vm->def->os.loader->nvram); + } else if (vm->def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI) { qemuDomainNVRAMPathFormat(cfg, vm->def, &nvram_path); - } else { - if (vm->def->os.loader) - nvram_path = g_strdup(vm->def->os.loader->nvram); } if (nvram_path && virFileExists(nvram_path)) { -- 2.34.1