提交 e66f87ad 编写于 作者: M Marcos Paulo de Souza 提交者: Michal Privoznik

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: NMarcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 00d9edfe
...@@ -2488,10 +2488,7 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus, ...@@ -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) ...@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册