mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
qemu: monitor: Add support for 'job-cancel' command
This belongs to the new job management API which can manage also non-block based jobs. Since we'll need to be able to attempt to cancel jobs which potentially were not started (during reconnect) the 'quiet' flag allows to suppress errors reported. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
190e66ea5d
commit
1d2e044302
@ -3475,6 +3475,19 @@ qemuMonitorJobDismiss(qemuMonitorPtr mon,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
qemuMonitorJobCancel(qemuMonitorPtr mon,
|
||||||
|
const char *jobname,
|
||||||
|
bool quiet)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("jobname='%s' quiet=%d", jobname, quiet);
|
||||||
|
|
||||||
|
QEMU_CHECK_MONITOR(mon);
|
||||||
|
|
||||||
|
return qemuMonitorJSONJobCancel(mon, jobname, quiet);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
|
qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
|
||||||
const char *drivealias,
|
const char *drivealias,
|
||||||
|
@ -991,6 +991,11 @@ int qemuMonitorJobDismiss(qemuMonitorPtr mon,
|
|||||||
const char *jobname)
|
const char *jobname)
|
||||||
ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
|
int qemuMonitorJobCancel(qemuMonitorPtr mon,
|
||||||
|
const char *jobname,
|
||||||
|
bool quiet)
|
||||||
|
ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
|
int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
|
||||||
const char *protocol,
|
const char *protocol,
|
||||||
int fd,
|
int fd,
|
||||||
|
@ -5088,6 +5088,34 @@ qemuMonitorJSONJobDismiss(qemuMonitorPtr mon,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
qemuMonitorJSONJobCancel(qemuMonitorPtr mon,
|
||||||
|
const char *jobname,
|
||||||
|
bool quiet)
|
||||||
|
{
|
||||||
|
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 (quiet) {
|
||||||
|
if (virJSONValueObjectHasKey(reply, "error") != 0)
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
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,
|
||||||
|
@ -332,6 +332,11 @@ int qemuMonitorJSONJobDismiss(qemuMonitorPtr mon,
|
|||||||
const char *jobname)
|
const char *jobname)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
|
int qemuMonitorJSONJobCancel(qemuMonitorPtr mon,
|
||||||
|
const char *jobname,
|
||||||
|
bool quiet)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int qemuMonitorJSONSetLink(qemuMonitorPtr mon,
|
int qemuMonitorJSONSetLink(qemuMonitorPtr mon,
|
||||||
const char *name,
|
const char *name,
|
||||||
virDomainNetInterfaceLinkState state);
|
virDomainNetInterfaceLinkState state);
|
||||||
|
@ -1341,6 +1341,7 @@ 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")
|
GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname")
|
||||||
|
GEN_TEST_FUNC(qemuMonitorJSONJobCancel, "jobname", false)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque)
|
testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque)
|
||||||
@ -3059,6 +3060,7 @@ mymain(void)
|
|||||||
DO_TEST_GEN(qemuMonitorJSONEnableBitmap);
|
DO_TEST_GEN(qemuMonitorJSONEnableBitmap);
|
||||||
DO_TEST_GEN(qemuMonitorJSONDeleteBitmap);
|
DO_TEST_GEN(qemuMonitorJSONDeleteBitmap);
|
||||||
DO_TEST_GEN(qemuMonitorJSONJobDismiss);
|
DO_TEST_GEN(qemuMonitorJSONJobDismiss);
|
||||||
|
DO_TEST_GEN(qemuMonitorJSONJobCancel);
|
||||||
DO_TEST(qemuMonitorJSONGetBalloonInfo);
|
DO_TEST(qemuMonitorJSONGetBalloonInfo);
|
||||||
DO_TEST(qemuMonitorJSONGetBlockInfo);
|
DO_TEST(qemuMonitorJSONGetBlockInfo);
|
||||||
DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo);
|
DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user