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