This belongs to the new job management API for generic jobs. The dismiss command is meant to remove a concluded job after we were able to get the final status. 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 1a7cfd291b..d9196434ba 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3463,6 +3463,18 @@ qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon, } +int +qemuMonitorJobDismiss(qemuMonitorPtr mon, + const char *jobname) +{ + VIR_DEBUG("jobname=%s", jobname); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONJobDismiss(mon, jobname); +} + + int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon, const char *drivealias, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 42d6e36b4d..56c68683f5 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -987,6 +987,10 @@ int qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon, qemuMonitorBlockJobInfoPtr info) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int qemuMonitorJobDismiss(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 98846740e5..2ef2299a68 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5066,6 +5066,28 @@ qemuMonitorJSONDrivePivot(qemuMonitorPtr mon, } +int +qemuMonitorJSONJobDismiss(qemuMonitorPtr mon, + const char *jobname) +{ + VIR_AUTOPTR(virJSONValue) cmd = NULL; + VIR_AUTOPTR(virJSONValue) reply = NULL; + + if (!(cmd = qemuMonitorJSONMakeCommand("job-dismiss", + "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 069f6dca62..1719509ec8 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -328,6 +328,10 @@ virHashTablePtr qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon, bool rawjobname) ATTRIBUTE_NONNULL(1); +int qemuMonitorJSONJobDismiss(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 07dd746850..e872f93490 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1340,6 +1340,7 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumInsert, "foodev", "newnode") GEN_TEST_FUNC(qemuMonitorJSONAddBitmap, "node", "bitmap", true) GEN_TEST_FUNC(qemuMonitorJSONEnableBitmap, "node", "bitmap") GEN_TEST_FUNC(qemuMonitorJSONDeleteBitmap, "node", "bitmap") +GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname") static int testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque) @@ -3057,6 +3058,7 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONAddBitmap); DO_TEST_GEN(qemuMonitorJSONEnableBitmap); DO_TEST_GEN(qemuMonitorJSONDeleteBitmap); + DO_TEST_GEN(qemuMonitorJSONJobDismiss); 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