[libvirt] [PATCH v2 03/12] migration: move implementation check to branches in p2p

John Ferlan jferlan at redhat.com
Wed Sep 16 22:24:26 UTC 2015



On 09/10/2015 09:20 AM, Nikolay Shirokovskiy wrote:
> This is more structured code so it will be easier to add branch for _PARAMS
> protocol here. It is not a pure refactoring strictly speaking as we remove
> scenarios for broken cases when driver defines V3 feature and implements
> perform function. So it is additionally a more solid code.
> 

The commit message describes a bit more than what's going on... This
patch just moves the checks for driver function closer to the respective
calls...

> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
> ---
>  src/libvirt-domain.c |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)
> 

Seems reasonable - although it becomes interesting to note that the
following patch adds the Perform3 check to the Direct code...

Of course back to my patch 2 comment about dconnuri - here's perhaps an
assumption made at one time that the Perform & Perform3 API's will
always have a non NULL dconnuri (although I didn't see any specific
NONNULL checks).

John

> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 07e342f..6f10c74 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -3353,23 +3353,25 @@ virDomainMigratePeer2PeerPlain(virDomainPtr domain,
>                       dconnuri, NULLSTR(xmlin), NULLSTR(dname), NULLSTR(uri),
>                       bandwidth, flags);
>  
> -    if (!domain->conn->driver->domainMigratePerform &&
> -        !domain->conn->driver->domainMigratePerform3) {
> -        virReportUnsupportedError();
> -        return -1;
> -    }
> -
>      if (virDomainMigrateCheckNotLocal(dconnuri) < 0)
>          return -1;
>  
>      if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
>                                          VIR_DRV_FEATURE_MIGRATION_V3)) {
>          VIR_DEBUG("Using migration protocol 3");
> +        if (!domain->conn->driver->domainMigratePerform3) {
> +            virReportUnsupportedError();
> +            return -1;
> +        }
>          return domain->conn->driver->domainMigratePerform3
>                  (domain, xmlin, NULL, 0, NULL, NULL, dconnuri,
>                   uri, flags, dname, bandwidth);
>      } else {
>          VIR_DEBUG("Using migration protocol 2");
> +        if (!domain->conn->driver->domainMigratePerform) {
> +            virReportUnsupportedError();
> +            return -1;
> +        }
>          if (xmlin) {
>              virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
>                             _("Unable to change target guest XML during "
> 




More information about the libvir-list mailing list