This belongs to the new job management API which can manage also
non-block based jobs.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
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 815ce58b69..3cd037fdba 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3487,6 +3487,18 @@ qemuMonitorJobCancel(qemuMonitorPtr mon,
}
+int
+qemuMonitorJobComplete(qemuMonitorPtr mon,
+ const char *jobname)
+{
+ VIR_DEBUG("jobname=%s", jobname);
+
+ QEMU_CHECK_MONITOR(mon);
+
+ return qemuMonitorJSONJobComplete(mon, jobname);
+}
+
+
int
qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
const char *drivealias,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index b306ff0314..e3a3c212fd 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -995,6 +995,10 @@ int qemuMonitorJobCancel(qemuMonitorPtr mon,
const char *jobname)
ATTRIBUTE_NONNULL(2);
+int qemuMonitorJobComplete(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 84b5c30577..33ee026fe1 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5110,6 +5110,28 @@ qemuMonitorJSONJobCancel(qemuMonitorPtr mon,
}
+int
+qemuMonitorJSONJobComplete(qemuMonitorPtr mon,
+ const char *jobname)
+{
+ VIR_AUTOPTR(virJSONValue) cmd = NULL;
+ VIR_AUTOPTR(virJSONValue) reply = NULL;
+
+ if (!(cmd = qemuMonitorJSONMakeCommand("job-complete",
+ "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 aeaf332943..c2b47e6129 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -336,6 +336,10 @@ int qemuMonitorJSONJobCancel(qemuMonitorPtr mon,
const char *jobname)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+int qemuMonitorJSONJobComplete(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 eabd834861..798b7beca3 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1342,6 +1342,7 @@ GEN_TEST_FUNC(qemuMonitorJSONEnableBitmap, "node",
"bitmap")
GEN_TEST_FUNC(qemuMonitorJSONDeleteBitmap, "node", "bitmap")
GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname")
GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname")
+GEN_TEST_FUNC(qemuMonitorJSONJobComplete, "jobname")
static int
testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque)
@@ -3061,6 +3062,7 @@ mymain(void)
DO_TEST_GEN(qemuMonitorJSONDeleteBitmap);
DO_TEST_GEN(qemuMonitorJSONJobDismiss);
DO_TEST_GEN(qemuMonitorJSONJobCancel);
+ DO_TEST_GEN(qemuMonitorJSONJobComplete);
DO_TEST(qemuMonitorJSONGetBalloonInfo);
DO_TEST(qemuMonitorJSONGetBlockInfo);
DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo);
--
2.21.0