Browse Source

libvirt add missing patches

Signed-off-by: virtbuilder_pel7ppc64bebuilder0 <virtbuilder@powerel.org>
master
virtbuilder_pel7ppc64bebuilder0 6 years ago
parent
commit
85817c6d80
  1. 35
      SOURCES/libvirt-RHEL-Add-rhel-machine-types-to-qemuDomainMachineNeedsFDC.patch
  2. 52
      SOURCES/libvirt-RHEL-Add-support-for-QMP-I-O-error-reason.patch
  3. 62
      SOURCES/libvirt-RHEL-Define-ETHTOOL_-GS-COALESCE-when-building-on-older-kernels.patch
  4. 39
      SOURCES/libvirt-RHEL-Fix-maxvcpus-output.patch
  5. 165
      SOURCES/libvirt-RHEL-Hack-around-changed-Broadwell-Haswell-CPUs.patch
  6. 456
      SOURCES/libvirt-RHEL-Support-virtio-disk-hotplug-in-JSON-mode.patch
  7. 72
      SOURCES/libvirt-RHEL-qemu-Add-ability-to-set-sgio-values-for-hostdev.patch
  8. 59
      SOURCES/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch
  9. 38
      SOURCES/libvirt-RHEL-qemu-Support-vhost-user-multiqueue-with-QEMU-2.3.patch
  10. 41
      SOURCES/libvirt-RHEL-qemu-support-relative-backing-for-RHEL-7.0.z-qemu.patch
  11. 179
      SOURCES/libvirt-RHEL-screenshot-Implement-multiple-screen-support.patch

35
SOURCES/libvirt-RHEL-Add-rhel-machine-types-to-qemuDomainMachineNeedsFDC.patch

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
From cf0526ffcd0a1d1e435b7a27a05b7e4f71625165 Mon Sep 17 00:00:00 2001
Message-Id: <cf0526ffcd0a1d1e435b7a27a05b7e4f71625165@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Mon, 22 Feb 2016 12:51:51 +0100
Subject: [PATCH] RHEL: Add rhel machine types to qemuDomainMachineNeedsFDC

RHEL-only.

pc-q35-rhel7.0.0 and pc-q35-rhel7.1.0 do not need an explicit
isa-fdc controller.

https://bugzilla.redhat.com/show_bug.cgi?id=1227880

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_domain.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 580e0f830d..71ef4df887 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8294,6 +8294,9 @@ qemuDomainMachineNeedsFDC(const char *machine)
STRPREFIX(p, "2.2") ||
STRPREFIX(p, "2.3"))
return false;
+ if (STRPREFIX(p, "rhel7.0.0") ||
+ STRPREFIX(p, "rhel7.1.0"))
+ return false;
return true;
}
return false;
--
2.17.0

52
SOURCES/libvirt-RHEL-Add-support-for-QMP-I-O-error-reason.patch

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
From e0e23b17841055a7a5b4e253b516fda248f0f0f5 Mon Sep 17 00:00:00 2001
Message-Id: <e0e23b17841055a7a5b4e253b516fda248f0f0f5@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 9 Oct 2014 10:38:39 +0200
Subject: [PATCH] RHEL: Add support for QMP I/O error reason

RHEL-only

Adds support for __com.redhat_reason on I/O error events. The code will
fallback to upstream nospace boolean if the reason is not present and
complain if neither of these is found.

