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 <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Nikolay Shirokovskiy 2020-11-03 09:53:44 +03:00
parent 3b1244bffd
commit a3259e47d2
1 changed files with 10 additions and 0 deletions

View File

@ -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