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