[libvirt] [PATCH] esx: Implement esxDomainSetMemoryFlags

Eric Blake eblake at redhat.com
Mon May 20 16:20:55 UTC 2013


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130520/f5801be9/attachment-0001.sig>


More information about the libvir-list mailing list