[PATCH v3 10/11] test_driver: Introduce testDomainGetStatsIOThread

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

 



Introduce testDomainGetStatsIOThread to add support for
testConnectGetAllDomainStats to get IOThread infos.

Signed-off-by: Luke Yue <lukedyue@xxxxxxxxx>
---
 src/test/test_driver.c | 44 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 6eebd85cf3..3c4015a67d 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -9798,6 +9798,46 @@ testDomainGetStatsState(virDomainObj *dom,
     return 0;
 }
 
+static int
+testDomainGetStatsIOThread(virDomainObj *dom,
+                           virTypedParamList *params)
+{
+    testDomainObjPrivate *priv = dom->privateData;
+    size_t i;
+    int niothreads = 0;
+
+    if (!virDomainObjIsActive(dom))
+        return 0;
+
+    niothreads = priv->iothreads->len;
+
+    if (niothreads == 0) {
+        return 0;
+    }
+
+    if (virTypedParamListAddUInt(params, niothreads, "iothread.count") < 0)
+        return -1;
+
+    for (i = 0; i < niothreads; i++) {
+        testIOThreadInfo iothread = g_array_index(priv->iothreads,
+                                                  testIOThreadInfo, i);
+        if (virTypedParamListAddULLong(params, iothread.poll_max_ns,
+                                       "iothread.%u.poll-max-ns",
+                                       iothread.iothread_id) < 0)
+            return -1;
+        if (virTypedParamListAddUInt(params, iothread.poll_grow,
+                                     "iothread.%u.poll-grow",
+                                     iothread.iothread_id) < 0)
+            return -1;
+        if (virTypedParamListAddUInt(params, iothread.poll_shrink,
+                                     "iothread.%u.poll-shrink",
+                                     iothread.iothread_id) < 0)
+            return -1;
+    }
+
+    return 0;
+}
+
 typedef int
 (*testDomainGetStatsFunc)(virDomainObj *dom,
                           virTypedParamList *list);
@@ -9809,6 +9849,7 @@ struct testDomainGetStatsWorker {
 
 static struct testDomainGetStatsWorker testDomainGetStatsWorkers[] = {
     { testDomainGetStatsState, VIR_DOMAIN_STATS_STATE },
+    { testDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD },
     { NULL, 0 }
 };
 
@@ -9855,7 +9896,8 @@ testConnectGetAllDomainStats(virConnectPtr conn,
                                    VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT |
                                    VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE);
 
-    unsigned int supported = VIR_DOMAIN_STATS_STATE;
+    unsigned int supported = VIR_DOMAIN_STATS_STATE |
+                             VIR_DOMAIN_STATS_IOTHREAD;
     virDomainObj **vms = NULL;
     size_t nvms;
     virDomainStatsRecordPtr *tmpstats = NULL;
-- 
2.32.0




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

  Powered by Linux