[PATCH v3 04/11] test_driver: Implement virDomainDelIOThread

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

 



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

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index f3e3745442..2813320939 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -9492,6 +9492,7 @@ testDomainGetMessages(virDomainPtr dom,
 
 typedef enum {
     VIR_DOMAIN_IOTHREAD_ACTION_ADD,
+    VIR_DOMAIN_IOTHREAD_ACTION_DEL,
 } virDomainIOThreadAction;
 
 static int
@@ -9516,6 +9517,14 @@ testDomainChgIOThread(virDomainObj *vm,
                 return ret;
 
             break;
+
+        case VIR_DOMAIN_IOTHREAD_ACTION_DEL:
+            if (virDomainDriverDelIOThreadCheck(def, iothread_id) < 0)
+                return ret;
+
+            virDomainIOThreadIDDel(def, iothread_id);
+
+            break;
         }
     }
 
@@ -9565,6 +9574,51 @@ testDomainAddIOThread(virDomainPtr dom,
     virDomainObjEndAPI(&vm);
     return ret;
 }
+
+static int
+testDomainDelIOThread(virDomainPtr dom,
+                      unsigned int iothread_id,
+                      unsigned int flags)
+{
+    virDomainObj *vm = NULL;
+    testDomainObjPrivate *priv;
+    size_t i;
+    int ret = -1;
+
+    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+                  VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+    if (iothread_id == 0) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("invalid value of 0 for iothread_id"));
+        return -1;
+    }
+
+    if (!(vm = testDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (testDomainChgIOThread(vm, iothread_id,
+                              VIR_DOMAIN_IOTHREAD_ACTION_DEL, flags) < 0)
+        goto cleanup;
+
+    priv = vm->privateData;
+
+    for (i = 0; i < priv->iothreads->len; i++) {
+        testIOThreadInfo iothread = g_array_index(priv->iothreads,
+                                                  testIOThreadInfo, i);
+        if (iothread.iothread_id == iothread_id) {
+            g_array_remove_index(priv->iothreads, i);
+            break;
+        }
+    }
+
+    ret = 0;
+
+ cleanup:
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
 /*
  * Test driver
  */
@@ -9632,6 +9686,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainGetVcpuPinInfo = testDomainGetVcpuPinInfo, /* 1.2.18 */
     .domainGetMaxVcpus = testDomainGetMaxVcpus, /* 0.7.3 */
     .domainAddIOThread = testDomainAddIOThread, /* 7.7.0 */
+    .domainDelIOThread = testDomainDelIOThread, /* 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