From: Peter Krempa Date: Tue, 7 Apr 2015 17:52:02 +0000 (+0200) Subject: conf: Error out if iothread id is missing in iothreadpin X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=78d1b0f9b35ae7bc1b5569aeaba6a52355a647a9;p=libvirt.git conf: Error out if iothread id is missing in iothreadpin Defining a domain with the following config: ... 1 will result in the following config formatted back: ... 1 After restart the VM would vanish. Since our schema requires the @iothread field to be present in make it required by the code too. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b17295a35f..39eb050b32 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13253,31 +13253,35 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node, ctxt->node = node; - if ((tmp = virXPathString("string(./@iothread)", ctxt))) { - if (virStrToLong_uip(tmp, NULL, 10, &iothreadid) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid setting for iothread '%s'"), tmp); - goto error; - } - VIR_FREE(tmp); + if (!(tmp = virXPathString("string(./@iothread)", ctxt))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing iothread id in iothreadpin")); + goto error; + } - if (iothreadid == 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("zero is an invalid iothread id value")); - goto error; - } + if (virStrToLong_uip(tmp, NULL, 10, &iothreadid) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("invalid setting for iothread '%s'"), tmp); + goto error; + } + VIR_FREE(tmp); - /* IOThreads are numbered "iothread1...iothread", where - * "n" is the iothreads value */ - if (iothreadid > iothreads) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("iothread id must not exceed iothreads")); - goto error; - } + if (iothreadid == 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("zero is an invalid iothread id value")); + goto error; + } - def->id = iothreadid; + /* IOThreads are numbered "iothread1...iothread", where + * "n" is the iothreads value */ + if (iothreadid > iothreads) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("iothread id must not exceed iothreads")); + goto error; } + def->id = iothreadid; + if (!(tmp = virXMLPropString(node, "cpuset"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing cpuset for iothreadpin"));