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

Re: [libvirt] [PATCH] esx: Implement esxDomainSetMemoryFlags



On 05/18/2013 04:03 PM, Matthias Bolte wrote:
> ---
>  src/esx/esx_driver.c |   22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index b55ef45..3962bf1 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -2187,6 +2187,27 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
>  
>  
>  
> +static int
> +esxDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
> +                        unsigned int flags)
> +{
> +    if (flags != VIR_DOMAIN_MEM_CURRENT &&
> +        flags != VIR_DOMAIN_MEM_LIVE &&
> +        flags != (VIR_DOMAIN_MEM_CURRENT | VIR_DOMAIN_MEM_MAXIMUM) &&
> +        flags != (VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_MAXIMUM)) {
> +        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
> +        return -1;
> +    }

Simpler to write as:

virCheckFlags(VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_MAXIMUM, -1);

ACK with that improvement.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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