|
|
982648 |
From 6019d375ba10735d805801fb0ecee71e4a32871c Mon Sep 17 00:00:00 2001
|
|
|
982648 |
Message-Id: <6019d375ba10735d805801fb0ecee71e4a32871c@dist-git>
|
|
|
6d3351 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
6d3351 |
Date: Fri, 26 Aug 2011 16:41:17 +0800
|
|
|
6d3351 |
Subject: [PATCH] RHEL: screenshot: Implement multiple screen support
|
|
|
6d3351 |
|
|
|
6d3351 |
For https://bugzilla.redhat.com/show_bug.cgi?id=1026966
|
|
|
6d3351 |
https://bugzilla.redhat.com/show_bug.cgi?id=710489
|
|
|
6d3351 |
RHEL only, requires __com.redhat_qxl_screendump
|
|
|
6d3351 |
|
|
|
6d3351 |
As RHEL qemu supports taking screenshot of other monitors than the
|
|
|
6d3351 |
first one, we can allow libvirt to support this feature too.
|
|
|
6d3351 |
|
|
|
6d3351 |
Although this command allows screen specification via ID, there is
|
|
|
6d3351 |
not a way to assign one to the primary monitor. Therefore, we must
|
|
|
6d3351 |
stick to upstream command in case of primary monitor, and use this
|
|
|
6d3351 |
new command in other cases.
|
|
|
6d3351 |
|
|
|
6d3351 |
(cherry picked from commit 800c9b2c1e0347585213ba6895db7cf064cda21c in
|
|
|
6d3351 |
rhel-6.5 branch)
|
|
|
6d3351 |
|
|
|
6d3351 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d3351 |
|
|
|
6d3351 |
Conflicts:
|
|
|
6d3351 |
src/qemu/qemu_driver.c - context
|
|
|
6d3351 |
src/qemu/qemu_monitor.c - don't return -1 without reporting an
|
|
|
6d3351 |
error
|
|
|
6d3351 |
---
|
|
|
982648 |
src/qemu/qemu_driver.c | 20 +++++++++-----------
|
|
|
982648 |
src/qemu/qemu_monitor.c | 13 +++++++++++++
|
|
|
982648 |
src/qemu/qemu_monitor.h | 3 +++
|
|
|
6d3351 |
src/qemu/qemu_monitor_json.c | 24 ++++++++++++++++++++++++
|
|
|
6d3351 |
src/qemu/qemu_monitor_json.h | 4 ++++
|
|
|
982648 |
5 files changed, 53 insertions(+), 11 deletions(-)
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
982648 |
index 825b2b27e6..00952a55e7 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_driver.c
|
|
|
6d3351 |
+++ b/src/qemu/qemu_driver.c
|
|
|
982648 |
@@ -3996,6 +3996,7 @@ qemuDomainScreenshot(virDomainPtr dom,
|
|
|
6d3351 |
char *ret = NULL;
|
|
|
6d3351 |
bool unlink_tmp = false;
|
|
|
6d3351 |
virQEMUDriverConfigPtr cfg = NULL;
|
|
|
982648 |
+ int rc;
|
|
|
6d3351 |
|
|
|
6d3351 |
virCheckFlags(0, NULL);
|
|
|
6d3351 |
|
|
|
982648 |
@@ -4021,12 +4022,6 @@ qemuDomainScreenshot(virDomainPtr dom,
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
982648 |
if (screen) {
|
|
|
982648 |
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SCREENDUMP_DEVICE)) {
|
|
|
982648 |
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
|
|
982648 |
- _("qemu does not allow specifying screen ID"));
|
|
|
982648 |
- goto endjob;
|
|
|
982648 |
- }
|
|
|
982648 |
-
|
|
|
982648 |
for (i = 0; i < vm->def->nvideos; i++) {
|
|
|
982648 |
const virDomainVideoDef *video = vm->def->videos[i];
|
|
|
6d3351 |
|
|
|
982648 |
@@ -4057,11 +4052,14 @@ qemuDomainScreenshot(virDomainPtr dom,
|
|
|
6d3351 |
qemuSecuritySetSavedStateLabel(driver->securityManager, vm->def, tmp);
|
|
|
6d3351 |
|
|
|
6d3351 |
qemuDomainObjEnterMonitor(driver, vm);
|
|
|
982648 |
- if (qemuMonitorScreendump(priv->mon, videoAlias, screen, tmp) < 0) {
|
|
|
982648 |
- ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
|
|
982648 |
- goto endjob;
|
|
|
982648 |
- }
|
|
|
982648 |
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
|
982648 |
+
|
|
|
982648 |
+ if (!videoAlias ||
|
|
|
982648 |
+ virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SCREENDUMP_DEVICE))
|
|
|
982648 |
+ rc = qemuMonitorScreendump(priv->mon, videoAlias, screen, tmp);
|
|
|
982648 |
+ else
|
|
|
982648 |
+ rc = qemuMonitorScreendumpRH(priv->mon, videoAlias, tmp);
|
|
|
982648 |
+
|
|
|
982648 |
+ if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
|
|
|
6d3351 |
goto endjob;
|
|
|
982648 |
|
|
|
982648 |
if (VIR_CLOSE(tmp_fd) < 0) {
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
|
|
982648 |
index 6ed475ede0..6fc038a8d9 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_monitor.c
|
|
|
6d3351 |
+++ b/src/qemu/qemu_monitor.c
|
|
|
982648 |
@@ -3340,6 +3340,19 @@ qemuMonitorSendKey(qemuMonitorPtr mon,
|
|
|
982648 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
|
|
|
982648 |
+int
|
|
|
982648 |
+qemuMonitorScreendumpRH(qemuMonitorPtr mon,
|
|
|
982648 |
+ const char *device,
|
|
|
982648 |
+ const char *file)
|
|
|
982648 |
+{
|
|
|
982648 |
+ VIR_DEBUG("device=%s, file=%s", device, file);
|
|
|
982648 |
+
|
|
|
982648 |
+ QEMU_CHECK_MONITOR(mon);
|
|
|
982648 |
+
|
|
|
982648 |
+ return qemuMonitorJSONScreendumpRH(mon, device, file);
|
|
|
982648 |
+}
|
|
|
6d3351 |
+
|
|
|
982648 |
+
|
|
|
982648 |
int
|
|
|
982648 |
qemuMonitorScreendump(qemuMonitorPtr mon,
|
|
|
982648 |
const char *device,
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
|
|
982648 |
index b3d62324b4..f4d8225ca5 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_monitor.h
|
|
|
6d3351 |
+++ b/src/qemu/qemu_monitor.h
|
|
|
982648 |
@@ -878,6 +878,9 @@ int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
|
|
|
982648 |
|
|
|
6d3351 |
int qemuMonitorInjectNMI(qemuMonitorPtr mon);
|
|
|
6d3351 |
|
|
|
982648 |
+int qemuMonitorScreendumpRH(qemuMonitorPtr mon,
|
|
|
982648 |
+ const char *device,
|
|
|
982648 |
+ const char *file);
|
|
|
6d3351 |
int qemuMonitorScreendump(qemuMonitorPtr mon,
|
|
|
982648 |
const char *device,
|
|
|
982648 |
unsigned int head,
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
|
|
982648 |
index 3e90279b71..af754e870e 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_monitor_json.c
|
|
|
6d3351 |
+++ b/src/qemu/qemu_monitor_json.c
|
|
|
982648 |
@@ -4481,6 +4481,30 @@ int qemuMonitorJSONSendKey(qemuMonitorPtr mon,
|
|
|
6d3351 |
return ret;
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
+int qemuMonitorJSONScreendumpRH(qemuMonitorPtr mon,
|
|
|
982648 |
+ const char *id,
|
|
|
982648 |
+ const char *file)
|
|
|
6d3351 |
+{
|
|
|
6d3351 |
+ int ret = -1;
|
|
|
6d3351 |
+ virJSONValuePtr cmd, reply = NULL;
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ cmd = qemuMonitorJSONMakeCommand("__com.redhat_qxl_screendump",
|
|
|
6d3351 |
+ "s:filename", file,
|
|
|
6d3351 |
+ "s:id", id,
|
|
|
6d3351 |
+ NULL);
|
|
|
6d3351 |
+ if (!cmd)
|
|
|
6d3351 |
+ return -1;
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ ret = qemuMonitorJSONCommand(mon, cmd, &reply);
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ if (ret == 0)
|
|
|
6d3351 |
+ ret = qemuMonitorJSONCheckError(cmd, reply);
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ virJSONValueFree(cmd);
|
|
|
6d3351 |
+ virJSONValueFree(reply);
|
|
|
6d3351 |
+ return ret;
|
|
|
6d3351 |
+}
|
|
|
6d3351 |
+
|
|
|
6d3351 |
int qemuMonitorJSONScreendump(qemuMonitorPtr mon,
|
|
|
982648 |
const char *device,
|
|
|
982648 |
unsigned int head,
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
|
|
|
982648 |
index 6bc0dd3ad2..b92fc3762b 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_monitor_json.h
|
|
|
6d3351 |
+++ b/src/qemu/qemu_monitor_json.h
|
|
|
982648 |
@@ -297,6 +297,10 @@ int qemuMonitorJSONSendKey(qemuMonitorPtr mon,
|
|
|
6d3351 |
unsigned int *keycodes,
|
|
|
6d3351 |
unsigned int nkeycodes);
|
|
|
6d3351 |
|
|
|
6d3351 |
+int qemuMonitorJSONScreendumpRH(qemuMonitorPtr mon,
|
|
|
982648 |
+ const char *id,
|
|
|
982648 |
+ const char *file);
|
|
|
6d3351 |
+
|
|
|
6d3351 |
int qemuMonitorJSONScreendump(qemuMonitorPtr mon,
|
|
|
982648 |
const char *device,
|
|
|
982648 |
unsigned int head,
|
|
|
6d3351 |
--
|
|
|
982648 |
2.18.0
|
|
|
6d3351 |
|