mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +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. */
|
||||
dname = dname ? dname : def->name;
|
||||
|
||||
/* Ensure the name and UUID don't already exist in an active VM */
|
||||
vm = virDomainFindByUUID(&driver->domains, def->uuid);
|
||||
|
||||
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 (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = virDomainAssignDef(dconn,
|
||||
driver->caps,
|
||||
@ -6221,19 +6210,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
|
||||
/* Target domain name, maybe renamed. */
|
||||
dname = dname ? dname : def->name;
|
||||
|
||||
/* Ensure the name and UUID don't already exist in an active VM */
|
||||
vm = virDomainFindByUUID(&driver->domains, def->uuid);
|
||||
|
||||
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 (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = virDomainAssignDef(dconn,
|
||||
driver->caps,
|
||||
|
Loading…
x
Reference in New Issue
Block a user