If we use test driver on different machines, and use 0 as bitmap_size
for virDomainDriverGetIOThreadsConfig(), we would get different results for
the `CPU Affinity`, because it's depending on the host CPU's bitmap. In
order to get a stable result for testing, use result of
virDomainDefGetVcpus() as bitmap_size instead.
Signed-off-by: Luke Yue <lukedyue(a)gmail.com>
---
src/test/test_driver.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b588bbc32e..0971661c89 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -9586,6 +9586,34 @@ testDomainGetMessages(virDomainPtr dom,
return rv;
}
+static int
+testDomainGetIOThreadInfo(virDomainPtr dom,
+ virDomainIOThreadInfoPtr **info,
+ unsigned int flags)
+{
+ virDomainObj *vm;
+ virDomainDef *targetDef = NULL;
+ unsigned int bitmap_size = 0;
+ int ret = -1;
+
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+ if (!(vm = testDomObjFromDomain(dom)))
+ goto cleanup;
+
+ if (!(targetDef = virDomainObjGetOneDef(vm, flags)))
+ goto cleanup;
+
+ bitmap_size = virDomainDefGetVcpus(targetDef);
+
+ ret = virDomainDriverGetIOThreadsConfig(targetDef, info, bitmap_size);
+
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
+
typedef enum {
VIR_DOMAIN_IOTHREAD_ACTION_ADD,
VIR_DOMAIN_IOTHREAD_ACTION_DEL,
@@ -9781,6 +9809,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainGetVcpus = testDomainGetVcpus, /* 0.7.3 */
.domainGetVcpuPinInfo = testDomainGetVcpuPinInfo, /* 1.2.18 */
.domainGetMaxVcpus = testDomainGetMaxVcpus, /* 0.7.3 */
+ .domainGetIOThreadInfo = testDomainGetIOThreadInfo, /* 7.8.0 */
.domainAddIOThread = testDomainAddIOThread, /* 7.8.0 */
.domainDelIOThread = testDomainDelIOThread, /* 7.8.0 */
.domainGetSecurityLabel = testDomainGetSecurityLabel, /* 7.5.0 */
--
2.33.0