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.
This commit is contained in:
Hu Tao 2012-08-23 10:31:12 +08:00 committed by Daniel Veillard
parent 947a51ee94
commit e9b354e2a9

View File

@ -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,15 +7934,17 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
ctxt->node = node; ctxt->node = node;
ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid); if (emulator == 0) {
if ((ret == -2) || (vcpuid < -1)) { ret = virXPathInt("string(./@vcpu)", ctxt, &vcpuid);
virReportError(VIR_ERR_INTERNAL_ERROR, if ((ret == -2) || (vcpuid < -1)) {
"%s", _("vcpu id must be an unsigned integer or -1")); virReportError(VIR_ERR_INTERNAL_ERROR,
goto error; "%s", _("vcpu id must be an unsigned integer or -1"));
} else if ((vcpuid == -1) && (emulator == 0)) { goto error;
virReportError(VIR_ERR_INTERNAL_ERROR, } else if (vcpuid == -1) {
"%s", _("vcpu id value -1 is not allowed for vcpupin")); virReportError(VIR_ERR_INTERNAL_ERROR,
goto error; "%s", _("vcpu id value -1 is not allowed for vcpupin"));
goto error;
}
} }
if (vcpuid >= maxvcpus) { if (vcpuid >= maxvcpus) {