[PATCH 3/5] qemu_monitor: Extend qemuMonitorScreendump() for @format

Michal Privoznik mprivozn at redhat.com
Wed Dec 7 11:20:51 UTC 2022


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 at redhat.com>
---
 src/qemu/qemu_driver.c       | 2 +-
 src/qemu/qemu_monitor.c      | 7 ++++---
 src/qemu/qemu_monitor.h      | 1 +
 src/qemu/qemu_monitor_json.c | 2 ++
 src/qemu/qemu_monitor_json.h | 1 +
 tests/qemumonitorjsontest.c  | 2 +-
 6 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 25a1f6e0fd..f6683cbb0a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
     }
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index e697ef2518..734364e070 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2853,14 +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);
 }
 
 
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index c690fc3655..906a919f52 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -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,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 39f313c2af..9822097bd7 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 93789480c5..484cb09830 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -337,6 +337,7 @@ int
 qemuMonitorJSONScreendump(qemuMonitor *mon,
                           const char *device,
                           unsigned int head,
+                          const char *format,
                           const char *file);
 
 int
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 238c6c1813..59f7322711 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -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")
-- 
2.37.4



More information about the libvir-list mailing list