https://bugzilla.redhat.com/show_bug.cgi?id=1119784

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_monitor_json.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 908e29eac3..ecb2f2dd7d 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -682,7 +682,7 @@ qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr data)
{
const char *device;
const char *action;
- const char *reason = "";
+ const char *reason;
bool nospc = false;
int actionID;
@@ -698,8 +698,14 @@ qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr data)
if ((device = virJSONValueObjectGetString(data, "device")) == NULL)
VIR_WARN("missing device in disk io error event");
- if (virJSONValueObjectGetBoolean(data, "nospace", &nospc) == 0 && nospc)
- reason = "enospc";
+ reason = virJSONValueObjectGetString(data, "__com.redhat_reason");
+ if (!reason) {
+ if (virJSONValueObjectGetBoolean(data, "nospace", &nospc) != 0) {
+ VIR_WARN("neither __com.redhat_reason nor nospace found in disk "
+ "io error event");
+ }
+ reason = nospc ? "enospc" : "";
+ }
if ((actionID = qemuMonitorIOErrorActionTypeFromString(action)) < 0) {
VIR_WARN("unknown disk io error action '%s'", action);
--
2.17.0

62
SOURCES/libvirt-RHEL-Define-ETHTOOL_-GS-COALESCE-when-building-on-older-kernels.patch

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
From 2b0ced9707aae732fabea4b12d7aef65091b56fa Mon Sep 17 00:00:00 2001
Message-Id: <2b0ced9707aae732fabea4b12d7aef65091b56fa@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Tue, 25 Apr 2017 13:41:21 +0200
Subject: [PATCH] RHEL: Define ETHTOOL_[GS]COALESCE when building on older
kernels

https://bugzilla.redhat.com/show_bug.cgi?id=1414627

RHEL-only (upstream will have this only when built on kernel that
supports it).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/util/virnetdev.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index b250af9e2c..bc1e70f0a8 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3393,7 +3393,14 @@ virNetDevGetEthtoolGFeatures(virBitmapPtr bitmap ATTRIBUTE_UNUSED,
# endif
-# if HAVE_DECL_ETHTOOL_SCOALESCE && HAVE_DECL_ETHTOOL_GCOALESCE
+/* Workaround for binary distributions building on old kernels */
+# ifndef ETHTOOL_GCOALESCE
+# define ETHTOOL_GCOALESCE 0x0000000e
+# endif
+# ifndef ETHTOOL_SCOALESCE
+# define ETHTOOL_SCOALESCE 0x0000000f
+# endif
+
/**
* virNetDevSetCoalesce:
* @ifname: interface name to modify
@@ -3493,20 +3500,6 @@ int virNetDevSetCoalesce(const char *ifname,
VIR_FORCE_CLOSE(fd);
return ret;
}
-# else
-int virNetDevSetCoalesce(const char *ifname,
- virNetDevCoalescePtr coalesce,
- bool update)
-{
- if (!coalesce && !update)
- return 0;
-
- virReportSystemError(ENOSYS,
- _("Cannot set coalesce info on interface '%s'"),
- ifname);
- return -1;
-}
-# endif
/**
--
2.17.0

39
SOURCES/libvirt-RHEL-Fix-maxvcpus-output.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From bf608a8e8c53f91b44470e549f73de7dbee33193 Mon Sep 17 00:00:00 2001
Message-Id: <bf608a8e8c53f91b44470e549f73de7dbee33193@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Wed, 17 Sep 2014 19:00:58 +0200
Subject: [PATCH] RHEL: Fix maxvcpus output

https://bugzilla.redhat.com/show_bug.cgi?id=1092363

RHEL-only.

Ignore the maximum vcpu limit (KVM_CAP_MAX_VCPUS) on RHEL,
since RHEL QEMU treats the recommended limit (KVM_CAP_NR_VCPUS)
as the maximum, see:
https://bugzilla.redhat.com/show_bug.cgi?id=998708

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/util/virhostcpu.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 013c95bb56..3f7d70b87b 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -1214,6 +1214,11 @@ virHostCPUGetKVMMaxVCPUs(void)
return -1;
}
+/* Ignore KVM_CAP_MAX_VCPUS on RHEL - the recommended maximum
+ * is treated as a hard limit.
+ */
+# undef KVM_CAP_MAX_VCPUS
+
# ifdef KVM_CAP_MAX_VCPUS
/* at first try KVM_CAP_MAX_VCPUS to determine the maximum count */
if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS)) > 0)
--
2.17.0

165
SOURCES/libvirt-RHEL-Hack-around-changed-Broadwell-Haswell-CPUs.patch

@ -0,0 +1,165 @@ @@ -0,0 +1,165 @@
From 5edf173c9d1bf1c996e1ffc20bec68a23cd84c2e Mon Sep 17 00:00:00 2001
Message-Id: <5edf173c9d1bf1c996e1ffc20bec68a23cd84c2e@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 27 Mar 2015 12:48:40 +0100
Subject: [PATCH] RHEL: Hack around changed Broadwell/Haswell CPUs

RHEL-only

Upstream tried to solve the change of Broadwell and Haswell CPUs by
removing rtm and hle features from the corresponding CPU models for new
machine types. Then they reverted this and introduced new *-noTSX models
instead. However, the original fix was backported to RHEL.

This patch makes sure Broadwell and Haswell will always contain rtm and
hle features regardless on RHEL version or machine type used.

