[libvirt] [PATCH] qemu: migrate: Error if we collide with an inactive domain

Chris Lalancette clalance at redhat.com
Wed Oct 28 14:12:45 UTC 2009


Cole Robinson wrote:
> Currently the check for a VM name/uuid collision on the migrate destination
> only errors for active domains. Not sure why this wouldn't apply for non
> running VMs as well, so drop the check.
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  src/qemu/qemu_driver.c |   11 ++++-------
>  1 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 86546e5..fb952d8 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -6341,13 +6341,10 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
>  
>      if (!vm) vm = virDomainFindByName(&driver->domains, dname);
>      if (vm) {
> -        if (virDomainIsActive(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);
> +        qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
> +                          _("domain with the same name or UUID already exists as '%s'"),
> +                          vm->def->name);
> +        goto cleanup;
>      }
>  
>      if (!(vm = virDomainAssignDef(dconn,

No, I don't think we should drop this check.  This is useful for a workaround
where you want to make a guest "persistent" on all sides of a migration.  True,
we now have migration flags that do this for you, but that's only as of 0.7.2.
I think there is still a use-case for defining a guest on a destination, and
then migrating over there.

That being said, maybe we could tighten this check up.  In particular, if the
XML on the destination doesn't equal the incoming XML, then we should probably
fail the migration.  However, if they are the same, we should allow the migration.

-- 
Chris Lalancette




More information about the libvir-list mailing list