Add poll-weight support to the test driver so that the virsh test
suite can exercise the iothreadset --poll-weight path end-to-end.

Add a poll_weight field to the testIOThreadInfo struct and initialise
it to 0 in both testDomainGenerateIOThreadInfos and
testDomainAddIOThread. Extend testDomainIOThreadParseParams to accept
and store VIR_DOMAIN_IOTHREAD_POLL_WEIGHT, and extend
testDomainGetStatsIOThread to emit the value via domstats.

Update the expected iothreads.out output to include the poll-weight=0
field in the existing domstats blocks now that the test driver reports
it unconditionally.

Signed-off-by: Jaehoon Kim <[email protected]>
---
 src/test/test_driver.c            | 12 ++++++++++++
 tests/virshtestdata/iothreads.out |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 536e291861..8546c3e251 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -189,6 +189,7 @@ struct _testIOThreadInfo {
     unsigned long long poll_max_ns;
     unsigned int poll_grow;
     unsigned int poll_shrink;
+    unsigned int poll_weight;
 };
 
 static void
@@ -749,6 +750,7 @@ testDomainGenerateIOThreadInfos(virDomainObj *obj)
         iothread.poll_max_ns = 32768;
         iothread.poll_grow = 0;
         iothread.poll_shrink = 0;
+        iothread.poll_weight = 0;
         g_array_append_val(priv->iothreads, iothread);
     }
 }
@@ -9681,6 +9683,7 @@ testDomainAddIOThread(virDomainPtr dom,
     iothread.poll_max_ns = 32768;
     iothread.poll_grow = 0;
     iothread.poll_shrink = 0;
+    iothread.poll_weight = 0;
 
     g_array_append_val(priv->iothreads, iothread);
 
@@ -9795,6 +9798,8 @@ testDomainIOThreadParseParams(virTypedParameterPtr params,
                                VIR_TYPED_PARAM_UINT,
                                VIR_DOMAIN_IOTHREAD_POLL_SHRINK,
                                VIR_TYPED_PARAM_UINT,
+                               VIR_DOMAIN_IOTHREAD_POLL_WEIGHT,
+                               VIR_TYPED_PARAM_UINT,
                                NULL) < 0)
         return -1;
 
@@ -9813,6 +9818,11 @@ testDomainIOThreadParseParams(virTypedParameterPtr 
params,
                               &iothread->poll_shrink) < 0)
         return -1;
 
+    if (virTypedParamsGetUInt(params, nparams,
+                              VIR_DOMAIN_IOTHREAD_POLL_WEIGHT,
+                              &iothread->poll_weight) < 0)
+        return -1;
+
     return 0;
 }
 
@@ -9899,6 +9909,8 @@ testDomainGetStatsIOThread(virDomainObj *dom,
                                  "iothread.%u.poll-grow", 
iothread.iothread_id);
         virTypedParamListAddUInt(params, iothread.poll_shrink,
                                  "iothread.%u.poll-shrink", 
iothread.iothread_id);
+        virTypedParamListAddUInt(params, iothread.poll_weight,
+                                 "iothread.%u.poll-weight", 
iothread.iothread_id);
     }
 
     return 0;
diff --git a/tests/virshtestdata/iothreads.out 
b/tests/virshtestdata/iothreads.out
index 1e38733bcf..4526a00313 100644
--- a/tests/virshtestdata/iothreads.out
+++ b/tests/virshtestdata/iothreads.out
@@ -23,9 +23,11 @@ Domain: 'fc4'
   iothread.4.poll-max-ns=32768
   iothread.4.poll-grow=0
   iothread.4.poll-shrink=0
+  iothread.4.poll-weight=0
   iothread.6.poll-max-ns=32768
   iothread.6.poll-grow=0
   iothread.6.poll-shrink=0
+  iothread.6.poll-weight=0
 
 
 Domain: 'fc4'
@@ -35,9 +37,11 @@ Domain: 'fc4'
   iothread.4.poll-max-ns=32768
   iothread.4.poll-grow=0
   iothread.4.poll-shrink=0
+  iothread.4.poll-weight=0
   iothread.6.poll-max-ns=100
   iothread.6.poll-grow=10
   iothread.6.poll-shrink=10
+  iothread.6.poll-weight=0
 
 
  IOThread ID   CPU Affinity
-- 
2.54.0

Reply via email to