As we are using jobState to store dummy job type, so just change it to
VIR_DOMAIN_JOB_CANCELLED when try to abort a job.
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 9899976966..35350edda9 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2889,6 +2889,34 @@ testDomainGetJobStats(virDomainPtr domain,
return ret;
}
+static int
+testDomainAbortJob(virDomainPtr dom)
+{
+ virDomainObj *vm;
+ int ret = -1;
+ testDomainObjPrivate *priv;
+
+ if (!(vm = testDomObjFromDomain(dom)))
+ goto cleanup;
+
+ if (virDomainObjCheckActive(vm) < 0)
+ goto cleanup;
+
+ priv = vm->privateData;
+
+ if (priv->jobState == VIR_DOMAIN_JOB_NONE) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("no job is active on the domain"));
+ } else {
+ priv->jobState = VIR_DOMAIN_JOB_CANCELLED;
+ ret = 0;
+ }
+
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
+
static int
testDomainGetLaunchSecurityInfo(virDomainPtr domain G_GNUC_UNUSED,
virTypedParameterPtr *params G_GNUC_UNUSED,
@@ -9792,6 +9820,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainSetLifecycleAction = testDomainSetLifecycleAction, /* 5.7.0 */
.domainGetJobInfo = testDomainGetJobInfo, /* 7.7.0 */
.domainGetJobStats = testDomainGetJobStats, /* 7.7.0 */
+ .domainAbortJob = testDomainAbortJob, /* 7.7.0 */
.domainSnapshotNum = testDomainSnapshotNum, /* 1.1.4 */
.domainSnapshotListNames = testDomainSnapshotListNames, /* 1.1.4 */
--
2.32.0