From: Nikolay Shirokovskiy Date: Tue, 3 Nov 2020 06:53:44 +0000 (+0300) Subject: qemu: update name on reverting from snapshot X-Git-Tag: v6.10.0-rc1~186 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3259e47d26a611b97da697cb866e2253fb33c1b;p=thirdparty%2Flibvirt.git 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 --- 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