Re: [PATCH] esx: Accept VIR_DOMAIN_AFFECT_CURRENT in addition to VIR_DOMAIN_AFFECT_LIVE

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

 



On 05/18/2013 04:02 PM, Matthias Bolte wrote:
> Basically autotranslate VIR_DOMAIN_AFFECT_CURRENT to VIR_DOMAIN_AFFECT_LIVE.
> 
> Modification impact is handled lax anyway. There is no distinction between
> a live and a stored config in the VMware world. A strict modification impact
> handling would require to check the virtual machine state each time and enforce
> VIR_DOMAIN_AFFECT_LIVE-only for running and VIR_DOMAIN_AFFECT_CONFIG-only
> for inactive domains. But that would be useless overhead.
> ---
>  src/esx/esx_driver.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index f53b9c4..85640ce 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -2531,7 +2531,7 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
>      esxVI_TaskInfoState taskInfoState;
>      char *taskInfoErrorMessage = NULL;
>  
> -    if (flags != VIR_DOMAIN_AFFECT_LIVE) {
> +    if (flags != VIR_DOMAIN_AFFECT_CURRENT && flags != VIR_DOMAIN_AFFECT_LIVE) {
>          virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
>          return -1;
>      }

Simpler to write this whole if as:

virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1);

> @@ -2615,7 +2615,8 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
>      esxVI_ObjectContent *hostSystem = NULL;
>      esxVI_DynamicProperty *dynamicProperty = NULL;
>  
> -    if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
> +    if (flags != (VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_VCPU_MAXIMUM) &&
> +        flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
>          virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
>          return -1;
>      }

Might be simpler to write as:

virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM, -1);
if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM))
    error...

> @@ -5222,7 +5223,7 @@ esxDomainGetMetadata(virDomainPtr domain, int type,
>      esxVI_String *propertyNameList = NULL;
>      esxVI_ObjectContent *virtualMachine = NULL;
>  
> -    if (flags != VIR_DOMAIN_AFFECT_LIVE) {
> +    if (flags != VIR_DOMAIN_AFFECT_CURRENT && flags != VIR_DOMAIN_AFFECT_LIVE) {
>          virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
>          return NULL;
>      }

Simpler to write this whole if as:

virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1);

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]