mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
qemu_driver: unlink new domain cfg file when rollback
If we failed to unlink old dom cfg file, we goto rollback. But inside rollback, we fogot to unlink the new dom cfg file. This patch fixes this issue. Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
65462b2944
commit
3b782ce572
@ -19907,6 +19907,7 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *new_dom_name = NULL;
|
char *new_dom_name = NULL;
|
||||||
char *old_dom_name = NULL;
|
char *old_dom_name = NULL;
|
||||||
|
char *new_dom_cfg_file = NULL;
|
||||||
char *old_dom_cfg_file = NULL;
|
char *old_dom_cfg_file = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, ret);
|
virCheckFlags(0, ret);
|
||||||
@ -19916,10 +19917,11 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
|
|||||||
if (VIR_STRDUP(new_dom_name, new_name) < 0)
|
if (VIR_STRDUP(new_dom_name, new_name) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(old_dom_cfg_file = virDomainConfigFile(cfg->configDir,
|
if (!(new_dom_cfg_file = virDomainConfigFile(cfg->configDir,
|
||||||
vm->def->name))) {
|
new_dom_name)) ||
|
||||||
|
!(old_dom_cfg_file = virDomainConfigFile(cfg->configDir,
|
||||||
|
vm->def->name)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
event_old = virDomainEventLifecycleNewFromObj(vm,
|
event_old = virDomainEventLifecycleNewFromObj(vm,
|
||||||
VIR_DOMAIN_EVENT_UNDEFINED,
|
VIR_DOMAIN_EVENT_UNDEFINED,
|
||||||
@ -19948,6 +19950,7 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(old_dom_cfg_file);
|
VIR_FREE(old_dom_cfg_file);
|
||||||
|
VIR_FREE(new_dom_cfg_file);
|
||||||
VIR_FREE(old_dom_name);
|
VIR_FREE(old_dom_name);
|
||||||
VIR_FREE(new_dom_name);
|
VIR_FREE(new_dom_name);
|
||||||
qemuDomainEventQueue(driver, event_old);
|
qemuDomainEventQueue(driver, event_old);
|
||||||
@ -19961,6 +19964,10 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
|
|||||||
vm->def->name = old_dom_name;
|
vm->def->name = old_dom_name;
|
||||||
old_dom_name = NULL;
|
old_dom_name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virFileExists(new_dom_cfg_file))
|
||||||
|
unlink(new_dom_cfg_file);
|
||||||
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user