qemu: monitor: Add support for 'job-dismiss' command

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-08-16 11:48:41 +02:00
parent e53adccebd
commit 190e66ea5d
5 changed files with 44 additions and 0 deletions

View File

@ -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 int
qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon, qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
const char *drivealias, const char *drivealias,

View File

@ -987,6 +987,10 @@ int qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon,
qemuMonitorBlockJobInfoPtr info) qemuMonitorBlockJobInfoPtr info)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int qemuMonitorJobDismiss(qemuMonitorPtr mon,
const char *jobname)
ATTRIBUTE_NONNULL(2);
int qemuMonitorOpenGraphics(qemuMonitorPtr mon, int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
const char *protocol, const char *protocol,
int fd, int fd,

View File

@ -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, int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
const char *protocol, const char *protocol,
const char *fdname, const char *fdname,

View File

@ -328,6 +328,10 @@ virHashTablePtr qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon,
bool rawjobname) bool rawjobname)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int qemuMonitorJSONJobDismiss(qemuMonitorPtr mon,
const char *jobname)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int qemuMonitorJSONSetLink(qemuMonitorPtr mon, int qemuMonitorJSONSetLink(qemuMonitorPtr mon,
const char *name, const char *name,
virDomainNetInterfaceLinkState state); virDomainNetInterfaceLinkState state);

View File

@ -1340,6 +1340,7 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockdevMediumInsert, "foodev", "newnode")
GEN_TEST_FUNC(qemuMonitorJSONAddBitmap, "node", "bitmap", true) GEN_TEST_FUNC(qemuMonitorJSONAddBitmap, "node", "bitmap", true)
GEN_TEST_FUNC(qemuMonitorJSONEnableBitmap, "node", "bitmap") GEN_TEST_FUNC(qemuMonitorJSONEnableBitmap, "node", "bitmap")
GEN_TEST_FUNC(qemuMonitorJSONDeleteBitmap, "node", "bitmap") GEN_TEST_FUNC(qemuMonitorJSONDeleteBitmap, "node", "bitmap")
GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname")
static int static int
testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque) testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque)
@ -3057,6 +3058,7 @@ mymain(void)
DO_TEST_GEN(qemuMonitorJSONAddBitmap); DO_TEST_GEN(qemuMonitorJSONAddBitmap);
DO_TEST_GEN(qemuMonitorJSONEnableBitmap); DO_TEST_GEN(qemuMonitorJSONEnableBitmap);
DO_TEST_GEN(qemuMonitorJSONDeleteBitmap); DO_TEST_GEN(qemuMonitorJSONDeleteBitmap);
DO_TEST_GEN(qemuMonitorJSONJobDismiss);
DO_TEST(qemuMonitorJSONGetBalloonInfo); DO_TEST(qemuMonitorJSONGetBalloonInfo);
DO_TEST(qemuMonitorJSONGetBlockInfo); DO_TEST(qemuMonitorJSONGetBlockInfo);
DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo); DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo);