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

[libvirt] [PATCH v2 3/5] test_driver: implement virDomainPinIOThread



Signed-off-by: Ilias Stamatis <stamatis iliass gmail com>
Reviewed-by: Erik Skultety <eskultet redhat com>
---
 src/test/test_driver.c | 51 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b4a883cb54..60d611245d 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -3047,6 +3047,56 @@ testDomainDelIOThread(virDomainPtr dom,
 }
 
 
+static int
+testDomainPinIOThread(virDomainPtr dom,
+                      unsigned int iothread_id,
+                      unsigned char *cpumap,
+                      int maplen,
+                      unsigned int flags)
+{
+    int ret = -1;
+    virDomainObjPtr vm = NULL;
+    virDomainDefPtr def = NULL;
+    virDomainIOThreadIDDefPtr iothrid = NULL;
+    virBitmapPtr 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 = cpumask;
+    iothrid->autofill = false;
+
+    ret = 0;
+ cleanup:
+    if (ret < 0)
+        virBitmapFree(cpumask);
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
+
 static int
 testDomainSetUserPassword(virDomainPtr dom,
                           const char *user ATTRIBUTE_UNUSED,
@@ -9503,6 +9553,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */
     .domainAddIOThread = testDomainAddIOThread, /* 5.7.0 */
     .domainDelIOThread = testDomainDelIOThread, /* 5.7.0 */
+    .domainPinIOThread = testDomainPinIOThread, /* 5.7.0 */
     .domainSetUserPassword = testDomainSetUserPassword, /* 5.6.0 */
     .domainPinEmulator = testDomainPinEmulator, /* 5.6.0 */
     .domainGetEmulatorPinInfo = testDomainGetEmulatorPinInfo, /* 5.6.0 */
-- 
2.22.0


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