Re: [PATCH 1/4] domain_conf: Introduce iothreads XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 25, 2014 at 08:38:06PM -0400, John Ferlan wrote:
Introduce XML to allowing adding iothreads to the domain. These can be
used by virtio-blk-pci devices in order to assign a specific thread to
handle the workload for the device.  The iothreads are the official
implementation of the virtio-blk Data Plane that's been in tech preview
for QEMU.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
docs/formatdomain.html.in     | 26 ++++++++++++++++++++++++++
docs/schemas/domaincommon.rng | 12 ++++++++++++
src/conf/domain_conf.c        | 28 ++++++++++++++++++++++++++++
src/conf/domain_conf.h        |  2 ++
4 files changed, 68 insertions(+)

[...]
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 9a89dd8..b4ac483 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -632,6 +632,12 @@
      </optional>

      <optional>
+        <element name="iothreads">
+          <ref name="countIOThreads"/>

What's the difference between this and using ref name="unsignedInt"
directly?

+        </element>
+      </optional>
+
+      <optional>
        <ref name="blkiotune"/>
      </optional>

@@ -4747,6 +4753,12 @@
      <param name="minInclusive">1</param>
    </data>
  </define>
+  <define name="countIOThreads">
+    <data type="unsignedInt">
+      <param name="pattern">[0-9]+</param>
+      <param name="minInclusive">0</param>
+    </data>
+  </define>
  <define name="vcpuid">
    <data type="unsignedShort">
      <param name="pattern">[0-9]+</param>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 22a7f7e..671c41c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11953,6 +11953,23 @@ virDomainDefParseXML(xmlDocPtr xml,
        }
    }

+    /* Optional - iothreads */
+    n = virXPathULong("string(./iothreads[1])", ctxt, &count);
+    if (n == -2) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("iothreads count must be an integer"));
+        goto error;
+    } else if (n < 0) {
+        def->iothreads = 0;
+    } else {
+        if ((unsigned int) count != count) {

Instead of this machinery, it would be more straightforward to just do
(example written by hand, not tested):

tmp = virXPathString("string(./iothreads[1])", ctxt);
if (tmp && virStrToLong_uip(tmp, NULL, 0, &def->iothreads) < 0)
    virReportError(VIR_ERR_XML_ERROR, _("invalid iothreads count '%s'"), tmp);

Martin

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]