mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemu: Use same create/define overwrite logic for migration prepare.
This commit is contained in:
parent
e02f691a90
commit
c26cb9234f
@ -5997,19 +5997,8 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
|
|||||||
/* Target domain name, maybe renamed. */
|
/* Target domain name, maybe renamed. */
|
||||||
dname = dname ? dname : def->name;
|
dname = dname ? dname : def->name;
|
||||||
|
|
||||||
/* Ensure the name and UUID don't already exist in an active VM */
|
if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
|
||||||
vm = virDomainFindByUUID(&driver->domains, def->uuid);
|
goto cleanup;
|
||||||
|
|
||||||
if (!vm) vm = virDomainFindByName(&driver->domains, dname);
|
|
||||||
if (vm) {
|
|
||||||
if (virDomainObjIsActive(vm)) {
|
|
||||||
qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
|
||||||
_("domain with the same name or UUID already exists as '%s'"),
|
|
||||||
vm->def->name);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
virDomainObjUnlock(vm);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(vm = virDomainAssignDef(dconn,
|
if (!(vm = virDomainAssignDef(dconn,
|
||||||
driver->caps,
|
driver->caps,
|
||||||
@ -6221,19 +6210,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
|
|||||||
/* Target domain name, maybe renamed. */
|
/* Target domain name, maybe renamed. */
|
||||||
dname = dname ? dname : def->name;
|
dname = dname ? dname : def->name;
|
||||||
|
|
||||||
/* Ensure the name and UUID don't already exist in an active VM */
|
if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
|
||||||
vm = virDomainFindByUUID(&driver->domains, def->uuid);
|
goto cleanup;
|
||||||
|
|
||||||
if (!vm) vm = virDomainFindByName(&driver->domains, dname);
|
|
||||||
if (vm) {
|
|
||||||
if (virDomainObjIsActive(vm)) {
|
|
||||||
qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
|
||||||
_("domain with the same name or UUID already exists as '%s'"),
|
|
||||||
vm->def->name);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
virDomainObjUnlock(vm);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(vm = virDomainAssignDef(dconn,
|
if (!(vm = virDomainAssignDef(dconn,
|
||||||
driver->caps,
|
driver->caps,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user