In certain cases such as when aborting migration we don't really care for completion of the blockjob. Add 'force' as parameter of 'block-job-cancel'. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_monitor.c | 7 ++++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 2 +- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d908e95ba7..7a9ad03489 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14510,7 +14510,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, if (blockdev) ret = qemuMonitorJobCancel(priv->mon, job->name, false); else - ret = qemuMonitorBlockJobCancel(priv->mon, job->name); + ret = qemuMonitorBlockJobCancel(priv->mon, job->name, false); if (qemuDomainObjExitMonitor(driver, vm) < 0) { ret = -1; goto endjob; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index df88f954ed..b9143166cb 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -732,7 +732,7 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; - rv = qemuMonitorBlockJobCancel(priv->mon, job->name); + rv = qemuMonitorBlockJobCancel(priv->mon, job->name, false); if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0) return -1; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f3f14c46b6..fa8a027aa6 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3403,13 +3403,14 @@ qemuMonitorBlockStream(qemuMonitor *mon, int qemuMonitorBlockJobCancel(qemuMonitor *mon, - const char *jobname) + const char *jobname, + bool force) { - VIR_DEBUG("jobname=%s", jobname); + VIR_DEBUG("jobname=%s force=%d", jobname, force); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONBlockJobCancel(mon, jobname); + return qemuMonitorJSONBlockJobCancel(mon, jobname, force); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 230d00a894..95f1a10e31 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1081,7 +1081,8 @@ int qemuMonitorBlockStream(qemuMonitor *mon, ATTRIBUTE_NONNULL(2); int qemuMonitorBlockJobCancel(qemuMonitor *mon, - const char *jobname) + const char *jobname, + bool force) ATTRIBUTE_NONNULL(2); int qemuMonitorBlockJobSetSpeed(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8f3ccb0c63..dc74c86158 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5217,13 +5217,15 @@ qemuMonitorJSONBlockStream(qemuMonitor *mon, int qemuMonitorJSONBlockJobCancel(qemuMonitor *mon, - const char *jobname) + const char *jobname, + bool force) { g_autoptr(virJSONValue) cmd = NULL; g_autoptr(virJSONValue) reply = NULL; if (!(cmd = qemuMonitorJSONMakeCommand("block-job-cancel", "s:device", jobname, + "B:force", force, NULL))) return -1; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 0846325a81..486ba5a593 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -325,7 +325,8 @@ int qemuMonitorJSONBlockStream(qemuMonitor *mon, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int qemuMonitorJSONBlockJobCancel(qemuMonitor *mon, - const char *jobname) + const char *jobname, + bool force) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 8ed6509159..9e53b65289 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1218,7 +1218,7 @@ GEN_TEST_FUNC(qemuMonitorJSONBitmapRemove, "foodev", "newnode") GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname") GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname", false) GEN_TEST_FUNC(qemuMonitorJSONJobComplete, "jobname") -GEN_TEST_FUNC(qemuMonitorJSONBlockJobCancel, "jobname") +GEN_TEST_FUNC(qemuMonitorJSONBlockJobCancel, "jobname", true) static int testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque) -- 2.30.2