[libvirt] [PATCH 09/12] migration: refactor: refactor parameter compatibility checks

Jiri Denemark jdenemar at redhat.com
Mon Oct 12 11:32:19 UTC 2015


On Fri, Oct 02, 2015 at 10:52:49 +0300, Nikolay Shirokovskiy wrote:
> Move virDomainMigrateUnmanagedProto* expected params list check into
> function itself and use common virTypedParamsCheck for this purpose.
> 
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
> ---
>  src/libvirt-domain.c |   58 +++++++++++++++++++++----------------------------
>  1 files changed, 25 insertions(+), 33 deletions(-)
> 
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index fab9564..6261f6b 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -3322,30 +3322,32 @@ virDomainMigrateUnmanagedProto2(virDomainPtr domain,
>                                  int nparams,
>                                  unsigned int flags)
>  {
> +    /* uri parameter is added for direct case */
> +    const char *compatParams[] = { VIR_MIGRATE_PARAM_DEST_NAME,
> +                                   VIR_MIGRATE_PARAM_BANDWIDTH,
> +                                   VIR_MIGRATE_PARAM_URI };
>      const char *uri = NULL;
>      const char *miguri = NULL;
>      const char *dname = NULL;
> -    const char *xmlin = NULL;
>      unsigned long long bandwidth = 0;
>  
> +    if (!virTypedParamsCheck(params, nparams, compatParams,
> +                             ARRAY_CARDINALITY(compatParams))) {
> +        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
> +                       _("Some parameters are not supported by migration "
> +                         "protocol 2."));

Drop '.' at the end of the message.

Jirka




More information about the libvir-list mailing list