From a3259e47d26a611b97da697cb866e2253fb33c1b Mon Sep 17 00:00:00 2001 From: Nikolay Shirokovskiy Date: Tue, 3 Nov 2020 09:53:44 +0300 Subject: [PATCH] qemu: update name on reverting from snapshot If domain name is changed since snapshot we need to update it to current in config taken from snapshot. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_snapshot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 8e3540bbc1..e91716ffff 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1924,6 +1924,11 @@ qemuSnapshotRevert(virDomainObjPtr vm, driver->xmlopt, priv->qemuCaps, true); if (!config) goto endjob; + + if (STRNEQ(config->name, vm->def->name)) { + VIR_FREE(config->name); + config->name = g_strdup(vm->def->name); + } } if (snap->def->inactiveDom) { @@ -1931,6 +1936,11 @@ qemuSnapshotRevert(virDomainObjPtr vm, driver->xmlopt, priv->qemuCaps, true); if (!inactiveConfig) goto endjob; + + if (STRNEQ(inactiveConfig->name, vm->def->name)) { + VIR_FREE(inactiveConfig->name); + inactiveConfig->name = g_strdup(vm->def->name); + } } else { /* Inactive domain definition is missing: * - either this is an old active snapshot and we need to copy the