qemu: remove possible garbage left from previous rename/undefine

Due to failures to unlink on previous rename/undefine we can already have
autolink etc files for the domain to be defined. Remove them.

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 10:16:21 +03:00
parent 773c7c4361
commit b814d499a7
2 changed files with 9 additions and 0 deletions

View File

@ -6719,6 +6719,9 @@ qemuDomainDefineXMLFlags(virConnectPtr conn,
goto cleanup;
def = NULL;
if (!oldDef && qemuDomainNamePathsCleanup(cfg, vm->def->name, false) < 0)
goto cleanup;
if (virDomainDefSave(vm->newDef ? vm->newDef : vm->def,
driver->xmlopt, cfg->configDir) < 0)
goto cleanup;
@ -19179,6 +19182,9 @@ qemuDomainRenameCallback(virDomainObjPtr vm,
vm->def->name)))
return -1;
if (qemuDomainNamePathsCleanup(cfg, new_name, false) < 0)
goto cleanup;
if (vm->autostart) {
if (!(new_dom_autostart_link = virDomainConfigFile(cfg->autostartDir,
new_dom_name)) ||

View File

@ -5137,6 +5137,9 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver,
priv->qemuCaps)))
goto error;
if (!oldPersist && qemuDomainNamePathsCleanup(cfg, vmdef->name, false) < 0)
goto error;
if (virDomainDefSave(vmdef, driver->xmlopt, cfg->configDir) < 0 &&
!ignoreSaveError)
goto error;