[PATCH 4/7] qemu_domain: Add niothreadpids and iothreadpids

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

 



Add new 'niothreadpids' and 'iothreadpids' to mimic the 'ncpupids' and
'vcpupids' that already exist.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 36 ++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_domain.h |  3 +++
 2 files changed, 39 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e9506e0..b23217b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -253,6 +253,7 @@ qemuDomainObjPrivateFree(void *data)
     virDomainChrSourceDefFree(priv->monConfig);
     qemuDomainObjFreeJob(priv);
     VIR_FREE(priv->vcpupids);
+    VIR_FREE(priv->iothreadpids);
     VIR_FREE(priv->lockState);
     VIR_FREE(priv->origname);
 
@@ -311,6 +312,18 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
         virBufferAddLit(buf, "</vcpus>\n");
     }
 
+    if (priv->niothreadpids) {
+        size_t i;
+        virBufferAddLit(buf, "<iothreads>\n");
+        virBufferAdjustIndent(buf, 2);
+        for (i = 0; i < priv->niothreadpids; i++) {
+            virBufferAsprintf(buf, "<iothread pid='%d'/>\n",
+                              priv->iothreadpids[i]);
+        }
+        virBufferAdjustIndent(buf, -2);
+        virBufferAddLit(buf, "</iothreads>\n");
+    }
+
     if (priv->qemuCaps) {
         size_t i;
         virBufferAddLit(buf, "<qemuCaps>\n");
@@ -434,6 +447,29 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
         VIR_FREE(nodes);
     }
 
+    n = virXPathNodeSet("./iothreads/iothread", ctxt, &nodes);
+    if (n < 0)
+        goto error;
+    if (n) {
+        priv->niothreadpids = n;
+        if (VIR_REALLOC_N(priv->iothreadpids, priv->niothreadpids) < 0)
+            goto error;
+
+        for (i = 0; i < n; i++) {
+            char *pidstr = virXMLPropString(nodes[i], "pid");
+            if (!pidstr)
+                goto error;
+
+            if (virStrToLong_i(pidstr, NULL, 10,
+                               &(priv->iothreadpids[i])) < 0) {
+                VIR_FREE(pidstr);
+                goto error;
+            }
+            VIR_FREE(pidstr);
+        }
+        VIR_FREE(nodes);
+    }
+
     if ((n = virXPathNodeSet("./qemuCaps/flag", ctxt, &nodes)) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("failed to parse qemu capabilities flags"));
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 8736889..d27a458 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -142,6 +142,9 @@ struct _qemuDomainObjPrivate {
     int nvcpupids;
     int *vcpupids;
 
+    int niothreadpids;
+    int *iothreadpids;
+
     virDomainPCIAddressSetPtr pciaddrs;
     virDomainCCWAddressSetPtr ccwaddrs;
     int persistentAddrs;
-- 
1.9.3

--
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]