Signed-off-by: Luke Yue <lukedyue(a)gmail.com>
---
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 e0b7ace4ed..b588bbc32e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -9588,6 +9588,7 @@ testDomainGetMessages(virDomainPtr dom,
typedef enum {
VIR_DOMAIN_IOTHREAD_ACTION_ADD,
+ VIR_DOMAIN_IOTHREAD_ACTION_DEL,
} virDomainIOThreadAction;
static int
@@ -9612,6 +9613,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;
}
}
@@ -9661,6 +9670,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
*/
@@ -9728,6 +9782,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainGetVcpuPinInfo = testDomainGetVcpuPinInfo, /* 1.2.18 */
.domainGetMaxVcpus = testDomainGetMaxVcpus, /* 0.7.3 */
.domainAddIOThread = testDomainAddIOThread, /* 7.8.0 */
+ .domainDelIOThread = testDomainDelIOThread, /* 7.8.0 */
.domainGetSecurityLabel = testDomainGetSecurityLabel, /* 7.5.0 */
.nodeGetSecurityModel = testNodeGetSecurityModel, /* 7.5.0 */
.domainGetXMLDesc = testDomainGetXMLDesc, /* 0.1.4 */
--
2.33.0