Following patch will refactor qemuDomainAbortJob to use a per-job-type
switch where we will need to abort a migration job in various branches.
Save some code duplication by introducing a helper.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1911073f3e..4cfc1ca9e7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13996,6 +13996,24 @@ qemuDomainGetJobStats(virDomainPtr dom,
}
+static int
+qemuDomainAbortJobMigration(virDomainObjPtr vm)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ int ret;
+
+ VIR_DEBUG("Cancelling migration job at client request");
+
+ qemuDomainObjAbortAsyncJob(vm);
+ qemuDomainObjEnterMonitor(priv->driver, vm);
+ ret = qemuMonitorMigrateCancel(priv->mon);
+ if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
+ ret = -1;
+
+ return ret;
+}
+
+
static int qemuDomainAbortJob(virDomainPtr dom)
{
virQEMUDriverPtr driver = dom->conn->privateData;
@@ -14047,12 +14065,7 @@ static int qemuDomainAbortJob(virDomainPtr dom)
goto endjob;
}
- VIR_DEBUG("Cancelling job at client request");
- qemuDomainObjAbortAsyncJob(vm);
- qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorMigrateCancel(priv->mon);
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
- ret = -1;
+ ret = qemuDomainAbortJobMigration(vm);
endjob:
qemuDomainObjEndJob(driver, vm);
--
2.23.0