https://bugzilla.redhat.com/show_bug.cgi?id=1199446

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_command.c | 29 +++++++++++++++++++
tests/qemuxml2argvdata/cpu-Haswell.args | 2 +-
.../qemuxml2argvdata/cpu-host-model-cmt.args | 3 +-
tests/qemuxml2argvdata/cpu-tsc-frequency.args | 2 +-
tests/qemuxml2argvdata/q35-acpi-nouefi.args | 2 +-
tests/qemuxml2argvdata/q35-acpi-uefi.args | 2 +-
tests/qemuxml2argvdata/q35-noacpi-nouefi.args | 2 +-
7 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 89fd08b642..307586b26d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6707,6 +6707,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
size_t i;
virCapsPtr caps = NULL;
virCPUDefPtr cpu = def->cpu;
+ bool hle = false;
+ bool rtm = false;
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
@@ -6764,6 +6766,11 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
for (i = 0; i < cpu->nfeatures; i++) {
+ if (STREQ("rtm", cpu->features[i].name))
+ rtm = true;
+ if (STREQ("hle", cpu->features[i].name))
+ hle = true;
+
switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
case VIR_CPU_FEATURE_FORCE:
case VIR_CPU_FEATURE_REQUIRE:
@@ -6787,6 +6794,28 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
}
}
+ /* Some versions of qemu-kvm in RHEL provide Broadwell and Haswell CPU
+ * models which lack rtm and hle features when used with some machine
+ * types. Let's make sure Broadwell and Haswell will always have these
+ * features. But only if the features were not explicitly mentioned in
+ * the guest CPU definition.
+ */
+ if (STREQ_NULLABLE(cpu->model, "Broadwell") ||
+ STREQ_NULLABLE(cpu->model, "Haswell")) {
+ if (!rtm) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
+ virBufferAddLit(buf, ",rtm=on");
+ else
+ virBufferAddLit(buf, ",+rtm");
+ }
+ if (!hle) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
+ virBufferAddLit(buf, ",hle=on");
+ else
+ virBufferAddLit(buf, ",+hle");
+ }
+ }
+
ret = 0;
cleanup:
virObjectUnref(caps);
diff --git a/tests/qemuxml2argvdata/cpu-Haswell.args b/tests/qemuxml2argvdata/cpu-Haswell.args
index 06c9eed5b9..553b91c83b 100644
--- a/tests/qemuxml2argvdata/cpu-Haswell.args
+++ b/tests/qemuxml2argvdata/cpu-Haswell.args
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
-name QEMUGuest1 \
-S \
-M pc \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
-m 214 \
-smp 6,sockets=6,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/cpu-host-model-cmt.args b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
index ef45d98300..28cdf92782 100644
--- a/tests/qemuxml2argvdata/cpu-host-model-cmt.args
+++ b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
@@ -9,7 +9,8 @@ QEMU_AUDIO_DRV=none \
-S \
-M pc \
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
-+smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm \
++smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,+rtm,\
++hle \
-m 214 \
-smp 6,sockets=6,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/cpu-tsc-frequency.args b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
index 3e2da0f242..53193c6fe2 100644
--- a/tests/qemuxml2argvdata/cpu-tsc-frequency.args
+++ b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
-M pc \
-cpu Haswell,+vme,+ds,+acpi,+ss,+ht,+tm,+pbe,+dtes64,+monitor,+ds_cpl,+vmx,\
+smx,+est,+tm2,+xtpr,+pdcm,+osxsave,+f16c,+rdrand,+pdpe1gb,+abm,+lahf_lm,\
-+invtsc,tsc-frequency=3504000000 \
++invtsc,+rtm,+hle,tsc-frequency=3504000000 \
-m 214 \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
diff --git a/tests/qemuxml2argvdata/q35-acpi-nouefi.args b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
index 503045de6b..5e1d3b4eb0 100644
--- a/tests/qemuxml2argvdata/q35-acpi-nouefi.args
+++ b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-M q35 \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
-m 1024 \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
diff --git a/tests/qemuxml2argvdata/q35-acpi-uefi.args b/tests/qemuxml2argvdata/q35-acpi-uefi.args
index fbbbcf9812..40214c69e8 100644
--- a/tests/qemuxml2argvdata/q35-acpi-uefi.args
+++ b/tests/qemuxml2argvdata/q35-acpi-uefi.args
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-M q35 \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,\
readonly=on \
-drive file=/var/lib/libvirt/qemu/nvram/guest_VARS.fd,if=pflash,format=raw,\
diff --git a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
index de2a7f30bc..1be5968e02 100644
--- a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
+++ b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
-name guest \
-S \
-M q35 \
--cpu Haswell \
+-cpu Haswell,+rtm,+hle \
-m 1024 \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
--
2.17.0

456
SOURCES/libvirt-RHEL-Support-virtio-disk-hotplug-in-JSON-mode.patch

@ -0,0 +1,456 @@ @@ -0,0 +1,456 @@
From 7488974ed35b9697199f528357b8ac2ab5623191 Mon Sep 17 00:00:00 2001
Message-Id: <7488974ed35b9697199f528357b8ac2ab5623191@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 5 Apr 2016 09:14:09 +0200
Subject: [PATCH] RHEL: Support virtio disk hotplug in JSON mode

RHEL only, no upstream

For bug
https://bugzilla.redhat.com/show_bug.cgi?id=1026966
https://bugzilla.redhat.com/show_bug.cgi?id=573946

The existing drive_add command can hotplug SCSI and VirtIO
disks, but this isn't ported to JSON mode. RHEL6 introduces
a custom __com.redhat_drive_add that only supports VirtIO
disks. Switch the VirtIO hotplug to this command, but leave
the SCSI hotplug using old command so SCSI gets an explicit
error about being unsupported.

