mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
conf: Error out if iothread id is missing in iothreadpin
Defining a domain with the following config: <domain ...> ... <iothreads>1</iothreads> <cputune> <iothreadpin cpuset='1'/> will result in the following config formatted back: <domain type='kvm'> ... <iothreads>1</iothreads> <cputune> <iothreadpin iothread='0' cpuset='1'/> After restart the VM would vanish. Since our schema requires the @iothread field to be present in <iothreadpin> make it required by the code too.
This commit is contained in:
parent
0532ec3faa
commit
78d1b0f9b3
@ -13253,31 +13253,35 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node,
|
|||||||
|
|
||||||
ctxt->node = node;
|
ctxt->node = node;
|
||||||
|
|
||||||
if ((tmp = virXPathString("string(./@iothread)", ctxt))) {
|
if (!(tmp = virXPathString("string(./@iothread)", ctxt))) {
|
||||||
if (virStrToLong_uip(tmp, NULL, 10, &iothreadid) < 0) {
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
_("missing iothread id in iothreadpin"));
|
||||||
_("invalid setting for iothread '%s'"), tmp);
|
goto error;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
VIR_FREE(tmp);
|
|
||||||
|
|
||||||
if (iothreadid == 0) {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
||||||
_("zero is an invalid iothread id value"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IOThreads are numbered "iothread1...iothread<n>", 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 (virStrToLong_uip(tmp, NULL, 10, &iothreadid) < 0) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("invalid setting for iothread '%s'"), tmp);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
VIR_FREE(tmp);
|
||||||
|
|
||||||
|
if (iothreadid == 0) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("zero is an invalid iothread id value"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IOThreads are numbered "iothread1...iothread<n>", 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"))) {
|
if (!(tmp = virXMLPropString(node, "cpuset"))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("missing cpuset for iothreadpin"));
|
_("missing cpuset for iothreadpin"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user