Re: [PATCH 3/3] esx_driver: Use virCheckFlag macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/03/2018 04:21 AM, Marcos Paulo de Souza wrote:
> Instead of duplicating code to do the same checking. Now all functions
> of virHypervisorDriver from esx driver are using this macro.
> 
> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@xxxxxxxxx>
> ---
>  src/esx/esx_driver.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index 60aa5fc252..705b0d1a41 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -2488,10 +2488,7 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
>      esxVI_TaskInfoState taskInfoState;
>      char *taskInfoErrorMessage = NULL;
>  
> -    if (flags != VIR_DOMAIN_AFFECT_LIVE) {
> -        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
> -        return -1;
> -    }
> +    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1);
>  
>      if (nvcpus < 1) {
>          virReportError(VIR_ERR_INVALID_ARG, "%s",
> @@ -2570,10 +2567,7 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
>      esxVI_ObjectContent *hostSystem = NULL;
>      esxVI_DynamicProperty *dynamicProperty = NULL;
>  
> -    if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
> -        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
> -        return -1;
> -    }
> +    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM, -1);

We tend to put one flag per line as it helps us size down changes needed
when adding new flag (= patches are smaller).

Fixed, ACKed and pushed.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux