esx_driver: Use virCheckFlag macro

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@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Marcos Paulo de Souza 2018-07-02 23:21:00 -03:00 committed by Michal Privoznik
parent 00d9edfe2f
commit e66f87ade8

View File

@ -2488,10 +2488,7 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
esxVI_TaskInfoState taskInfoState; esxVI_TaskInfoState taskInfoState;
char *taskInfoErrorMessage = NULL; char *taskInfoErrorMessage = NULL;
if (flags != VIR_DOMAIN_AFFECT_LIVE) { virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1);
virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
return -1;
}
if (nvcpus < 1) { if (nvcpus < 1) {
virReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
@ -2570,10 +2567,8 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
esxVI_ObjectContent *hostSystem = NULL; esxVI_ObjectContent *hostSystem = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL; esxVI_DynamicProperty *dynamicProperty = NULL;
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) { virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); VIR_DOMAIN_VCPU_MAXIMUM, -1);
return -1;
}
if (priv->maxVcpus > 0) if (priv->maxVcpus > 0)
return priv->maxVcpus; return priv->maxVcpus;