* src/libvirt_private.syms: Export virJSONValueObjectRemoveKey
* src/util/json.c, src/util/json.h: Add virJSONValueObjectRemoveKey
to allow a key to be deleted from an object
* src/qemu/qemu_monitor_json.c: Try __com.redhat_drive_add first and use
drive_add only if the redhat command is not known to qemu.

Also includes the following fix:

https://bugzilla.redhat.com/show_bug.cgi?id=696596

Upstream added drive_del as a way to ensure that disks are fully
removed before returning control to libvirt. But RHEL backported
it as __com.redhat_drive_del, prior to upstream adoption of a
QMP counterpart. Because we weren't trying the RHEL-specific
spelling, we were falling back to the unsafe approach of just
removing the device and hoping for the best, which was racy and
could occasionally result in a rapid hot-plug cycle trying to
plug in a new disk that collides with the old disk not yet gone.

* src/qemu/qemu_monitor_json.c (qemuMonitorJSONDriveDel): Try
rhel-specific drive_del monitor command first.

(cherry picked from commit d1c200dfead14a590a4ddebe20a20ffe441d2b24 in
rhel-6.5 branch)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>

Conflicts:
src/libvirt_private.syms - the change is already upstream
src/util/virjson.[ch] - the change is already upstream
src/qemu/qemu_monitor_json.c - context; upstream doesn't try to
call nonexistent drive_{add,del} QMP commands any more
---
src/qemu/qemu_monitor.c | 12 ++--
src/qemu/qemu_monitor_json.c | 106 +++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 6 ++
tests/qemuhotplugtest.c | 93 +++++++++++++++++++++++++++++-
4 files changed, 211 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index deb2de83fa..f525d60cf0 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3163,8 +3163,10 @@ qemuMonitorDriveDel(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
- /* there won't be a direct replacement for drive_del in QMP */
- return qemuMonitorTextDriveDel(mon, drivestr);
+ if (mon->json)
+ return qemuMonitorJSONDriveDel(mon, drivestr);
+ else
+ return qemuMonitorTextDriveDel(mon, drivestr);
}
@@ -3285,8 +3287,10 @@ qemuMonitorAddDrive(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
- /* there won't ever be a direct QMP replacement for this function */
- return qemuMonitorTextAddDrive(mon, drivestr);
+ if (mon->json)
+ return qemuMonitorJSONAddDrive(mon, drivestr);
+ else
+ return qemuMonitorTextAddDrive(mon, drivestr);
}
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5cc83cad36..908e29eac3 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4000,6 +4000,112 @@ int qemuMonitorJSONDelObject(qemuMonitorPtr mon,
}
+int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
+ const char *drivestr)
+{
+ int ret = -1;
+ virJSONValuePtr cmd;
+ virJSONValuePtr reply = NULL;
+ virJSONValuePtr args;
+
+ cmd = qemuMonitorJSONMakeCommand("__com.redhat_drive_add",
+ NULL);
+ if (!cmd)
+ return -1;
+
+ args = qemuMonitorJSONKeywordStringToJSON(drivestr, "type");
+ if (!args)
+ goto cleanup;
+
+ /* __com.redhat_drive_add rejects the 'if' key */
+ virJSONValueObjectRemoveKey(args, "if", NULL);
+
+ if (virJSONValueObjectAppend(cmd, "arguments", args) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ args = NULL; /* cmd owns reference to args now */
+
+ if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0)
+ goto cleanup;
+
+ if (qemuMonitorJSONHasError(reply, "CommandNotFound")) {
+ virJSONValueFree(cmd);
+ virJSONValueFree(reply);
+ cmd = reply = NULL;
+
+ VIR_DEBUG("__com.redhat_drive_add command not found,"
+ " trying upstream way");
+ } else {
+ ret = qemuMonitorJSONCheckError(cmd, reply);
+ goto cleanup;
+ }
+
+ /* Upstream approach */
+ /* there won't be a direct replacement for drive_add in QMP */
+ ret = qemuMonitorTextAddDrive(mon, drivestr);
+
+ cleanup:
+ virJSONValueFree(args);
+ virJSONValueFree(cmd);
+ virJSONValueFree(reply);
+ return ret;
+}
+
+
+int qemuMonitorJSONDriveDel(qemuMonitorPtr mon,
+ const char *drivestr)
+{
+ int ret;
+ virJSONValuePtr cmd;
+ virJSONValuePtr reply = NULL;
+
+ VIR_DEBUG("drivestr=%s", drivestr);
+ cmd = qemuMonitorJSONMakeCommand("__com.redhat_drive_del",
+ "s:id", drivestr,
+ NULL);
+ if (!cmd)
+ return -1;
+
+ if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0)
+ goto cleanup;
+
+ if (qemuMonitorJSONHasError(reply, "CommandNotFound")) {
+ virJSONValueFree(cmd);
+ virJSONValueFree(reply);
+ cmd = reply = NULL;
+
+ VIR_DEBUG("__com.redhat_drive_del command not found,"
+ " trying upstream way");
+ } else if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) {
+ /* NB: device not found errors mean the drive was
+ * auto-deleted and we ignore the error */
+ ret = 0;
+ goto cleanup;
+ } else {
+ ret = qemuMonitorJSONCheckError(cmd, reply);
+ goto cleanup;
+ }
+
+ /* Upstream approach */
+ /* there won't be a direct replacement for drive_del in QMP */
+ if ((ret = qemuMonitorTextDriveDel(mon, drivestr)) < 0) {
+ virErrorPtr err = virGetLastError();
+ if (err && err->code == VIR_ERR_OPERATION_UNSUPPORTED) {
+ VIR_ERROR("%s",
+ _("deleting disk is not supported. "
+ "This may leak data if disk is reassigned"));
+ ret = 1;
+ virResetLastError();
+ }
+ }
+
+ cleanup:
+ virJSONValueFree(cmd);
+ virJSONValueFree(reply);
+ return ret;
+}
+
int qemuMonitorJSONSetDrivePassphrase(qemuMonitorPtr mon,
const char *alias,
const char *passphrase)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 99815006d7..580d810829 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -237,6 +237,12 @@ int qemuMonitorJSONAddObject(qemuMonitorPtr mon,
int qemuMonitorJSONDelObject(qemuMonitorPtr mon,
const char *objalias);
+int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
+ const char *drivestr);
+
+int qemuMonitorJSONDriveDel(qemuMonitorPtr mon,
+ const char *drivestr);
+
int qemuMonitorJSONSetDrivePassphrase(qemuMonitorPtr mon,
const char *alias,
const char *passphrase);
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 85e53653e1..4757e0b6b3 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -664,6 +664,14 @@ mymain(void)
" }" \
"}\r\n"
+#define QMP_NOT_FOUND \
+ "{" \
+ " \"error\": {" \
+ " \"class\": \"CommandNotFound\"," \
+ " \"desc\": \"The command has not been found\"" \
+ " }" \
+ "}"
+
DO_TEST_UPDATE("graphics-spice", "graphics-spice-nochange", false, false, NULL);
DO_TEST_UPDATE("graphics-spice-timeout", "graphics-spice-timeout-nochange", false, false,
"set_password", QMP_OK, "expire_password", QMP_OK);
@@ -684,67 +692,135 @@ mymain(void)
"chardev-remove", QMP_OK);
DO_TEST_ATTACH("base-live", "disk-virtio", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-live", "disk-virtio", false, false,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
+ DO_TEST_ATTACH("base-live", "disk-virtio", false, true,
+ "__com.redhat_drive_add", QMP_OK,
+ "device_add", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-virtio", false, false,
+ "device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+
DO_TEST_ATTACH_EVENT("base-live", "disk-virtio", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-live", "disk-virtio", true, true,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_DETACH("base-live", "disk-virtio", false, false,
"device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
+ DO_TEST_ATTACH_EVENT("base-live", "disk-virtio", false, true,
+ "__com.redhat_drive_add", QMP_OK,
+ "device_add", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-virtio", true, true,
+ "device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-virtio", false, false,
+ "device_del", QMP_DEVICE_DELETED("virtio-disk4") QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+
DO_TEST_ATTACH("base-live", "disk-usb", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-live", "disk-usb", false, false,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
+ DO_TEST_ATTACH("base-live", "disk-usb", false, true,
+ "__com.redhat_drive_add", QMP_OK,
+ "device_add", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-usb", false, false,
+ "device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+
DO_TEST_ATTACH_EVENT("base-live", "disk-usb", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-live", "disk-usb", true, true,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_DETACH("base-live", "disk-usb", false, false,
"device_del", QMP_DEVICE_DELETED("usb-disk16") QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
+ DO_TEST_ATTACH_EVENT("base-live", "disk-usb", false, true,
+ "__com.redhat_drive_add", QMP_OK,
+ "device_add", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-usb", true, true,
+ "device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-usb", false, false,
+ "device_del", QMP_DEVICE_DELETED("usb-disk16") QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+
DO_TEST_ATTACH("base-live", "disk-scsi", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-live", "disk-scsi", false, false,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
+ DO_TEST_ATTACH("base-live", "disk-scsi", false, true,
+ "__com.redhat_drive_add", QMP_OK,
+ "device_add", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-scsi", false, false,
+ "device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+
DO_TEST_ATTACH_EVENT("base-live", "disk-scsi", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-live", "disk-scsi", true, true,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_DETACH("base-live", "disk-scsi", false, false,
"device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
+ DO_TEST_ATTACH_EVENT("base-live", "disk-scsi", false, true,
+ "__com.redhat_drive_add", QMP_OK,
+ "device_add", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-scsi", true, true,
+ "device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+ DO_TEST_DETACH("base-live", "disk-scsi", false, false,
+ "device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK,
+ "__com.redhat_drive_del", QMP_OK);
+
DO_TEST_ATTACH("base-without-scsi-controller-live", "disk-scsi-2", false, true,
/* Four controllers added */
"device_add", QMP_OK,
"device_add", QMP_OK,
"device_add", QMP_OK,
"device_add", QMP_OK,
- "human-monitor-command", HMP("OK\\r\\n"),
/* Disk added */
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
+ "human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", false, false,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_ATTACH_EVENT("base-without-scsi-controller-live", "disk-scsi-2", false, true,
@@ -753,14 +829,17 @@ mymain(void)
"device_add", QMP_OK,
"device_add", QMP_OK,
"device_add", QMP_OK,
- "human-monitor-command", HMP("OK\\r\\n"),
/* Disk added */
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
+ "human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", true, true,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_DETACH("base-with-scsi-controller-live", "disk-scsi-2", false, false,
"device_del", QMP_DEVICE_DELETED("scsi3-0-5-7") QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_ATTACH("base-live", "qemu-agent", false, true,
@@ -771,38 +850,47 @@ mymain(void)
"chardev-remove", QMP_OK);
DO_TEST_ATTACH("base-ccw-live", "ccw-virtio", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-ccw-live", "ccw-virtio", false, false,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, false,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, false,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
/* Attach a second device, then detach the first one. Then attach the first one again. */
DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
DO_TEST_DETACH("base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-explicit", false, true,
"device_del", QMP_OK,
+ "__com.redhat_drive_del", QMP_NOT_FOUND,
"human-monitor-command", HMP(""));
DO_TEST_ATTACH("base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-reverse", false, false,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
@@ -820,6 +908,7 @@ mymain(void)
"object-del", QMP_OK);
DO_TEST_ATTACH("base-live+disk-scsi-wwn",
"disk-scsi-duplicate-wwn", false, false,
+ "__com.redhat_drive_add", QMP_NOT_FOUND,
"human-monitor-command", HMP("OK\\r\\n"),
"device_add", QMP_OK);
--
2.17.0

72
SOURCES/libvirt-RHEL-qemu-Add-ability-to-set-sgio-values-for-hostdev.patch

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
From 50ad04e882e94c3c4471c216b146b0407490c97b Mon Sep 17 00:00:00 2001
Message-Id: <50ad04e882e94c3c4471c216b146b0407490c97b@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Thu, 9 Jul 2015 08:28:57 -0400
Subject: [PATCH] RHEL: qemu: Add ability to set sgio values for hostdev

https://bugzilla.redhat.com/show_bug.cgi?id=1072736

RHEL-only

Add necessary checks in order to allow setting sgio values for a scsi
host device

Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_conf.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 36cf3a281c..276e34f1a3 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1570,6 +1570,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
virDomainDiskDefPtr disk = NULL;
virDomainHostdevDefPtr hostdev = NULL;
char *sysfs_path = NULL;
+ char *hostdev_path = NULL;
const char *path = NULL;
int val = -1;
int ret = -1;
@@ -1591,14 +1592,10 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
if (!qemuIsSharedHostdev(hostdev))
return 0;
- if (hostdev->source.subsys.u.scsi.sgio) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("'sgio' is not supported for SCSI "
- "generic device yet "));
+ if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
goto cleanup;
- }
- return 0;
+ path = hostdev_path;
} else {
return 0;
}
@@ -1607,7 +1604,11 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
goto cleanup;
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
- val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK)
+ val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
+ else
+ val = (hostdev->source.subsys.u.scsi.sgio ==
+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
/* Do not do anything if unpriv_sgio is not supported by the kernel and the
* whitelist is enabled. But if requesting unfiltered access, always call
@@ -1620,6 +1621,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
ret = 0;
cleanup:
+ VIR_FREE(hostdev_path);
VIR_FREE(sysfs_path);
return ret;
}
--
2.17.0

59
SOURCES/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
From c03c9530094f6b8b0c88f90246c19f8f8f98016e Mon Sep 17 00:00:00 2001
Message-Id: <c03c9530094f6b8b0c88f90246c19f8f8f98016e@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Thu, 9 Jul 2015 08:28:58 -0400
Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host
device

https://bugzilla.redhat.com/show_bug.cgi?id=1072736

RHEL-only

Check if the hostdev has set the sgio filtered/unfiltered and handle
appropriately.

This restores functionality removed by upstream commit id 'ce346623'
to remove sgio support for the SCSI generic host device.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_conf.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 276e34f1a3..2391fa81fb 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1410,6 +1410,8 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
{
char *dev_path = NULL;
char *key = NULL;
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
int ret = -1;
if (!qemuIsSharedHostdev(hostdev))
@@ -1418,6 +1420,19 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
if (!(dev_path = qemuGetHostdevPath(hostdev)))
goto cleanup;
+ if ((ret = qemuCheckUnprivSGIO(driver->sharedDevices, dev_path,
+ scsisrc->sgio)) < 0) {
+ if (ret == -2) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("sgio of shared scsi host device '%s-%u-%u-%llu' "
+ "conflicts with other active domains"),
+ scsihostsrc->adapter, scsihostsrc->bus,
+ scsihostsrc->target, scsihostsrc->unit);
+ ret = -1;
+ }
+ goto cleanup;
+ }
+
if (!(key = qemuGetSharedDeviceKey(dev_path)))
goto cleanup;
--
2.17.0

38
SOURCES/libvirt-RHEL-qemu-Support-vhost-user-multiqueue-with-QEMU-2.3.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
From d65f119ef9f44a6a957f28ed61453845f7a82327 Mon Sep 17 00:00:00 2001
Message-Id: <d65f119ef9f44a6a957f28ed61453845f7a82327@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Mon, 23 Nov 2015 12:46:36 +0100
Subject: [PATCH] RHEL: qemu: Support vhost-user-multiqueue with QEMU 2.3

RHEL-only

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1207692
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1284416

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_capabilities.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7f248bdbcc..264733a3c5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4681,8 +4681,11 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_AARCH64_OFF);
/* vhost-user supports multi-queue from v2.4.0 onwards,
- * but there is no way to query for that capability */
- if (qemuCaps->version >= 2004000)
+ * but there is no way to query for that capability
+ *
+ * RHEL-only: The change was back-ported to earlier QEMU version,
+ * particularly 2.3, in BZ 1276100 */
+ if (qemuCaps->version >= 2003000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
/* smm option is supported from v2.4.0 */
--
2.17.0

41
SOURCES/libvirt-RHEL-qemu-support-relative-backing-for-RHEL-7.0.z-qemu.patch

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
From 05574350f73c51d2ec34a8728ff4152d95be3525 Mon Sep 17 00:00:00 2001
Message-Id: <05574350f73c51d2ec34a8728ff4152d95be3525@dist-git>
From: Eric Blake <eblake@redhat.com>
Date: Tue, 7 Oct 2014 17:06:17 -0600
Subject: [PATCH] RHEL: qemu: support relative backing for RHEL 7.0.z qemu

RHEL-only: https://bugzilla.redhat.com/show_bug.cgi?id=1150322

qemu-kvm-rhev for RHEL 7.0.z backported enough code to allow
relative backing file manipulations, but could not backport
everything from upstream. So, instead of providing the upstream
'change-backing-file' QMP command, it added a downstream-only
'__com.redhat_change-backing-file' as a witness that relative
backing is supported, but not as full-featured. Since libvirt
from RHEL 7.1 may be driving an older qemu, we need to be able
to recognize the alternate spelling.

* src/qemu/qemu_capabilities.c (virQEMUCapsCommands): Also
recognize downstream spelling.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_capabilities.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e54dde69ab..7f248bdbcc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1580,6 +1580,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
{ "add-fd", QEMU_CAPS_ADD_FD },
{ "nbd-server-start", QEMU_CAPS_NBD_SERVER },
{ "change-backing-file", QEMU_CAPS_CHANGE_BACKING_FILE },
+ { "__com.redhat_change-backing-file", QEMU_CAPS_CHANGE_BACKING_FILE },
{ "rtc-reset-reinjection", QEMU_CAPS_RTC_RESET_REINJECTION },
{ "migrate-incoming", QEMU_CAPS_INCOMING_DEFER },
{ "query-hotpluggable-cpus", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS },
--
2.17.0

179
SOURCES/libvirt-RHEL-screenshot-Implement-multiple-screen-support.patch

@ -0,0 +1,179 @@ @@ -0,0 +1,179 @@
From fbda6df6f7509bb2f363542e15df4fad65d2f93f Mon Sep 17 00:00:00 2001
Message-Id: <fbda6df6f7509bb2f363542e15df4fad65d2f93f@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 26 Aug 2011 16:41:17 +0800
Subject: [PATCH] RHEL: screenshot: Implement multiple screen support

For https://bugzilla.redhat.com/show_bug.cgi?id=1026966
https://bugzilla.redhat.com/show_bug.cgi?id=710489
RHEL only, requires __com.redhat_qxl_screendump

As RHEL qemu supports taking screenshot of other monitors than the
first one, we can allow libvirt to support this feature too.

Although this command allows screen specification via ID, there is
not a way to assign one to the primary monitor. Therefore, we must
stick to upstream command in case of primary monitor, and use this
new command in other cases.

(cherry picked from commit 800c9b2c1e0347585213ba6895db7cf064cda21c in
rhel-6.5 branch)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>

Conflicts:
src/qemu/qemu_driver.c - context
src/qemu/qemu_monitor.c - don't return -1 without reporting an
error
---
src/qemu/qemu_driver.c | 22 +++++++++++++++-------
src/qemu/qemu_monitor.c | 14 ++++++++++++--
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 24 ++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 4 ++++
5 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7bcc4936de..6d83c075de 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4055,6 +4055,8 @@ qemuDomainScreenshot(virDomainPtr dom,
char *ret = NULL;
bool unlink_tmp = false;
virQEMUDriverConfigPtr cfg = NULL;
+ int video_index = 0;
+ const char *video_id = NULL;
virCheckFlags(0, NULL);
@@ -4076,12 +4078,15 @@ qemuDomainScreenshot(virDomainPtr dom,
goto endjob;
}
- /* Well, even if qemu allows multiple graphic cards, heads, whatever,
- * screenshot command does not */
- if (screen) {
- virReportError(VIR_ERR_INVALID_ARG,
- "%s", _("currently is supported only taking "
- "screenshots of screen ID 0"));
+ while (video_index < vm->def->nvideos) {
+ if (screen < vm->def->videos[video_index]->heads)
+ break;
+ screen -= vm->def->videos[video_index]->heads;
+ video_index++;
+ }
+
+ if (video_index == vm->def->nvideos) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("no such screen"));
goto endjob;
}
@@ -4096,8 +4101,11 @@ qemuDomainScreenshot(virDomainPtr dom,
qemuSecuritySetSavedStateLabel(driver->securityManager, vm->def, tmp);
+ if (video_index)
+ video_id = vm->def->videos[video_index]->info.alias;
+
qemuDomainObjEnterMonitor(driver, vm);
- if (qemuMonitorScreendump(priv->mon, tmp) < 0) {
+ if (qemuMonitorScreendump(priv->mon, tmp, video_id) < 0) {
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto endjob;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index e169553b7e..deb2de83fa 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3499,12 +3499,22 @@ qemuMonitorSendKey(qemuMonitorPtr mon,
int
qemuMonitorScreendump(qemuMonitorPtr mon,
- const char *file)
+ const char *file,
+ const char *id)
{
- VIR_DEBUG("file=%s", file);
+ VIR_DEBUG("file=%s, id=%s", file, id);
QEMU_CHECK_MONITOR(mon);
+ if (id) {
+ if (!mon->json) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("non-zero screen ID requires JSON monitor"));
+ return -1;
+ }
+ return qemuMonitorJSONScreendumpRH(mon, file, id);
+ }
+
if (mon->json)
return qemuMonitorJSONScreendump(mon, file);
else
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 7a22323504..792a3e2db4 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -935,7 +935,8 @@ int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
int qemuMonitorInjectNMI(qemuMonitorPtr mon);
int qemuMonitorScreendump(qemuMonitorPtr mon,
- const char *file);
+ const char *file,
+ const char *id);
int qemuMonitorSendKey(qemuMonitorPtr mon,
unsigned int holdtime,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index d80c4f18d1..5cc83cad36 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4455,6 +4455,30 @@ int qemuMonitorJSONSendKey(qemuMonitorPtr mon,
return ret;
}
+int qemuMonitorJSONScreendumpRH(qemuMonitorPtr mon,
+ const char *file,
+ const char *id)
+{
+ int ret = -1;
+ virJSONValuePtr cmd, reply = NULL;
+
+ cmd = qemuMonitorJSONMakeCommand("__com.redhat_qxl_screendump",
+ "s:filename", file,
+ "s:id", id,
+ NULL);
+ if (!cmd)
+ return -1;
+
+ ret = qemuMonitorJSONCommand(mon, cmd, &reply);
+
+ if (ret == 0)
+ ret = qemuMonitorJSONCheckError(cmd, reply);
+
+ virJSONValueFree(cmd);
+ virJSONValueFree(reply);
+ return ret;
+}
+
int qemuMonitorJSONScreendump(qemuMonitorPtr mon,
const char *file)
{
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 846d366b27..99815006d7 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -295,6 +295,10 @@ int qemuMonitorJSONSendKey(qemuMonitorPtr mon,
unsigned int *keycodes,
unsigned int nkeycodes);
+int qemuMonitorJSONScreendumpRH(qemuMonitorPtr mon,
+ const char *file,
+ const char *id);
+
int qemuMonitorJSONScreendump(qemuMonitorPtr mon,
const char *file);
--
2.17.0

Loading…
Cancel
Save