]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_monitor: Extend qemuMonitorScreendump() for @format
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 7 Dec 2022 09:50:04 +0000 (10:50 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 7 Dec 2022 12:14:18 +0000 (13:14 +0100)
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>
src/qemu/qemu_driver.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
tests/qemumonitorjsontest.c

index 25a1f6e0fd755828c7e12f991c8368ea7ab4565b..f6683cbb0a15858b1415f8040031666ed90061d9 100644 (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;
     }
index d10448ec7c3149ff3a1c10ce13cdc3e5d0825331..734364e0701730dc1300129142a90a75f7654984 100644 (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);
 }
 
 
index c690fc3655ece6a5dc18a59772a43c39bf9a2422..906a919f52626a8fe9d2f83713246c9525267c89 100644 (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,
index 39f313c2afe6fa7835719947b80c73b6553fb528..9822097bd7774bd798e5cff0ac228539ccdf0b5c 100644 (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)
index 93789480c573890e9ef84dca1888bc90a20c2298..484cb098303d6eb19a6e176fce5292f8f0221764 100644 (file)
@@ -337,6 +337,7 @@ int
 qemuMonitorJSONScreendump(qemuMonitor *mon,
                           const char *device,
                           unsigned int head,
+                          const char *format,
                           const char *file);
 
 int
index 238c6c18136f9b881e01c1371c34cb63a935149b..59f73227113afe55ddfdf73ed945b095ac9ba87e 100644 (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")