This belongs to the new job management API which can manage also non-block based jobs. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_monitor.c | 12 ++++++++++++ src/qemu/qemu_monitor.h | 4 ++++ src/qemu/qemu_monitor_json.c | 22 ++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 4 ++++ tests/qemumonitorjsontest.c | 2 ++ 5 files changed, 44 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index d9196434ba..815ce58b69 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3475,6 +3475,18 @@ qemuMonitorJobDismiss(qemuMonitorPtr mon, } +int +qemuMonitorJobCancel(qemuMonitorPtr mon, + const char *jobname) +{ + VIR_DEBUG("jobname=%s", jobname); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONJobCancel(mon, jobname); +} + + int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon, const char *drivealias, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 56c68683f5..b306ff0314 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -991,6 +991,10 @@ int qemuMonitorJobDismiss(qemuMonitorPtr mon, const char *jobname) ATTRIBUTE_NONNULL(2); +int qemuMonitorJobCancel(qemuMonitorPtr mon, + const char *jobname) + ATTRIBUTE_NONNULL(2); + int qemuMonitorOpenGraphics(qemuMonitorPtr mon, const char *protocol, int fd, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 2ef2299a68..84b5c30577 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5088,6 +5088,28 @@ qemuMonitorJSONJobDismiss(qemuMonitorPtr mon, } +int +qemuMonitorJSONJobCancel(qemuMonitorPtr mon, + const char *jobname) +{ + VIR_AUTOPTR(virJSONValue) cmd = NULL; + VIR_AUTOPTR(virJSONValue) reply = NULL; + + if (!(cmd = qemuMonitorJSONMakeCommand("job-cancel", + "s:id", jobname, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + if (qemuMonitorJSONBlockJobError(cmd, reply, jobname) < 0) + return -1; + + return 0; +} + + int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon, const char *protocol, const char *fdname, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 1719509ec8..aeaf332943 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -332,6 +332,10 @@ int qemuMonitorJSONJobDismiss(qemuMonitorPtr mon, const char *jobname) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); +int qemuMonitorJSONJobCancel(qemuMonitorPtr mon, + const char *jobname) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + int qemuMonitorJSONSetLink(qemuMonitorPtr mon, const char *name, virDomainNetInterfaceLinkState state); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index e872f93490..eabd834861 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1341,6 +1341,7 @@ GEN_TEST_FUNC(qemuMonitorJSONAddBitmap, "node", "bitmap", true) GEN_TEST_FUNC(qemuMonitorJSONEnableBitmap, "node", "bitmap") GEN_TEST_FUNC(qemuMonitorJSONDeleteBitmap, "node", "bitmap") GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname") +GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname") static int testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque) @@ -3059,6 +3060,7 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONEnableBitmap); DO_TEST_GEN(qemuMonitorJSONDeleteBitmap); DO_TEST_GEN(qemuMonitorJSONJobDismiss); + DO_TEST_GEN(qemuMonitorJSONJobCancel); DO_TEST(qemuMonitorJSONGetBalloonInfo); DO_TEST(qemuMonitorJSONGetBlockInfo); DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo); -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list