[PATCH v3 07/11] test_driver: Implement virDomainPinIOThread

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

 



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

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 67337879ef..385c8b3ad3 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -9647,6 +9647,55 @@ testDomainDelIOThread(virDomainPtr dom,
     return ret;
 }
 
+static int
+testDomainPinIOThread(virDomainPtr dom,
+                      unsigned int iothread_id,
+                      unsigned char *cpumap,
+                      int maplen,
+                      unsigned int flags)
+{
+    int ret = -1;
+    virDomainObj *vm;
+    virDomainDef *def;
+    virDomainIOThreadIDDef *iothrid;
+    virBitmap *cpumask = NULL;
+
+    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+                  VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+    if (!(vm = testDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (!(def = virDomainObjGetOneDef(vm, flags)))
+        goto cleanup;
+
+    if (!(cpumask = virBitmapNewData(cpumap, maplen)))
+        goto cleanup;
+
+    if (virBitmapIsAllClear(cpumask)) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("Empty iothread cpumap list for pinning"));
+        goto cleanup;
+    }
+
+    if (!(iothrid = virDomainIOThreadIDFind(def, iothread_id))) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("iothreadid %d not found"), iothread_id);
+        goto cleanup;
+    }
+
+    virBitmapFree(iothrid->cpumask);
+    iothrid->cpumask = g_steal_pointer(&cpumask);
+    iothrid->autofill = false;
+
+    ret = 0;
+
+ cleanup:
+    virBitmapFree(cpumask);
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
 /*
  * Test driver
  */
@@ -9716,6 +9765,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainGetIOThreadInfo = testDomainGetIOThreadInfo, /* 7.7.0 */
     .domainAddIOThread = testDomainAddIOThread, /* 7.7.0 */
     .domainDelIOThread = testDomainDelIOThread, /* 7.7.0 */
+    .domainPinIOThread = testDomainPinIOThread, /* 7.7.0 */
     .domainGetSecurityLabel = testDomainGetSecurityLabel, /* 7.5.0 */
     .nodeGetSecurityModel = testNodeGetSecurityModel, /* 7.5.0 */
     .domainGetXMLDesc = testDomainGetXMLDesc, /* 0.1.4 */
-- 
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