qemu_monitor: Extend qemuMonitorScreendump() for @format

The 'screendump' command has new argument 'format'. Let's expose
this on our QMP level so that callers can specify the format, if
they wish so.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2022-12-07 10:50:04 +01:00
parent 705ab146fc
commit c7796d928b
6 changed files with 10 additions and 4 deletions

View File

@ -3350,7 +3350,7 @@ qemuDomainScreenshot(virDomainPtr dom,
qemuSecurityDomainSetPathLabel(driver, vm, tmp, false);
qemuDomainObjEnterMonitor(vm);
if (qemuMonitorScreendump(priv->mon, videoAlias, screen, tmp) < 0) {
if (qemuMonitorScreendump(priv->mon, videoAlias, screen, NULL, tmp) < 0) {
qemuDomainObjExitMonitor(vm);
goto endjob;
}

View File

@ -2853,13 +2853,15 @@ int
qemuMonitorScreendump(qemuMonitor *mon,
const char *device,
unsigned int head,
const char *format,
const char *file)
{
VIR_DEBUG("device=%s head=%u file=%s", device, head, file);
VIR_DEBUG("device=%s head=%u format=%s file=%s",
device, head, NULLSTR(format), file);
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONScreendump(mon, device, head, file);
return qemuMonitorJSONScreendump(mon, device, head, format, file);
}

View File

@ -987,6 +987,7 @@ int qemuMonitorInjectNMI(qemuMonitor *mon);
int qemuMonitorScreendump(qemuMonitor *mon,
const char *device,
unsigned int head,
const char *format,
const char *file);
int qemuMonitorSendKey(qemuMonitor *mon,

View File

@ -4151,6 +4151,7 @@ int qemuMonitorJSONSendKey(qemuMonitor *mon,
int qemuMonitorJSONScreendump(qemuMonitor *mon,
const char *device,
unsigned int head,
const char *format,
const char *file)
{
g_autoptr(virJSONValue) cmd = NULL;
@ -4160,6 +4161,7 @@ int qemuMonitorJSONScreendump(qemuMonitor *mon,
"s:filename", file,
"S:device", device,
"p:head", head,
"S:format", format,
NULL);
if (!cmd)

View File

@ -337,6 +337,7 @@ int
qemuMonitorJSONScreendump(qemuMonitor *mon,
const char *device,
unsigned int head,
const char *format,
const char *file);
int

View File

@ -1212,7 +1212,7 @@ GEN_TEST_FUNC(qemuMonitorJSONDelDevice, "ide0")
GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", true, "vdb", "targetnode", 1024, 1234, 31234, true, true)
GEN_TEST_FUNC(qemuMonitorJSONBlockStream, "vdb", "jobname", "backingnode", "backingfilename", 1024)
GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "jobname", "topnode", "basenode", "backingfilename", 1024)
GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1, "/foo/bar")
GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1, NULL, "/foo/bar")
GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false)
GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", "export", true, "bitmap")
GEN_TEST_FUNC(qemuMonitorJSONDetachCharDev, "serial1")