On 11/06/2009 08:26 AM, Daniel Veillard wrote: > On Wed, Nov 04, 2009 at 03:06:59PM -0500, Cole Robinson wrote: >> >> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx> >> --- >> src/qemu/qemu_driver.c | 30 ++++-------------------------- >> 1 files changed, 4 insertions(+), 26 deletions(-) >> >> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c >> index 20621d1..53f7398 100644 >> --- a/src/qemu/qemu_driver.c >> +++ b/src/qemu/qemu_driver.c >> @@ -5978,19 +5978,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, >> @@ -6202,19 +6191,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, > > Hum, there is a slight change of semantic in that case, if VM migrated > from A to B, then gets renamed on B, if you try to migrate it back to A > that will fail because the uuid match/name mismatch failure will be > raised while this won't be the case with current code, right ? > Maybe it's the right thing to do, but that's a change I think > > Daniel > Yeah, that's why I had this as a separate patch, since it's a behavior change with no existing precedent. I think the change makes sense here, we are essentially invoking CreateXML on the new host, and this ensures migrate uses the same semantics as CreateXML. I've pushed these two patches now. - Cole -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list