提交 e9b354e2 编写于 作者: H Hu Tao 提交者: Daniel Veillard

fix check of vcpuid in virDomainVcpuPinDefParseXML

For emulator, the vcpuid field is always set to -1, instead of parsing
XML for the value of it.
上级 947a51ee
...@@ -7923,7 +7923,7 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node, ...@@ -7923,7 +7923,7 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
{ {
virDomainVcpuPinDefPtr def; virDomainVcpuPinDefPtr def;
xmlNodePtr oldnode = ctxt->node; xmlNodePtr oldnode = ctxt->node;
int vcpuid; int vcpuid = -1;
char *tmp = NULL; char *tmp = NULL;
int ret; int ret;
...@@ -7934,16 +7934,18 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node, ...@@ -7934,16 +7934,18 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
ctxt->node = node; ctxt->node = node;
if (emulator == 0) {
ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid); ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
if ((ret == -2) || (vcpuid < -1)) { if ((ret == -2) || (vcpuid < -1)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("vcpu id must be an unsigned integer or -1")); "%s", _("vcpu id must be an unsigned integer or -1"));
goto error; goto error;
} else if ((vcpuid == -1) && (emulator == 0)) { } else if (vcpuid == -1) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("vcpu id value -1 is not allowed for vcpupin")); "%s", _("vcpu id value -1 is not allowed for vcpupin"));
goto error; goto error;
} }
}
if (vcpuid >= maxvcpus) { if (vcpuid >= maxvcpus) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册