Introduce testDomainGetStatsIOThread to add support for
testConnectGetAllDomainStats to get IOThread infos.
Signed-off-by: Luke Yue <lukedyue(a)gmail.com>
---
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 a6f7de2ccd..d9b0578e13 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -9894,6 +9894,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);
@@ -9905,6 +9945,7 @@ struct testDomainGetStatsWorker {
static struct testDomainGetStatsWorker testDomainGetStatsWorkers[] = {
{ testDomainGetStatsState, VIR_DOMAIN_STATS_STATE },
+ { testDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD },
{ NULL, 0 }
};
@@ -9951,7 +9992,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.33.0