In one of my previous patches (3a3c3780b) I've tried to fix the
problem of nvram path disappearing on a domain that's been
started and shut down again. I fixed this by explicitly saving
domain's config file. However, I did a bit of clumsy without
realizing we have a transient domains for which we don't save the
config file. Hence, any domain using UEFI became persistent.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_process.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c0ab341..1f44683 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3902,13 +3902,13 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
static int
qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg,
- virDomainDefPtr def,
+ virDomainObjPtr vm,
bool migrated)
{
int ret = -1;
int srcFD = -1;
int dstFD = -1;
- virDomainLoaderDefPtr loader = def->os.loader;
+ virDomainLoaderDefPtr loader = vm->def->os.loader;
bool created = false;
/* Unless domain has RO loader of pflash type, we have
@@ -3934,12 +3934,13 @@ qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg,
if (!loader->nvram) {
if (virAsprintf(&loader->nvram,
"%s/lib/libvirt/qemu/nvram/%s_VARS.fd",
- LOCALSTATEDIR, def->name) < 0)
+ LOCALSTATEDIR, vm->def->name) < 0)
goto cleanup;
loader->generated = true;
- if (virDomainSaveConfig(cfg->configDir, def) < 0)
+ if (vm->persistent &&
+ virDomainSaveConfig(cfg->configDir, vm->def) < 0)
goto cleanup;
}
@@ -4106,7 +4107,7 @@ int qemuProcessStart(virConnectPtr conn,
* Fill them in prior to setting the domain def as transient. */
VIR_DEBUG("Generating paths");
- if (qemuPrepareNVRAM(cfg, vm->def, migrateFrom) < 0)
+ if (qemuPrepareNVRAM(cfg, vm, migrateFrom) < 0)
goto cleanup;
/* Do this upfront, so any part of the startup process can add
--
2.0.4