From 4dec8a0160aa334ef203f3565606b98285566768 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 21 Apr 2015 17:21:28 -0400 Subject: [PATCH] conf: Adjust the iothreadsched expectations With iothreadid's allowing any 'id' value for an iothread_id, the iothreadsched code needs a slight adjustment to allow for "any" unsigned int value in order to create the bitmap of ids that will have scheduler adjustments. Adjusted the doc description as well. --- docs/formatdomain.html.in | 16 ++++++++++++---- src/conf/domain_conf.c | 14 +++++++++++++- ...emuxml2argv-cputune-iothreadsched-toomuch.xml | 3 ++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 7af6bd7823..0767a2a077 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -691,10 +691,18 @@ type (values batch, idle, fifo, rr) for particular vCPU/IOThread threads (based on vcpus and iothreads, leaving out - vcpus/iothreads sets the default). For - real-time schedulers (fifo, rr), priority must - be specified as well (and is ignored for non-real-time ones). The value - range for the priority depends on the host kernel (usually 1-99). + vcpus/iothreads sets the default). Valid + vcpus values start at 0 through one less than the + number of vCPU's defined for the domain. Valid iothreads + values are described in the iothreadids + description. + If no iothreadids are defined, then libvirt numbers + IOThreads from 1 to the number of iothreads available + for the domain. For real-time schedulers (fifo, + rr), priority must real-time schedulers + (fifo, rr), priority must be specified as + well (and is ignored for non-real-time ones). The value range + for the priority depends on the host kernel (usually 1-99). Since 1.2.13 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1abb702b6f..7da94bb5f3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14348,12 +14348,24 @@ virDomainDefParseXML(xmlDocPtr xml, def->cputune.niothreadsched = n; for (i = 0; i < def->cputune.niothreadsched; i++) { + ssize_t pos = -1; + if (virDomainThreadSchedParse(nodes[i], - 1, def->iothreads, + 1, UINT_MAX, "iothreads", &def->cputune.iothreadsched[i]) < 0) goto error; + while ((pos = virBitmapNextSetBit(def->cputune.iothreadsched[i].ids, + pos)) > -1) { + if (!virDomainIOThreadIDFind(def, pos)) { + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("iothreadsched attribute 'iothreads' " + "uses undefined iothread ids")); + goto error; + } + } + for (j = 0; j < i; j++) { if (virBitmapOverlaps(def->cputune.iothreadsched[i].ids, def->cputune.iothreadsched[j].ids)) { diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cputune-iothreadsched-toomuch.xml b/tests/qemuxml2argvdata/qemuxml2argv-cputune-iothreadsched-toomuch.xml index 1540969a3b..7cae303278 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cputune-iothreadsched-toomuch.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cputune-iothreadsched-toomuch.xml @@ -13,7 +13,8 @@ - + + hvm