From e66f87ade87e95631835206910ff682d970a24f2 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Mon, 2 Jul 2018 23:21:00 -0300 Subject: [PATCH] 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 Signed-off-by: Michal Privoznik --- src/esx/esx_driver.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index bb8eeecd42..e906d11fa9 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,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)) { - virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); - return -1; - } + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_VCPU_MAXIMUM, -1); if (priv->maxVcpus > 0) return priv->maxVcpus;