Compare commits
No commits in common. "imports/c9-beta/libvirt-8.0.0-7.el9_0" and "c8-stream-rhel" have entirely different histories.
imports/c9
...
c8-stream-
|
@ -0,0 +1,49 @@
|
|||
From 9c2fd182a02d64004e30900c52e3fcdb550de0bd Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <9c2fd182a02d64004e30900c52e3fcdb550de0bd@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 22 Jun 2022 16:35:50 +0200
|
||||
Subject: [PATCH] Add VIR_MIGRATE_ZEROCOPY flag
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The flag can be used to enable zero-copy mechanism for migrating memory
|
||||
pages.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 8744beecb36600e773c8a8c4823db2bf4b3e262d)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
|
||||
|
||||
Conflicts:
|
||||
include/libvirt/libvirt-domain.h
|
||||
- post-copy recovery not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
include/libvirt/libvirt-domain.h | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
|
||||
index 5f0a9b7572..792973ce2d 100644
|
||||
--- a/include/libvirt/libvirt-domain.h
|
||||
+++ b/include/libvirt/libvirt-domain.h
|
||||
@@ -860,6 +860,14 @@ typedef enum {
|
||||
*/
|
||||
VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES = (1 << 18),
|
||||
|
||||
+ /* Use zero-copy mechanism for migrating memory pages. For QEMU/KVM this
|
||||
+ * means QEMU will be temporarily allowed to lock all guest pages in host's
|
||||
+ * memory, although only those that are queued for transfer will be locked
|
||||
+ * at the same time.
|
||||
+ *
|
||||
+ * Since: 8.5.0
|
||||
+ */
|
||||
+ VIR_MIGRATE_ZEROCOPY = (1 << 20),
|
||||
} virDomainMigrateFlags;
|
||||
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
From ee1ce580f5373070e4b6a50d1ae4a3218c737a72 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ee1ce580f5373070e4b6a50d1ae4a3218c737a72@dist-git>
|
||||
From: Martin Kletzander <mkletzan@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 12:37:37 +0100
|
||||
Subject: [PATCH] Make systemd unit ordering more robust
|
||||
|
||||
Since libvirt-guests script/service can operate on various URIs and we do
|
||||
support both socket activation and traditional services, the ordering should be
|
||||
specified for all the possible sockets and services.
|
||||
|
||||
Also remove the Wants= dependency since do not want to start any service. We
|
||||
cannot know which one libvirt-guests is configured, so we'd have to start all
|
||||
the daemons which would break if unused colliding services are not
|
||||
masked (libvirtd.service in the modular case and all the modular daemon service
|
||||
units in the monolithic scenario). Fortunately we can assume that the system is
|
||||
configured properly to start services/sockets that are of interest to the user.
|
||||
That also works with the setup described in https://libvirt.org/daemons.html .
|
||||
|
||||
To make it even more robust we add the daemon service into the machine units
|
||||
created for individual domains as it was missing there.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1868537
|
||||
|
||||
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 4e42686adef8b9e9266f0099ddcd25bc95c4ed43)
|
||||
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
---
|
||||
src/util/virsystemd.c | 8 ++++++--
|
||||
tools/libvirt-guests.service.in | 12 +++++++++++-
|
||||
2 files changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
|
||||
index a86d4c6bb9..f156c2f39a 100644
|
||||
--- a/src/util/virsystemd.c
|
||||
+++ b/src/util/virsystemd.c
|
||||
@@ -441,8 +441,10 @@ int virSystemdCreateMachine(const char *name,
|
||||
nicindexes, nnicindexes, sizeof(int));
|
||||
gprops = g_variant_new_parsed("[('Slice', <%s>),"
|
||||
" ('After', <['libvirtd.service']>),"
|
||||
+ " ('After', <['virt%sd.service']>),"
|
||||
" ('Before', <['virt-guest-shutdown.target']>)]",
|
||||
- slicename);
|
||||
+ slicename,
|
||||
+ drivername);
|
||||
message = g_variant_new("(s@ayssus@ai@a(sv))",
|
||||
name,
|
||||
guuid,
|
||||
@@ -489,8 +491,10 @@ int virSystemdCreateMachine(const char *name,
|
||||
uuid, 16, sizeof(unsigned char));
|
||||
gprops = g_variant_new_parsed("[('Slice', <%s>),"
|
||||
" ('After', <['libvirtd.service']>),"
|
||||
+ " ('After', <['virt%sd.service']>),"
|
||||
" ('Before', <['virt-guest-shutdown.target']>)]",
|
||||
- slicename);
|
||||
+ slicename,
|
||||
+ drivername);
|
||||
message = g_variant_new("(s@ayssus@a(sv))",
|
||||
name,
|
||||
guuid,
|
||||
diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
|
||||
index 1a9b233e11..3cf6476196 100644
|
||||
--- a/tools/libvirt-guests.service.in
|
||||
+++ b/tools/libvirt-guests.service.in
|
||||
@@ -1,10 +1,20 @@
|
||||
[Unit]
|
||||
Description=Suspend/Resume Running libvirt Guests
|
||||
-Wants=libvirtd.service
|
||||
Requires=virt-guest-shutdown.target
|
||||
After=network.target
|
||||
After=time-sync.target
|
||||
+After=libvirtd.socket
|
||||
+After=virtqemud.socket
|
||||
+After=virtlxcd.socket
|
||||
+After=virtvboxd.socket
|
||||
+After=virtvzd.socket
|
||||
+After=virtxend.socket
|
||||
After=libvirtd.service
|
||||
+After=virtqemud.service
|
||||
+After=virtlxcd.service
|
||||
+After=virtvboxd.service
|
||||
+After=virtvzd.service
|
||||
+After=virtxend.service
|
||||
After=virt-guest-shutdown.target
|
||||
Documentation=man:libvirt-guests(8)
|
||||
Documentation=https://libvirt.org
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
From f0d0a6a9701522eee013682eb0ef566ef7cdac61 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f0d0a6a9701522eee013682eb0ef566ef7cdac61@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 | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index a8401bac30..40fe9985e6 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -8767,8 +8767,19 @@ qemuDomainHasBuiltinIDE(const virDomainDef *def)
|
||||
bool
|
||||
qemuDomainNeedsFDC(const virDomainDef *def)
|
||||
{
|
||||
- /* all supported Q35 machines need explicit FDC */
|
||||
- return qemuDomainIsQ35(def);
|
||||
+ const char *p;
|
||||
+
|
||||
+ /* all supported Q35 machines need explicit FDC except for old RHEL-7
|
||||
+ * machine types */
|
||||
+ if (!qemuDomainIsQ35(def))
|
||||
+ return false;
|
||||
+
|
||||
+ if ((p = STRSKIP(def->os.machine, "pc-q35-")) &&
|
||||
+ (STRPREFIX(p, "rhel7.0.0") ||
|
||||
+ STRPREFIX(p, "rhel7.1.0")))
|
||||
+ return false;
|
||||
+
|
||||
+ return true;
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
From b2529d5ff3a18a2b0022da75431cea5bf037819e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b2529d5ff3a18a2b0022da75431cea5bf037819e@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 17:37:21 +0200
|
||||
Subject: [PATCH] RHEL: Enable usage of x-blockdev-reopen
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RHEL-only
|
||||
|
||||
Introduce a new capability QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API
|
||||
based on the presence of '__com.redhat_rhel-av-8_2_0-api' feature for
|
||||
'x-blockdev-reopen' which states that reopen works for what libvirt
|
||||
is going to use it and wire up code to call the x- prefixed command.
|
||||
|
||||
This implementation will become dormant once qemu starts supporting
|
||||
upstream-stable blockdev-reopen.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
|
||||
|
||||
Starting with libvirt-7.6, upstream has adapted to the new format of
|
||||
arguments so this patch was modified to support blockdev-reopen which
|
||||
takes an array of nodes to reopen.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1929765
|
||||
Message-Id: <3fcde2fc6add36d5276ae224caf18adc8bca7d48.1627486352.git.pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_block.c | 24 +++++++++++++++---------
|
||||
src/qemu/qemu_block.h | 3 ++-
|
||||
src/qemu/qemu_capabilities.c | 13 +++++++++++++
|
||||
src/qemu/qemu_capabilities.h | 3 +++
|
||||
src/qemu/qemu_monitor.c | 5 +++--
|
||||
src/qemu/qemu_monitor.h | 3 ++-
|
||||
src/qemu/qemu_monitor_json.c | 12 +++++++++---
|
||||
src/qemu/qemu_monitor_json.h | 3 ++-
|
||||
tests/qemumonitorjsontest.c | 2 +-
|
||||
9 files changed, 50 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
|
||||
index e5ff653a60..aa566d0097 100644
|
||||
--- a/src/qemu/qemu_block.c
|
||||
+++ b/src/qemu/qemu_block.c
|
||||
@@ -3331,7 +3331,8 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
|
||||
|
||||
int
|
||||
qemuBlockReopenFormatMon(qemuMonitor *mon,
|
||||
- virStorageSource *src)
|
||||
+ virStorageSource *src,
|
||||
+ bool downstream)
|
||||
{
|
||||
g_autoptr(virJSONValue) reopenprops = NULL;
|
||||
g_autoptr(virJSONValue) srcprops = NULL;
|
||||
@@ -3340,15 +3341,19 @@ qemuBlockReopenFormatMon(qemuMonitor *mon,
|
||||
if (!(srcprops = qemuBlockStorageSourceGetBlockdevProps(src, src->backingStore)))
|
||||
return -1;
|
||||
|
||||
- if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
|
||||
- return -1;
|
||||
+ if (downstream) {
|
||||
+ reopenprops = g_steal_pointer(&srcprops);
|
||||
+ } else {
|
||||
+ if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
|
||||
+ return -1;
|
||||
|
||||
- if (virJSONValueObjectAdd(&reopenprops,
|
||||
- "a:options", &reopenoptions,
|
||||
- NULL) < 0)
|
||||
- return -1;
|
||||
+ if (virJSONValueObjectAdd(&reopenprops,
|
||||
+ "a:options", &reopenoptions,
|
||||
+ NULL) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0)
|
||||
+ if (qemuMonitorBlockdevReopen(mon, &reopenprops, downstream) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -3372,6 +3377,7 @@ qemuBlockReopenFormat(virDomainObj *vm,
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
virQEMUDriver *driver = priv->driver;
|
||||
+ bool downstream = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API);
|
||||
int rc;
|
||||
|
||||
/* If we are lacking the object here, qemu might have opened an image with
|
||||
@@ -3385,7 +3391,7 @@ qemuBlockReopenFormat(virDomainObj *vm,
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return -1;
|
||||
|
||||
- rc = qemuBlockReopenFormatMon(priv->mon, src);
|
||||
+ rc = qemuBlockReopenFormatMon(priv->mon, src, downstream);
|
||||
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
if (rc < 0)
|
||||
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
|
||||
index 184a549d5c..130cfcdefd 100644
|
||||
--- a/src/qemu/qemu_block.h
|
||||
+++ b/src/qemu/qemu_block.h
|
||||
@@ -267,7 +267,8 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *topsrc,
|
||||
/* only for use in qemumonitorjsontest */
|
||||
int
|
||||
qemuBlockReopenFormatMon(qemuMonitor *mon,
|
||||
- virStorageSource *src);
|
||||
+ virStorageSource *src,
|
||||
+ bool downstream);
|
||||
|
||||
int
|
||||
qemuBlockReopenReadWrite(virDomainObj *vm,
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 5f1eb5014c..8ae80ef8d7 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -654,6 +654,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
|
||||
"rbd-encryption", /* QEMU_CAPS_RBD_ENCRYPTION */
|
||||
"sev-guest-kernel-hashes", /* QEMU_CAPS_SEV_GUEST_KERNEL_HASHES */
|
||||
"sev-inject-launch-secret", /* QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET */
|
||||
+
|
||||
+ /* 420 */
|
||||
+ "blockdev-reopen.__com.redhat_rhel-av-8_2_0-api", /* QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API */
|
||||
);
|
||||
|
||||
|
||||
@@ -1540,6 +1543,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVhostUserFS[] =
|
||||
/* see documentation for virQEMUQAPISchemaPathGet for the query format */
|
||||
static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
|
||||
{ "block-commit/arg-type/*top", QEMU_CAPS_ACTIVE_COMMIT },
|
||||
+ { "x-blockdev-reopen/$__com.redhat_rhel-av-8_2_0-api", QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API },
|
||||
{ "blockdev-add/arg-type/options/+gluster/debug-level", QEMU_CAPS_GLUSTER_DEBUG_LEVEL},
|
||||
{ "blockdev-add/arg-type/+gluster/debug", QEMU_CAPS_GLUSTER_DEBUG_LEVEL},
|
||||
{ "blockdev-add/arg-type/+vxhs", QEMU_CAPS_VXHS},
|
||||
@@ -5235,6 +5239,15 @@ virQEMUCapsInitProcessCaps(virQEMUCaps *qemuCaps)
|
||||
qemuCaps->arch == VIR_ARCH_MIPS)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SCSI_NCR53C90);
|
||||
|
||||
+ /* RHEL-only:
|
||||
+ * - if upstream blockdev-reopen is enabled, clear the downstream flag
|
||||
+ * - if the downstream flag is present but not the upstream, assert the upstream flag too
|
||||
+ */
|
||||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
|
||||
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API);
|
||||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API))
|
||||
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN);
|
||||
+
|
||||
virQEMUCapsInitProcessCapsInterlock(qemuCaps);
|
||||
}
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index e3a3ab4445..cde6c18b4c 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -634,6 +634,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
|
||||
QEMU_CAPS_SEV_GUEST_KERNEL_HASHES, /* sev-guest.kernel-hashes= */
|
||||
QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET, /* 'sev-inject-launch-secret' qmp command present */
|
||||
|
||||
+ /* 420 */
|
||||
+ QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API, /* downstream support for blockdev reopen in rhel-av-8.2.0 */
|
||||
+
|
||||
QEMU_CAPS_LAST /* this must always be the last item */
|
||||
} virQEMUCapsFlags;
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
||||
index babf9e62fb..23638d3fe8 100644
|
||||
--- a/src/qemu/qemu_monitor.c
|
||||
+++ b/src/qemu/qemu_monitor.c
|
||||
@@ -4247,14 +4247,15 @@ qemuMonitorBlockdevAdd(qemuMonitor *mon,
|
||||
|
||||
int
|
||||
qemuMonitorBlockdevReopen(qemuMonitor *mon,
|
||||
- virJSONValue **props)
|
||||
+ virJSONValue **props,
|
||||
+ bool downstream)
|
||||
{
|
||||
VIR_DEBUG("props=%p (node-name=%s)", *props,
|
||||
NULLSTR(virJSONValueObjectGetString(*props, "node-name")));
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
- return qemuMonitorJSONBlockdevReopen(mon, props);
|
||||
+ return qemuMonitorJSONBlockdevReopen(mon, props, downstream);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
||||
index 9b2e4e1421..d2037914be 100644
|
||||
--- a/src/qemu/qemu_monitor.h
|
||||
+++ b/src/qemu/qemu_monitor.h
|
||||
@@ -1426,7 +1426,8 @@ int qemuMonitorBlockdevAdd(qemuMonitor *mon,
|
||||
virJSONValue **props);
|
||||
|
||||
int qemuMonitorBlockdevReopen(qemuMonitor *mon,
|
||||
- virJSONValue **props);
|
||||
+ virJSONValue **props,
|
||||
+ bool downstream);
|
||||
|
||||
int qemuMonitorBlockdevDel(qemuMonitor *mon,
|
||||
const char *nodename);
|
||||
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
||||
index b0b513683b..34a46b9b41 100644
|
||||
--- a/src/qemu/qemu_monitor_json.c
|
||||
+++ b/src/qemu/qemu_monitor_json.c
|
||||
@@ -8051,13 +8051,19 @@ qemuMonitorJSONBlockdevAdd(qemuMonitor *mon,
|
||||
|
||||
int
|
||||
qemuMonitorJSONBlockdevReopen(qemuMonitor *mon,
|
||||
- virJSONValue **props)
|
||||
+ virJSONValue **props,
|
||||
+ bool downstream)
|
||||
{
|
||||
g_autoptr(virJSONValue) cmd = NULL;
|
||||
g_autoptr(virJSONValue) reply = NULL;
|
||||
|
||||
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", props)))
|
||||
- return -1;
|
||||
+ if (downstream) {
|
||||
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("x-blockdev-reopen", props)))
|
||||
+ return -1;
|
||||
+ } else {
|
||||
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", props)))
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
return -1;
|
||||
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
|
||||
index 64d9ebdaa3..15ce03d7af 100644
|
||||
--- a/src/qemu/qemu_monitor_json.h
|
||||
+++ b/src/qemu/qemu_monitor_json.h
|
||||
@@ -748,7 +748,8 @@ qemuMonitorJSONBlockdevAdd(qemuMonitor *mon,
|
||||
|
||||
int
|
||||
qemuMonitorJSONBlockdevReopen(qemuMonitor *mon,
|
||||
- virJSONValue **props)
|
||||
+ virJSONValue **props,
|
||||
+ bool downstream)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
int
|
||||
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
|
||||
index 48e2a457ab..8624a547b5 100644
|
||||
--- a/tests/qemumonitorjsontest.c
|
||||
+++ b/tests/qemumonitorjsontest.c
|
||||
@@ -2780,7 +2780,7 @@ testQemuMonitorJSONBlockdevReopen(const void *opaque)
|
||||
if (qemuMonitorTestAddItem(test, "blockdev-reopen", "{\"return\":{}}") < 0)
|
||||
return -1;
|
||||
|
||||
- if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src) < 0)
|
||||
+ if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src, false) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
From 16b9ab85b004308e1d99db4ed4769a5fa56e2dfa Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <16b9ab85b004308e1d99db4ed4769a5fa56e2dfa@dist-git>
|
||||
From 29eb7b77805cf5fb756c964cdbe7fb7fb2c01f5f Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <29eb7b77805cf5fb756c964cdbe7fb7fb2c01f5f@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Mon, 27 Aug 2018 13:09:38 +0200
|
||||
Subject: [PATCH] RHEL: Fix virConnectGetMaxVcpus output
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
From 1d93a3944a200b7c955800faa598e0e11da098f8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <1d93a3944a200b7c955800faa598e0e11da098f8@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 | 22 +++++++++++++++++++
|
||||
tests/qemuxml2argvdata/cpu-Haswell.args | 2 +-
|
||||
.../qemuxml2argvdata/cpu-host-model-cmt.args | 2 +-
|
||||
.../cpu-translation.x86_64-4.0.0.args | 2 +-
|
||||
.../cpu-translation.x86_64-latest.args | 2 +-
|
||||
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 +-
|
||||
9 files changed, 30 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index d822533ccb..6b4647a711 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -6521,6 +6521,8 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
|
||||
{
|
||||
size_t i;
|
||||
virCPUDef *cpu = def->cpu;
|
||||
+ bool hle = false;
|
||||
+ bool rtm = false;
|
||||
|
||||
switch ((virCPUMode) cpu->mode) {
|
||||
case VIR_CPU_MODE_HOST_PASSTHROUGH:
|
||||
@@ -6587,6 +6589,12 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
|
||||
for (i = 0; i < cpu->nfeatures; i++) {
|
||||
const char *featname =
|
||||
virQEMUCapsCPUFeatureToQEMU(qemuCaps, cpu->features[i].name);
|
||||
+
|
||||
+ 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:
|
||||
@@ -6604,6 +6612,20 @@ qemuBuildCpuModelArgStr(virQEMUDriver *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)
|
||||
+ virBufferAddLit(buf, ",rtm=on");
|
||||
+ if (!hle)
|
||||
+ virBufferAddLit(buf, ",hle=on");
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/cpu-Haswell.args b/tests/qemuxml2argvdata/cpu-Haswell.args
|
||||
index b57fdfddc5..965274c1f0 100644
|
||||
--- a/tests/qemuxml2argvdata/cpu-Haswell.args
|
||||
+++ b/tests/qemuxml2argvdata/cpu-Haswell.args
|
||||
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
-machine pc,usb=off,dump-guest-core=off \
|
||||
-accel kvm \
|
||||
--cpu Haswell \
|
||||
+-cpu Haswell,rtm=on,hle=on \
|
||||
-m 214 \
|
||||
-realtime mlock=off \
|
||||
-smp 6,sockets=6,cores=1,threads=1 \
|
||||
diff --git a/tests/qemuxml2argvdata/cpu-host-model-cmt.args b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
||||
index 0de04e877d..602f70de86 100644
|
||||
--- a/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
||||
+++ b/tests/qemuxml2argvdata/cpu-host-model-cmt.args
|
||||
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
-machine pc,usb=off,dump-guest-core=off \
|
||||
-accel tcg \
|
||||
--cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on \
|
||||
+-cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,rtm=on,hle=on \
|
||||
-m 214 \
|
||||
-realtime mlock=off \
|
||||
-smp 6,sockets=6,cores=1,threads=1 \
|
||||
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
|
||||
index 09141106d5..ace08d5d76 100644
|
||||
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
|
||||
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args
|
||||
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
-machine pc-i440fx-4.0,usb=off,dump-guest-core=off \
|
||||
-accel tcg \
|
||||
--cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
|
||||
+-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
|
||||
-m 214 \
|
||||
-overcommit mem-lock=off \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
||||
index 2dab572a6b..a9f7c4b910 100644
|
||||
--- a/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
||||
+++ b/tests/qemuxml2argvdata/cpu-translation.x86_64-latest.args
|
||||
@@ -12,7 +12,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
||||
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
|
||||
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
|
||||
-accel tcg \
|
||||
--cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
|
||||
+-cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,rtm=on,hle=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \
|
||||
-m 214 \
|
||||
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
|
||||
-overcommit mem-lock=off \
|
||||
diff --git a/tests/qemuxml2argvdata/cpu-tsc-frequency.args b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
||||
index 4a032f5d85..48fb75abcc 100644
|
||||
--- a/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
||||
+++ b/tests/qemuxml2argvdata/cpu-tsc-frequency.args
|
||||
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||
-machine pc,usb=off,dump-guest-core=off \
|
||||
-accel kvm \
|
||||
--cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,invtsc=on,tsc-frequency=4567890000 \
|
||||
+-cpu Haswell,vme=on,ds=on,acpi=on,ss=on,ht=on,tm=on,pbe=on,dtes64=on,monitor=on,ds-cpl=on,vmx=on,smx=on,est=on,tm2=on,xtpr=on,pdcm=on,f16c=on,rdrand=on,pdpe1gb=on,abm=on,lahf-lm=on,invtsc=on,rtm=on,hle=on,tsc-frequency=4567890000 \
|
||||
-m 214 \
|
||||
-realtime mlock=off \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
diff --git a/tests/qemuxml2argvdata/q35-acpi-nouefi.args b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
||||
index 3faee48c77..a1f742712d 100644
|
||||
--- a/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
||||
+++ b/tests/qemuxml2argvdata/q35-acpi-nouefi.args
|
||||
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
|
||||
-machine q35,usb=off,dump-guest-core=off \
|
||||
-accel tcg \
|
||||
--cpu Haswell \
|
||||
+-cpu Haswell,rtm=on,hle=on \
|
||||
-m 1024 \
|
||||
-realtime mlock=off \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
diff --git a/tests/qemuxml2argvdata/q35-acpi-uefi.args b/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
||||
index 60da1e282a..620056223a 100644
|
||||
--- a/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
||||
+++ b/tests/qemuxml2argvdata/q35-acpi-uefi.args
|
||||
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
|
||||
-machine q35,usb=off,dump-guest-core=off \
|
||||
-accel tcg \
|
||||
--cpu Haswell \
|
||||
+-cpu Haswell,rtm=on,hle=on \
|
||||
-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,unit=1 \
|
||||
-m 1024 \
|
||||
diff --git a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
||||
index 14e5bbc22a..ea66536c2a 100644
|
||||
--- a/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
||||
+++ b/tests/qemuxml2argvdata/q35-noacpi-nouefi.args
|
||||
@@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=none \
|
||||
-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-guest/master-key.aes \
|
||||
-machine q35,usb=off,dump-guest-core=off \
|
||||
-accel tcg \
|
||||
--cpu Haswell \
|
||||
+-cpu Haswell,rtm=on,hle=on \
|
||||
-m 1024 \
|
||||
-realtime mlock=off \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
From b550b671bace6d979a0763a837ce97ddf72e8fc8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b550b671bace6d979a0763a837ce97ddf72e8fc8@dist-git>
|
||||
From: Martin Kletzander <mkletzan@redhat.com>
|
||||
Date: Fri, 28 Jan 2022 20:33:12 +0100
|
||||
Subject: [PATCH] RHEL: Remove <glib-2.64.0 workaround for GSource race
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2045879
|
||||
|
||||
This is to accommodate for RHEL 8 downstream glib being fixed with a backport in
|
||||
version 2.56.4-12 (Bug 1948988). Another reason for that is that our workaround
|
||||
does not play nice with a fixed glib, leading to libvirt not properly
|
||||
dereferencing the monitor socket, eventually leading to EMFILE: Too many open
|
||||
files.
|
||||
|
||||
RHEL-only
|
||||
|
||||
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
---
|
||||
src/util/glibcompat.c | 46 ++++++++-----------------------------------
|
||||
1 file changed, 8 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/src/util/glibcompat.c b/src/util/glibcompat.c
|
||||
index eb6dcc0111..bf890f10d2 100644
|
||||
--- a/src/util/glibcompat.c
|
||||
+++ b/src/util/glibcompat.c
|
||||
@@ -212,51 +212,21 @@ vir_g_strdup_vprintf(const char *msg, va_list args)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
- * If the last reference to a GSource is released in a non-main
|
||||
- * thread we're exposed to a race condition that causes a
|
||||
- * crash:
|
||||
- *
|
||||
- * https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1358
|
||||
+ * This is a leftover of a hack that works around glib older than 2.64.0, but
|
||||
+ * the fix in glib as backported in RHEL-8 to glib2-2.56.4-12 in BZ 1948988:
|
||||
*
|
||||
- * Thus we're using an idle func to release our ref...
|
||||
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1948988
|
||||
*
|
||||
- * ...but this imposes a significant performance penalty on
|
||||
- * I/O intensive workloads which are sensitive to the iterations
|
||||
- * of the event loop, so avoid the workaround if we know we have
|
||||
- * new enough glib.
|
||||
+ * and our workaround coupled with that glib fix started causing leaks, which
|
||||
+ * surfaced with us not unreferencing the qemu monitor socket in BZ 2045879:
|
||||
*
|
||||
- * The function below is used from a header file definition.
|
||||
+ * https://bugzilla.redhat.com/show_bug.cgi?id=2045879
|
||||
*
|
||||
- * Drop when min glib >= 2.64.0
|
||||
+ * Keeping this wrapper makes it easier to follow with other backports without
|
||||
+ * conflicts in callers due to the function name change.
|
||||
*/
|
||||
-#if GLIB_CHECK_VERSION(2, 64, 0)
|
||||
void vir_g_source_unref(GSource *src, GMainContext *ctx G_GNUC_UNUSED)
|
||||
{
|
||||
g_source_unref(src);
|
||||
}
|
||||
-#else
|
||||
-
|
||||
-static gboolean
|
||||
-virEventGLibSourceUnrefIdle(gpointer data)
|
||||
-{
|
||||
- GSource *src = data;
|
||||
-
|
||||
- g_source_unref(src);
|
||||
-
|
||||
- return FALSE;
|
||||
-}
|
||||
-
|
||||
-void vir_g_source_unref(GSource *src, GMainContext *ctx)
|
||||
-{
|
||||
- GSource *idle = g_idle_source_new();
|
||||
-
|
||||
- g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL);
|
||||
-
|
||||
- g_source_attach(idle, ctx);
|
||||
-
|
||||
- g_source_unref(idle);
|
||||
-}
|
||||
-
|
||||
-#endif
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
From d6956a1aaa8757fab60132c3ee46c2bb199a78a8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d6956a1aaa8757fab60132c3ee46c2bb199a78a8@dist-git>
|
||||
From: John Ferlan <jferlan@redhat.com>
|
||||
Date: Mon, 17 Dec 2018 20:42:30 -0500
|
||||
Subject: [PATCH] RHEL: qemu: Add ability to set sgio values for hostdev
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1582424
|
||||
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_conf.c | 25 ++++++++++++++++---------
|
||||
1 file changed, 16 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index 6077457ff4..ba85fc6e22 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1841,8 +1841,9 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
|
||||
virDomainDiskDef *disk = NULL;
|
||||
virDomainHostdevDef *hostdev = NULL;
|
||||
g_autofree char *sysfs_path = NULL;
|
||||
+ g_autofree char *hostdev_path = NULL;
|
||||
const char *path = NULL;
|
||||
- int val = -1;
|
||||
+ int val = 0;
|
||||
|
||||
/* "sgio" is only valid for block disk; cdrom
|
||||
* and floopy disk can have empty source.
|
||||
@@ -1858,17 +1859,14 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
|
||||
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
|
||||
hostdev = dev->data.hostdev;
|
||||
|
||||
- if (!qemuIsSharedHostdev(hostdev))
|
||||
+ if (hostdev->source.subsys.u.scsi.protocol ==
|
||||
+ VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
|
||||
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)))
|
||||
return -1;
|
||||
- }
|
||||
|
||||
- return 0;
|
||||
+ path = hostdev_path;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -1877,7 +1875,16 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
|
||||
return -1;
|
||||
|
||||
/* 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) {
|
||||
+ if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
|
||||
+ val = 1;
|
||||
+ } else {
|
||||
+ /* Only settable if <shareable/> was present for hostdev */
|
||||
+ if (qemuIsSharedHostdev(hostdev) &&
|
||||
+ hostdev->source.subsys.u.scsi.sgio ==
|
||||
+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
|
||||
+ val = 1;
|
||||
+ }
|
||||
|
||||
/* 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
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
From f562b4c83d342002291f6bd7c5776eaecbd3147f Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f562b4c83d342002291f6bd7c5776eaecbd3147f@dist-git>
|
||||
From: John Ferlan <jferlan@redhat.com>
|
||||
Date: Mon, 17 Dec 2018 20:42:31 -0500
|
||||
Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host
|
||||
device
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1582424
|
||||
|
||||
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: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_conf.c | 20 ++++++++++++++++++--
|
||||
1 file changed, 18 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index ba85fc6e22..28c334761b 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1749,13 +1749,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriver *driver,
|
||||
{
|
||||
g_autofree char *dev_path = NULL;
|
||||
g_autofree char *key = NULL;
|
||||
+ virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
|
||||
+ virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
|
||||
int ret = -1;
|
||||
|
||||
if (!qemuIsSharedHostdev(hostdev))
|
||||
return 0;
|
||||
|
||||
- if (!(dev_path = qemuGetHostdevPath(hostdev)) ||
|
||||
- !(key = qemuGetSharedDeviceKey(dev_path)))
|
||||
+ if (!(dev_path = qemuGetHostdevPath(hostdev)))
|
||||
+ return -1;
|
||||
+
|
||||
+ 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);
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!(key = qemuGetSharedDeviceKey(dev_path)))
|
||||
return -1;
|
||||
|
||||
qemuDriverLock(driver);
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
From b6c1f9ca8eb0ca8f7603ab205c7dc95b9f07b5a0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b6c1f9ca8eb0ca8f7603ab205c7dc95b9f07b5a0@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Mon, 18 Jul 2022 16:01:20 +0200
|
||||
Subject: [PATCH] RHEL: qemu_migration: Fix restoring memlock limit on
|
||||
destination
|
||||
|
||||
Restoring memory locking limit on the destination host only makes sense
|
||||
when migration succeeded as otherwise the QEMU process will be killed
|
||||
anyway. Specifically if the migration fails because the process died,
|
||||
touching the limit would produce rather unhelpful error message instead
|
||||
of the real issue:
|
||||
|
||||
cannot get locked memory limit of process -1: No such file or
|
||||
directory
|
||||
|
||||
This patch is RHEL-only caused by misplacing the call to
|
||||
qemuDomainSetMaxMemLock when the "qemu_migration: Restore original
|
||||
memory locking limit" upstream patch was backported to an older code
|
||||
base.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2107954
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_migration.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||||
index db5163e993..11f87296d6 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -5895,6 +5895,8 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
|
||||
*/
|
||||
if (inPostCopy)
|
||||
g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree);
|
||||
+
|
||||
+ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
|
||||
}
|
||||
|
||||
qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
|
||||
@@ -5907,7 +5909,6 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
|
||||
cleanup:
|
||||
g_clear_pointer(&jobInfo, qemuDomainJobInfoFree);
|
||||
virPortAllocatorRelease(port);
|
||||
- qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
|
||||
if (priv->mon)
|
||||
qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL);
|
||||
VIR_FREE(priv->origname);
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
From 9c5daeb8c99ca12a66387de448f585742887fd75 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <9c5daeb8c99ca12a66387de448f585742887fd75@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:52:21 +0100
|
||||
Subject: [PATCH] RHEL: virscsi: Check device type before getting it's /dev
|
||||
node name
|
||||
|
||||
Not all SCSI devices are block devices, therefore
|
||||
/sys/bus/scsi/devices/X:X:X:X/block/ directory does not always
|
||||
exist. Check if the SCSI device is a block device beforehand.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1808390
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145226.1610708-2-abologna@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/util/virscsi.c | 140 ++++++++++++++++++++++++++++++---
|
||||
tests/virscsidata/0-0-0-0/type | 1 +
|
||||
tests/virscsidata/1-0-0-0/type | 1 +
|
||||
3 files changed, 131 insertions(+), 11 deletions(-)
|
||||
create mode 100644 tests/virscsidata/0-0-0-0/type
|
||||
create mode 100644 tests/virscsidata/1-0-0-0/type
|
||||
|
||||
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
|
||||
index 6a90d9002f..770f727cac 100644
|
||||
--- a/src/util/virscsi.c
|
||||
+++ b/src/util/virscsi.c
|
||||
@@ -47,6 +47,32 @@ struct _virUsedByInfo {
|
||||
};
|
||||
typedef struct _virUsedByInfo virUsedByInfo;
|
||||
|
||||
+
|
||||
+/* Keep in sync with scsi/scsi_proto.h */
|
||||
+typedef enum {
|
||||
+ VIR_SCSI_DEVICE_TYPE_NONE = -1,
|
||||
+ VIR_SCSI_DEVICE_TYPE_DISK = 0x00,
|
||||
+ VIR_SCSI_DEVICE_TYPE_TAPE = 0x01,
|
||||
+ VIR_SCSI_DEVICE_TYPE_PRINTER = 0x02,
|
||||
+ VIR_SCSI_DEVICE_TYPE_PROCESSOR = 0x03,
|
||||
+ VIR_SCSI_DEVICE_TYPE_WORM = 0x04,
|
||||
+ VIR_SCSI_DEVICE_TYPE_ROM = 0x05,
|
||||
+ VIR_SCSI_DEVICE_TYPE_SCANNER = 0x06,
|
||||
+ VIR_SCSI_DEVICE_TYPE_MOD = 0x07,
|
||||
+ VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER = 0x08,
|
||||
+ VIR_SCSI_DEVICE_TYPE_COMM = 0x09,
|
||||
+ VIR_SCSI_DEVICE_TYPE_RAID = 0x0c,
|
||||
+ VIR_SCSI_DEVICE_TYPE_ENCLOSURE = 0x0d,
|
||||
+ VIR_SCSI_DEVICE_TYPE_RBC = 0x0e,
|
||||
+ VIR_SCSI_DEVICE_TYPE_OSD = 0x11,
|
||||
+ VIR_SCSI_DEVICE_TYPE_ZBC = 0x14,
|
||||
+ VIR_SCSI_DEVICE_TYPE_WLUN = 0x1e,
|
||||
+ VIR_SCSI_DEVICE_TYPE_NO_LUN = 0x7f,
|
||||
+
|
||||
+ VIR_SCSI_DEVICE_TYPE_LAST,
|
||||
+} virSCSIDeviceType;
|
||||
+
|
||||
+
|
||||
struct _virSCSIDevice {
|
||||
unsigned int adapter;
|
||||
unsigned int bus;
|
||||
@@ -126,6 +152,78 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+
|
||||
+static int
|
||||
+virSCSIDeviceGetType(const char *prefix,
|
||||
+ unsigned int adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit,
|
||||
+ virSCSIDeviceType *type)
|
||||
+{
|
||||
+ int intType;
|
||||
+
|
||||
+ if (virFileReadValueInt(&intType,
|
||||
+ "%s/%d:%u:%u:%llu/type",
|
||||
+ prefix, adapter, bus, target, unit) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ switch (intType) {
|
||||
+ case VIR_SCSI_DEVICE_TYPE_DISK:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_TAPE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_PRINTER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_PROCESSOR:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_WORM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ROM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_SCANNER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_MOD:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_COMM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_RAID:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ENCLOSURE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_RBC:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_OSD:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ZBC:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_WLUN:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_NO_LUN:
|
||||
+ *type = intType;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("unknown SCSI device type: %x"),
|
||||
+ intType);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static char *
|
||||
+virSCSIDeviceGetDevNameBlock(const char *prefix,
|
||||
+ unsigned int adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit)
|
||||
+{
|
||||
+ g_autoptr(DIR) dir = NULL;
|
||||
+ struct dirent *entry;
|
||||
+ g_autofree char *path = NULL;
|
||||
+
|
||||
+ path = g_strdup_printf("%s/%d:%u:%u:%llu/block",
|
||||
+ prefix, adapter, bus, target, unit);
|
||||
+
|
||||
+ if (virDirOpen(&dir, path) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (virDirRead(dir, &entry, path) > 0)
|
||||
+ return g_strdup(entry->d_name);
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Returns device name (e.g. "sdc") on success, or NULL
|
||||
* on failure.
|
||||
*/
|
||||
@@ -136,25 +234,45 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
||||
unsigned int target,
|
||||
unsigned long long unit)
|
||||
{
|
||||
- g_autoptr(DIR) dir = NULL;
|
||||
- struct dirent *entry;
|
||||
- g_autofree char *path = NULL;
|
||||
unsigned int adapter_id;
|
||||
+ virSCSIDeviceType type;
|
||||
const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES;
|
||||
|
||||
if (virSCSIDeviceGetAdapterId(adapter, &adapter_id) < 0)
|
||||
return NULL;
|
||||
|
||||
- path = g_strdup_printf("%s/%d:%u:%u:%llu/block", prefix, adapter_id, bus,
|
||||
- target, unit);
|
||||
-
|
||||
- if (virDirOpen(&dir, path) < 0)
|
||||
+ if (virSCSIDeviceGetType(prefix, adapter_id,
|
||||
+ bus, target, unit, &type) < 0)
|
||||
return NULL;
|
||||
|
||||
- if (virDirRead(dir, &entry, path) > 0)
|
||||
- return g_strdup(entry->d_name);
|
||||
-
|
||||
- return NULL;
|
||||
+ switch (type) {
|
||||
+ case VIR_SCSI_DEVICE_TYPE_DISK:
|
||||
+ return virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit);
|
||||
+
|
||||
+ case VIR_SCSI_DEVICE_TYPE_TAPE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_PRINTER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_PROCESSOR:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_WORM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ROM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_SCANNER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_MOD:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_MEDIUM_CHANGER:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_COMM:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_RAID:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ENCLOSURE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_RBC:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_OSD:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_ZBC:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_WLUN:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_NO_LUN:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_NONE:
|
||||
+ case VIR_SCSI_DEVICE_TYPE_LAST:
|
||||
+ default:
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("unsupported SCSI device type: %x"),
|
||||
+ type);
|
||||
+ return NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
virSCSIDevice *
|
||||
diff --git a/tests/virscsidata/0-0-0-0/type b/tests/virscsidata/0-0-0-0/type
|
||||
new file mode 100644
|
||||
index 0000000000..573541ac97
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/0-0-0-0/type
|
||||
@@ -0,0 +1 @@
|
||||
+0
|
||||
diff --git a/tests/virscsidata/1-0-0-0/type b/tests/virscsidata/1-0-0-0/type
|
||||
new file mode 100644
|
||||
index 0000000000..573541ac97
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/1-0-0-0/type
|
||||
@@ -0,0 +1 @@
|
||||
+0
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
From 1ce4faffcd4616bbcea4d198c3f60cbcfddd784e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <1ce4faffcd4616bbcea4d198c3f60cbcfddd784e@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:52:23 +0100
|
||||
Subject: [PATCH] RHEL: virscsi: Introduce and use
|
||||
virSCSIDeviceGetUnprivSGIOSysfsPath()
|
||||
|
||||
When constructing a path to the 'unpriv_sgio' file of given SCSI
|
||||
device we don't need to go through /dev/* and major() + minor()
|
||||
path. The generated path points to
|
||||
/sys/dev/block/MAJ:MIN/queue/unpriv_sgio which is wrong if the
|
||||
SCSI device in question is not a block device. We can generate a
|
||||
different path: /sys/bus/scsi/devices/X:X:X:X/unpriv_sgio where
|
||||
the file is directly accessible regardless of the SCSI device
|
||||
type.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1808390
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145226.1610708-4-abologna@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/qemu/qemu_conf.c | 31 +++++++++++++++++++------------
|
||||
src/util/virscsi.c | 19 +++++++++++++++++++
|
||||
src/util/virscsi.h | 5 +++++
|
||||
src/util/virutil.c | 24 ++++++------------------
|
||||
src/util/virutil.h | 2 --
|
||||
6 files changed, 50 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 5b76e66e61..2c42e2a5e8 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -3191,6 +3191,7 @@ virSCSIDeviceGetSgName;
|
||||
virSCSIDeviceGetShareable;
|
||||
virSCSIDeviceGetTarget;
|
||||
virSCSIDeviceGetUnit;
|
||||
+virSCSIDeviceGetUnprivSGIOSysfsPath;
|
||||
virSCSIDeviceIsAvailable;
|
||||
virSCSIDeviceListAdd;
|
||||
virSCSIDeviceListCount;
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index 28c334761b..a0b8076d6b 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -1506,7 +1506,7 @@ qemuCheckUnprivSGIO(GHashTable *sharedDevices,
|
||||
if (!(virHashLookup(sharedDevices, key)))
|
||||
return 0;
|
||||
|
||||
- if (virGetDeviceUnprivSGIO(device_path, NULL, &val) < 0)
|
||||
+ if (virGetDeviceUnprivSGIO(sysfs_path, &val) < 0)
|
||||
return -1;
|
||||
|
||||
/* Error message on failure needs to be handled in caller
|
||||
@@ -1857,39 +1857,46 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
|
||||
virDomainDiskDef *disk = NULL;
|
||||
virDomainHostdevDef *hostdev = NULL;
|
||||
g_autofree char *sysfs_path = NULL;
|
||||
- g_autofree char *hostdev_path = NULL;
|
||||
- const char *path = NULL;
|
||||
int val = 0;
|
||||
|
||||
/* "sgio" is only valid for block disk; cdrom
|
||||
* and floopy disk can have empty source.
|
||||
*/
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
||||
+ const char *path;
|
||||
+
|
||||
disk = dev->data.disk;
|
||||
+ path = virDomainDiskGetSource(disk);
|
||||
|
||||
if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN ||
|
||||
!virStorageSourceIsBlockLocal(disk->src))
|
||||
return 0;
|
||||
|
||||
- path = virDomainDiskGetSource(disk);
|
||||
+ if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL)))
|
||||
+ return -1;
|
||||
+
|
||||
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
|
||||
+ virDomainHostdevSubsysSCSI *scsisrc;
|
||||
+ virDomainHostdevSubsysSCSIHost *scsihostsrc;
|
||||
+
|
||||
hostdev = dev->data.hostdev;
|
||||
+ scsisrc = &hostdev->source.subsys.u.scsi;
|
||||
+ scsihostsrc = &scsisrc->u.host;
|
||||
|
||||
if (hostdev->source.subsys.u.scsi.protocol ==
|
||||
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
|
||||
return 0;
|
||||
|
||||
- if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
|
||||
+ if (!(sysfs_path = virSCSIDeviceGetUnprivSGIOSysfsPath(NULL,
|
||||
+ scsihostsrc->adapter,
|
||||
+ scsihostsrc->bus,
|
||||
+ scsihostsrc->target,
|
||||
+ scsihostsrc->unit)))
|
||||
return -1;
|
||||
-
|
||||
- path = hostdev_path;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, NULL)))
|
||||
- return -1;
|
||||
-
|
||||
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
||||
if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
|
||||
@@ -1909,11 +1916,11 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
|
||||
if (virFileExists(sysfs_path) || val == 1) {
|
||||
int curr_val;
|
||||
|
||||
- if (virGetDeviceUnprivSGIO(path, NULL, &curr_val) < 0)
|
||||
+ if (virGetDeviceUnprivSGIO(sysfs_path, &curr_val) < 0)
|
||||
return -1;
|
||||
|
||||
if (curr_val != val &&
|
||||
- virSetDeviceUnprivSGIO(path, NULL, val) < 0) {
|
||||
+ virSetDeviceUnprivSGIO(sysfs_path, val) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
|
||||
index 6165196423..b437fdcac0 100644
|
||||
--- a/src/util/virscsi.c
|
||||
+++ b/src/util/virscsi.c
|
||||
@@ -302,6 +302,25 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
||||
}
|
||||
}
|
||||
|
||||
+
|
||||
+char *
|
||||
+virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix,
|
||||
+ const char *adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit)
|
||||
+{
|
||||
+ unsigned int adapter_id;
|
||||
+ const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_DEVICES;
|
||||
+
|
||||
+ if (virSCSIDeviceGetAdapterId(adapter, &adapter_id) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ return g_strdup_printf("%s/%d:%u:%u:%llu/unpriv_sgio",
|
||||
+ prefix, adapter_id, bus, target, unit);
|
||||
+}
|
||||
+
|
||||
+
|
||||
virSCSIDevice *
|
||||
virSCSIDeviceNew(const char *sysfs_prefix,
|
||||
const char *adapter,
|
||||
diff --git a/src/util/virscsi.h b/src/util/virscsi.h
|
||||
index 65ad15ed76..5721985939 100644
|
||||
--- a/src/util/virscsi.h
|
||||
+++ b/src/util/virscsi.h
|
||||
@@ -40,6 +40,11 @@ char *virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
||||
unsigned int bus,
|
||||
unsigned int target,
|
||||
unsigned long long unit);
|
||||
+char *virSCSIDeviceGetUnprivSGIOSysfsPath(const char *sysfs_prefix,
|
||||
+ const char *adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit);
|
||||
|
||||
virSCSIDevice *virSCSIDeviceNew(const char *sysfs_prefix,
|
||||
const char *adapter,
|
||||
diff --git a/src/util/virutil.c b/src/util/virutil.c
|
||||
index e04f1343d8..b1e37b45c5 100644
|
||||
--- a/src/util/virutil.c
|
||||
+++ b/src/util/virutil.c
|
||||
@@ -1377,18 +1377,13 @@ virGetUnprivSGIOSysfsPath(const char *path,
|
||||
|
||||
int
|
||||
virSetDeviceUnprivSGIO(const char *path,
|
||||
- const char *sysfs_dir,
|
||||
int unpriv_sgio)
|
||||
{
|
||||
- char *sysfs_path = NULL;
|
||||
char *val = NULL;
|
||||
int ret = -1;
|
||||
int rc;
|
||||
|
||||
- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir)))
|
||||
- return -1;
|
||||
-
|
||||
- if (!virFileExists(sysfs_path)) {
|
||||
+ if (!virFileExists(path)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("unpriv_sgio is not supported by this kernel"));
|
||||
goto cleanup;
|
||||
@@ -1396,38 +1391,32 @@ virSetDeviceUnprivSGIO(const char *path,
|
||||
|
||||
val = g_strdup_printf("%d", unpriv_sgio);
|
||||
|
||||
- if ((rc = virFileWriteStr(sysfs_path, val, 0)) < 0) {
|
||||
- virReportSystemError(-rc, _("failed to set %s"), sysfs_path);
|
||||
+ if ((rc = virFileWriteStr(path, val, 0)) < 0) {
|
||||
+ virReportSystemError(-rc, _("failed to set %s"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
- VIR_FREE(sysfs_path);
|
||||
VIR_FREE(val);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
virGetDeviceUnprivSGIO(const char *path,
|
||||
- const char *sysfs_dir,
|
||||
int *unpriv_sgio)
|
||||
{
|
||||
- char *sysfs_path = NULL;
|
||||
char *buf = NULL;
|
||||
char *tmp = NULL;
|
||||
int ret = -1;
|
||||
|
||||
- if (!(sysfs_path = virGetUnprivSGIOSysfsPath(path, sysfs_dir)))
|
||||
- return -1;
|
||||
-
|
||||
- if (!virFileExists(sysfs_path)) {
|
||||
+ if (!virFileExists(path)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("unpriv_sgio is not supported by this kernel"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (virFileReadAll(sysfs_path, 1024, &buf) < 0)
|
||||
+ if (virFileReadAll(path, 1024, &buf) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if ((tmp = strchr(buf, '\n')))
|
||||
@@ -1435,13 +1424,12 @@ virGetDeviceUnprivSGIO(const char *path,
|
||||
|
||||
if (virStrToLong_i(buf, NULL, 10, unpriv_sgio) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("failed to parse value of %s"), sysfs_path);
|
||||
+ _("failed to parse value of %s"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
- VIR_FREE(sysfs_path);
|
||||
VIR_FREE(buf);
|
||||
return ret;
|
||||
}
|
||||
diff --git a/src/util/virutil.h b/src/util/virutil.h
|
||||
index 854b494890..da267c6446 100644
|
||||
--- a/src/util/virutil.h
|
||||
+++ b/src/util/virutil.h
|
||||
@@ -120,10 +120,8 @@ int virGetDeviceID(const char *path,
|
||||
int *maj,
|
||||
int *min) G_GNUC_NO_INLINE;
|
||||
int virSetDeviceUnprivSGIO(const char *path,
|
||||
- const char *sysfs_dir,
|
||||
int unpriv_sgio);
|
||||
int virGetDeviceUnprivSGIO(const char *path,
|
||||
- const char *sysfs_dir,
|
||||
int *unpriv_sgio);
|
||||
char *virGetUnprivSGIOSysfsPath(const char *path,
|
||||
const char *sysfs_dir);
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,200 @@
|
|||
From 5b96a8773d33af9822f6b6ccddc8f372841895a6 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <5b96a8773d33af9822f6b6ccddc8f372841895a6@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:52:22 +0100
|
||||
Subject: [PATCH] RHEL: virscsi: Support TAPEs in virSCSIDeviceGetDevName()
|
||||
|
||||
If the SCSI device we want to get /dev node name for is TAPE
|
||||
device we need to look at 'tape' symlink in the sysfs dir
|
||||
corresponding to the device.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1808390
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145226.1610708-3-abologna@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/util/virscsi.c | 27 +++++++++++++++
|
||||
tests/virscsidata/2-0-0-0/model | 1 +
|
||||
tests/virscsidata/2-0-0-0/scsi_tape/st0/dev | 1 +
|
||||
tests/virscsidata/2-0-0-0/sg3/dev | 1 +
|
||||
tests/virscsidata/2-0-0-0/tape | 1 +
|
||||
tests/virscsidata/2-0-0-0/type | 1 +
|
||||
tests/virscsidata/2-0-0-0/vendor | 1 +
|
||||
tests/virscsidata/sg3 | 0
|
||||
tests/virscsitest.c | 38 ++++++++++++++++++---
|
||||
9 files changed, 66 insertions(+), 5 deletions(-)
|
||||
create mode 100644 tests/virscsidata/2-0-0-0/model
|
||||
create mode 100644 tests/virscsidata/2-0-0-0/scsi_tape/st0/dev
|
||||
create mode 100644 tests/virscsidata/2-0-0-0/sg3/dev
|
||||
create mode 120000 tests/virscsidata/2-0-0-0/tape
|
||||
create mode 100644 tests/virscsidata/2-0-0-0/type
|
||||
create mode 100644 tests/virscsidata/2-0-0-0/vendor
|
||||
create mode 100644 tests/virscsidata/sg3
|
||||
|
||||
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
|
||||
index 770f727cac..6165196423 100644
|
||||
--- a/src/util/virscsi.c
|
||||
+++ b/src/util/virscsi.c
|
||||
@@ -224,6 +224,31 @@ virSCSIDeviceGetDevNameBlock(const char *prefix,
|
||||
}
|
||||
|
||||
|
||||
+static char *
|
||||
+virSCSIDeviceGetDevNameTape(const char *prefix,
|
||||
+ unsigned int adapter,
|
||||
+ unsigned int bus,
|
||||
+ unsigned int target,
|
||||
+ unsigned long long unit)
|
||||
+{
|
||||
+ g_autofree char *path = NULL;
|
||||
+ g_autofree char *resolvedPath = NULL;
|
||||
+ g_autoptr(GError) err = NULL;
|
||||
+
|
||||
+ path = g_strdup_printf("%s/%d:%u:%u:%llu/tape",
|
||||
+ prefix, adapter, bus, target, unit);
|
||||
+
|
||||
+ if (!(resolvedPath = g_file_read_link(path, &err))) {
|
||||
+ virReportError(VIR_ERR_SYSTEM_ERROR,
|
||||
+ _("Unable to read link: %s"),
|
||||
+ err->message);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return g_path_get_basename(resolvedPath);
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Returns device name (e.g. "sdc") on success, or NULL
|
||||
* on failure.
|
||||
*/
|
||||
@@ -250,6 +275,8 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
||||
return virSCSIDeviceGetDevNameBlock(prefix, adapter_id, bus, target, unit);
|
||||
|
||||
case VIR_SCSI_DEVICE_TYPE_TAPE:
|
||||
+ return virSCSIDeviceGetDevNameTape(prefix, adapter_id, bus, target, unit);
|
||||
+
|
||||
case VIR_SCSI_DEVICE_TYPE_PRINTER:
|
||||
case VIR_SCSI_DEVICE_TYPE_PROCESSOR:
|
||||
case VIR_SCSI_DEVICE_TYPE_WORM:
|
||||
diff --git a/tests/virscsidata/2-0-0-0/model b/tests/virscsidata/2-0-0-0/model
|
||||
new file mode 100644
|
||||
index 0000000000..d2ab4715c3
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/model
|
||||
@@ -0,0 +1 @@
|
||||
+scsi_debug
|
||||
diff --git a/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev b/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev
|
||||
new file mode 100644
|
||||
index 0000000000..3dd777e840
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/scsi_tape/st0/dev
|
||||
@@ -0,0 +1 @@
|
||||
+9:0
|
||||
diff --git a/tests/virscsidata/2-0-0-0/sg3/dev b/tests/virscsidata/2-0-0-0/sg3/dev
|
||||
new file mode 100644
|
||||
index 0000000000..b369a59b3e
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/sg3/dev
|
||||
@@ -0,0 +1 @@
|
||||
+21:3
|
||||
diff --git a/tests/virscsidata/2-0-0-0/tape b/tests/virscsidata/2-0-0-0/tape
|
||||
new file mode 120000
|
||||
index 0000000000..6ca7f77539
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/tape
|
||||
@@ -0,0 +1 @@
|
||||
+scsi_tape/st0
|
||||
\ No newline at end of file
|
||||
diff --git a/tests/virscsidata/2-0-0-0/type b/tests/virscsidata/2-0-0-0/type
|
||||
new file mode 100644
|
||||
index 0000000000..d00491fd7e
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/type
|
||||
@@ -0,0 +1 @@
|
||||
+1
|
||||
diff --git a/tests/virscsidata/2-0-0-0/vendor b/tests/virscsidata/2-0-0-0/vendor
|
||||
new file mode 100644
|
||||
index 0000000000..9b075671ea
|
||||
--- /dev/null
|
||||
+++ b/tests/virscsidata/2-0-0-0/vendor
|
||||
@@ -0,0 +1 @@
|
||||
+Linux
|
||||
diff --git a/tests/virscsidata/sg3 b/tests/virscsidata/sg3
|
||||
new file mode 100644
|
||||
index 0000000000..e69de29bb2
|
||||
diff --git a/tests/virscsitest.c b/tests/virscsitest.c
|
||||
index c96699e157..924b77af08 100644
|
||||
--- a/tests/virscsitest.c
|
||||
+++ b/tests/virscsitest.c
|
||||
@@ -33,17 +33,33 @@ VIR_LOG_INIT("tests.scsitest");
|
||||
|
||||
static char *virscsi_prefix;
|
||||
|
||||
+typedef struct {
|
||||
+ const char *adapter;
|
||||
+ unsigned int bus;
|
||||
+ unsigned int target;
|
||||
+ unsigned int unit;
|
||||
+ const char *expectedName;
|
||||
+} testGetDevNameData;
|
||||
+
|
||||
static int
|
||||
-test1(const void *data G_GNUC_UNUSED)
|
||||
+testGetDevName(const void *opaque)
|
||||
{
|
||||
+ const testGetDevNameData *data = opaque;
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
if (!(name = virSCSIDeviceGetDevName(virscsi_prefix,
|
||||
- "scsi_host1", 0, 0, 0)))
|
||||
+ data->adapter,
|
||||
+ data->bus,
|
||||
+ data->target,
|
||||
+ data->unit)))
|
||||
return -1;
|
||||
|
||||
- if (STRNEQ(name, "sdh"))
|
||||
+ if (STRNEQ(name, data->expectedName)) {
|
||||
+ fprintf(stderr,
|
||||
+ "SCSI dev name mismatch, expected %s got %s",
|
||||
+ data->expectedName, name);
|
||||
return -1;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -200,15 +216,27 @@ mymain(void)
|
||||
|
||||
CREATE_SYMLINK("0-0-0-0", "0:0:0:0");
|
||||
CREATE_SYMLINK("1-0-0-0", "1:0:0:0");
|
||||
+ CREATE_SYMLINK("2-0-0-0", "2:0:0:0");
|
||||
CREATE_SYMLINK("sg0", "sg0");
|
||||
+ CREATE_SYMLINK("sg3", "sg3");
|
||||
CREATE_SYMLINK("sg8", "sg8");
|
||||
|
||||
VIR_FREE(virscsi_prefix);
|
||||
|
||||
virscsi_prefix = g_strdup(tmpdir);
|
||||
|
||||
- if (virTestRun("test1", test1, NULL) < 0)
|
||||
- ret = -1;
|
||||
+#define TEST_GET_DEV_NAME(adapter, bus, target, unit, expectedName) \
|
||||
+ do { \
|
||||
+ testGetDevNameData data = {adapter, bus, target, unit, expectedName}; \
|
||||
+ if (virTestRun("test getDevname " expectedName, \
|
||||
+ testGetDevName, &data) < 0) \
|
||||
+ ret = -1; \
|
||||
+ } while (0)
|
||||
+
|
||||
+ TEST_GET_DEV_NAME("scsi_host0", 0, 0, 0, "sda");
|
||||
+ TEST_GET_DEV_NAME("scsi_host1", 0, 0, 0, "sdh");
|
||||
+ TEST_GET_DEV_NAME("scsi_host2", 0, 0, 0, "st0");
|
||||
+
|
||||
if (virTestRun("test2", test2, NULL) < 0)
|
||||
ret = -1;
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
From ac8357ab7dd676af82b971673f8d7e862ff07624 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ac8357ab7dd676af82b971673f8d7e862ff07624@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 6 Mar 2020 15:52:24 +0100
|
||||
Subject: [PATCH] RHEL: virutil: Accept non-block devices in virGetDeviceID()
|
||||
|
||||
If a caller wants to learn major or minor number for a device,
|
||||
let them. There's no need to check if the device is a block
|
||||
device here.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1808390
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Message-Id: <20200306145226.1610708-5-abologna@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/util/virutil.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/util/virutil.c b/src/util/virutil.c
|
||||
index b1e37b45c5..ced8493516 100644
|
||||
--- a/src/util/virutil.c
|
||||
+++ b/src/util/virutil.c
|
||||
@@ -1333,9 +1333,6 @@ virGetDeviceID(const char *path, int *maj, int *min)
|
||||
if (stat(path, &sb) < 0)
|
||||
return -errno;
|
||||
|
||||
- if (!S_ISBLK(sb.st_mode))
|
||||
- return -EINVAL;
|
||||
-
|
||||
if (maj)
|
||||
*maj = major(sb.st_rdev);
|
||||
if (min)
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
From 81f1508d99d4740e7a2a092128d651cf245a554e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <81f1508d99d4740e7a2a092128d651cf245a554e@dist-git>
|
||||
From 732113455fb7eadeea178c71cc77f0ffdf639f24 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <732113455fb7eadeea178c71cc77f0ffdf639f24@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 18 Jan 2022 12:40:09 +0100
|
||||
Subject: [PATCH] Revert "report error when virProcessGetStatInfo() is unable
|
||||
|
@ -20,7 +20,6 @@ Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041610
|
|||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
(cherry picked from commit 105dace22cc7b5b18d72a4dcad4a2cf386ce5c99)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2043579
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/ch/ch_driver.c | 2 ++
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
From f45c99be9258f2d97c1f19b93ae8f5e73f4cb486 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f45c99be9258f2d97c1f19b93ae8f5e73f4cb486@dist-git>
|
||||
From b0fb5cbba2e03fbca8471487bf78931b3090b108 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b0fb5cbba2e03fbca8471487bf78931b3090b108@dist-git>
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Mon, 10 Jan 2022 11:42:58 -0700
|
||||
Subject: [PATCH] build: Only install libvirt-guests when building libvirtd
|
||||
|
@ -10,8 +10,8 @@ d800c50349. It only needs to be installed when building libvirtd.
|
|||
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
(cherry picked from commit 3be5ba11a2c6fcb2dfdffa03ab4f847113f36b85)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2042529
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2153688
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
tools/meson.build | 38 ++++++++++++++++++++------------------
|
||||
1 file changed, 20 insertions(+), 18 deletions(-)
|
||||
|
@ -71,5 +71,5 @@ index 22fa3604ba..2d0aecb90b 100644
|
|||
|
||||
if bash_completion_dep.found()
|
||||
--
|
||||
2.35.0
|
||||
2.39.0
|
||||
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
From 19f7e6dc950baf346738f462ac5c6b815c04edcc Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <19f7e6dc950baf346738f462ac5c6b815c04edcc@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 16:49:25 +0100
|
||||
Subject: [PATCH] conf: Introduce memory allocation threads
|
||||
|
||||
Since its v5.0.0 release QEMU is capable of specifying number of
|
||||
threads used to allocate memory. It defaults to 1, which may be
|
||||
too low for humongous guests with gigantic pages.
|
||||
|
||||
In general, on QEMU cmd line level it is possible to use
|
||||
different number of threads per each memory-backend-* object, in
|
||||
practical terms it's not useful. Therefore, use <memoryBacking/>
|
||||
to set guest wide value and let all memory devices 'inherit' it,
|
||||
silently. IOW, don't introduce per device knob because that would
|
||||
only complicate things for a little or no benefit.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit ba7f98126fa84d354ce72929b77cc111a9a557a9)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2067126
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
docs/formatdomain.rst | 8 +++++---
|
||||
docs/schemas/domaincommon.rng | 19 +++++++++++++------
|
||||
src/conf/domain_conf.c | 15 ++++++++++++++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
tests/qemuxml2argvdata/memfd-memory-numa.xml | 2 +-
|
||||
5 files changed, 34 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
|
||||
index 8128e43da4..17e89a0c0d 100644
|
||||
--- a/docs/formatdomain.rst
|
||||
+++ b/docs/formatdomain.rst
|
||||
@@ -977,7 +977,7 @@ Memory Backing
|
||||
<locked/>
|
||||
<source type="file|anonymous|memfd"/>
|
||||
<access mode="shared|private"/>
|
||||
- <allocation mode="immediate|ondemand"/>
|
||||
+ <allocation mode="immediate|ondemand" threads='8'/>
|
||||
<discard/>
|
||||
</memoryBacking>
|
||||
...
|
||||
@@ -1026,8 +1026,10 @@ influence how virtual memory pages are backed by host pages.
|
||||
Using the ``mode`` attribute, specify if the memory is to be "shared" or
|
||||
"private". This can be overridden per numa node by ``memAccess``.
|
||||
``allocation``
|
||||
- Using the ``mode`` attribute, specify when to allocate the memory by
|
||||
- supplying either "immediate" or "ondemand".
|
||||
+ Using the optional ``mode`` attribute, specify when to allocate the memory by
|
||||
+ supplying either "immediate" or "ondemand". :since:`Since 8.2.0` it is
|
||||
+ possible to set the number of threads that hypervisor uses to allocate
|
||||
+ memory via ``threads`` attribute.
|
||||
``discard``
|
||||
When set and supported by hypervisor the memory content is discarded just
|
||||
before guest shuts down (or when DIMM module is unplugged). Please note that
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 7fa5c2b8b5..c9c1529979 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -745,12 +745,19 @@
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="allocation">
|
||||
- <attribute name="mode">
|
||||
- <choice>
|
||||
- <value>immediate</value>
|
||||
- <value>ondemand</value>
|
||||
- </choice>
|
||||
- </attribute>
|
||||
+ <optional>
|
||||
+ <attribute name="mode">
|
||||
+ <choice>
|
||||
+ <value>immediate</value>
|
||||
+ <value>ondemand</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="threads">
|
||||
+ <ref name="unsignedInt"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 5691b8d2d5..805a15848e 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -19095,6 +19095,13 @@ virDomainDefParseMemory(virDomainDef *def,
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
+ if (virXPathUInt("string(./memoryBacking/allocation/@threads)",
|
||||
+ ctxt, &def->mem.allocation_threads) == -2) {
|
||||
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
+ _("Failed to parse memory allocation threads"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (virXPathNode("./memoryBacking/hugepages", ctxt)) {
|
||||
/* hugepages will be used */
|
||||
if ((n = virXPathNodeSet("./memoryBacking/hugepages/page", ctxt, &nodes)) < 0) {
|
||||
@@ -27639,6 +27646,7 @@ virDomainMemorybackingFormat(virBuffer *buf,
|
||||
const virDomainMemtune *mem)
|
||||
{
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||
+ g_auto(virBuffer) allocAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (mem->nhugepages)
|
||||
virDomainHugepagesFormat(&childBuf, mem->hugepages, mem->nhugepages);
|
||||
@@ -27653,8 +27661,13 @@ virDomainMemorybackingFormat(virBuffer *buf,
|
||||
virBufferAsprintf(&childBuf, "<access mode='%s'/>\n",
|
||||
virDomainMemoryAccessTypeToString(mem->access));
|
||||
if (mem->allocation)
|
||||
- virBufferAsprintf(&childBuf, "<allocation mode='%s'/>\n",
|
||||
+ virBufferAsprintf(&allocAttrBuf, " mode='%s'",
|
||||
virDomainMemoryAllocationTypeToString(mem->allocation));
|
||||
+ if (mem->allocation_threads > 0)
|
||||
+ virBufferAsprintf(&allocAttrBuf, " threads='%u'", mem->allocation_threads);
|
||||
+
|
||||
+ virXMLFormatElement(&childBuf, "allocation", &allocAttrBuf, NULL);
|
||||
+
|
||||
if (mem->discard)
|
||||
virBufferAddLit(&childBuf, "<discard/>\n");
|
||||
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 144ba4dd12..10af94e2e4 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -2677,6 +2677,7 @@ struct _virDomainMemtune {
|
||||
int source; /* enum virDomainMemorySource */
|
||||
int access; /* enum virDomainMemoryAccess */
|
||||
int allocation; /* enum virDomainMemoryAllocation */
|
||||
+ unsigned int allocation_threads;
|
||||
|
||||
virTristateBool discard;
|
||||
};
|
||||
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2argvdata/memfd-memory-numa.xml
|
||||
index 1ebcee8939..1ac87e3aef 100644
|
||||
--- a/tests/qemuxml2argvdata/memfd-memory-numa.xml
|
||||
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml
|
||||
@@ -10,7 +10,7 @@
|
||||
</hugepages>
|
||||
<source type='memfd'/>
|
||||
<access mode='shared'/>
|
||||
- <allocation mode='immediate'/>
|
||||
+ <allocation mode='immediate' threads='8'/>
|
||||
</memoryBacking>
|
||||
<vcpu placement='static'>8</vcpu>
|
||||
<numatune>
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
From 666b68a93006c4299747d159bcacb7164b8c5d91 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <666b68a93006c4299747d159bcacb7164b8c5d91@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Thu, 24 Nov 2022 10:28:59 +0100
|
||||
Subject: [PATCH] conf: Make VIR_DOMAIN_NET_TYPE_ETHERNET not share 'host view'
|
||||
|
||||
When setting up QoS for a domain <interface/>, or when reporting
|
||||
its statistics we may need to swap TX/RX values. This is all
|
||||
explained in comment to virDomainNetTypeSharesHostView().
|
||||
However, this function claims that VIR_DOMAIN_NET_TYPE_ETHERNET
|
||||
also shares the 'host view', meaning the TX/RX values must be
|
||||
swapped. But that's not true.
|
||||
|
||||
An easy reproducer is to start a domain with two <interface/>-s:
|
||||
one type of network, the other of type ethernet and configure the
|
||||
same <bandwidth/> for both. Reversed setting can then be observed
|
||||
(e.g. via tc).
|
||||
|
||||
Reported-by: Oleg Vasilev <oleg.vasilev@virtuozzo.com>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 0862cb3ce46253a58ca02d36b2b6a6397a60bfc7)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2172578
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 401ddaa1a0..427e7d1bb5 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -30472,9 +30472,9 @@ virDomainNetTypeSharesHostView(const virDomainNetDef *net)
|
||||
virDomainNetType actualType = virDomainNetGetActualType(net);
|
||||
switch (actualType) {
|
||||
case VIR_DOMAIN_NET_TYPE_DIRECT:
|
||||
- case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||
return true;
|
||||
case VIR_DOMAIN_NET_TYPE_USER:
|
||||
+ case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
|
||||
case VIR_DOMAIN_NET_TYPE_SERVER:
|
||||
case VIR_DOMAIN_NET_TYPE_CLIENT:
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
From 00c5cab2b92b653edbf491d9ef60359578c3d59a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <00c5cab2b92b653edbf491d9ef60359578c3d59a@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Wed, 11 May 2022 16:27:18 +0200
|
||||
Subject: [PATCH] conf: Move virDomainObj::originalMemlock into
|
||||
qemuDomainObjPrivate
|
||||
|
||||
Since v1.3.0-90-gafbe1d4c56 the original value of memlock limit
|
||||
is stored inside virDomainObj struct directly (under
|
||||
originalMemlock member). This is needless because the value is
|
||||
used only inside QEMU driver and thus can reside in
|
||||
qemuDomainObjPrivate struct.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit 75df6d2c291c48d65c1e54dd93e3d2d3cb0712e7)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/conf/domain_conf.h | 3 ---
|
||||
src/qemu/qemu_domain.c | 9 +++++----
|
||||
src/qemu/qemu_domain.h | 3 +++
|
||||
3 files changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index d0d0fdc815..45976beb2b 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -3031,9 +3031,6 @@ struct _virDomainObj {
|
||||
int taint;
|
||||
size_t ndeprecations;
|
||||
char **deprecations;
|
||||
-
|
||||
- unsigned long long originalMemlock; /* Original RLIMIT_MEMLOCK, zero if no
|
||||
- * restore will be required later */
|
||||
};
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainObj, virObjectUnref);
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 40fe9985e6..86d673dafa 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -9269,6 +9269,7 @@ int
|
||||
qemuDomainAdjustMaxMemLock(virDomainObj *vm,
|
||||
bool forceVFIO)
|
||||
{
|
||||
+ qemuDomainObjPrivate *priv = vm->privateData;
|
||||
unsigned long long currentMemLock = 0;
|
||||
unsigned long long desiredMemLock = 0;
|
||||
|
||||
@@ -9281,8 +9282,8 @@ qemuDomainAdjustMaxMemLock(virDomainObj *vm,
|
||||
/* If this is the first time adjusting the limit, save the current
|
||||
* value so that we can restore it once memory locking is no longer
|
||||
* required */
|
||||
- if (vm->originalMemlock == 0) {
|
||||
- vm->originalMemlock = currentMemLock;
|
||||
+ if (priv->originalMemlock == 0) {
|
||||
+ priv->originalMemlock = currentMemLock;
|
||||
}
|
||||
} else {
|
||||
/* If the limit is already high enough, we can assume
|
||||
@@ -9295,8 +9296,8 @@ qemuDomainAdjustMaxMemLock(virDomainObj *vm,
|
||||
} else {
|
||||
/* Once memory locking is no longer required, we can restore the
|
||||
* original, usually very low, limit */
|
||||
- desiredMemLock = vm->originalMemlock;
|
||||
- vm->originalMemlock = 0;
|
||||
+ desiredMemLock = priv->originalMemlock;
|
||||
+ priv->originalMemlock = 0;
|
||||
}
|
||||
|
||||
if (desiredMemLock > 0 &&
|
||||
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
||||
index e5046367e3..e9497d20de 100644
|
||||
--- a/src/qemu/qemu_domain.h
|
||||
+++ b/src/qemu/qemu_domain.h
|
||||
@@ -241,6 +241,9 @@ struct _qemuDomainObjPrivate {
|
||||
GSList *dbusVMStateIds;
|
||||
/* true if -object dbus-vmstate was added */
|
||||
bool dbusVMState;
|
||||
+
|
||||
+ unsigned long long originalMemlock; /* Original RLIMIT_MEMLOCK, zero if no
|
||||
+ * restore will be required later */
|
||||
};
|
||||
|
||||
#define QEMU_DOMAIN_PRIVATE(vm) \
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
From 3c65b917f70d556fa1059b0400771c8159b8ca3b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <3c65b917f70d556fa1059b0400771c8159b8ca3b@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:08 +0200
|
||||
Subject: [PATCH] conf: adjust method name virDomainDeviceCCWAddressParseXML
|
||||
|
||||
Adjust method name virDomainDeviceCCWAddressParseXML to
|
||||
virCCWDeviceAddressParseXML.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 2d9fd19bf5d7a3d33b94e464c335252682edd623)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/device_conf.c | 4 ++--
|
||||
src/conf/device_conf.h | 4 ++--
|
||||
src/conf/domain_conf.c | 3 +--
|
||||
src/libvirt_private.syms | 2 +-
|
||||
4 files changed, 6 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
||||
index 958e2f43cc..e93fd57341 100644
|
||||
--- a/src/conf/device_conf.c
|
||||
+++ b/src/conf/device_conf.c
|
||||
@@ -259,8 +259,8 @@ virPCIDeviceAddressFormat(virBuffer *buf,
|
||||
}
|
||||
|
||||
int
|
||||
-virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
- virCCWDeviceAddress *addr)
|
||||
+virCCWDeviceAddressParseXML(xmlNodePtr node,
|
||||
+ virCCWDeviceAddress *addr)
|
||||
{
|
||||
int cssid;
|
||||
int ssid;
|
||||
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
||||
index 01e2edccc9..910e6b7792 100644
|
||||
--- a/src/conf/device_conf.h
|
||||
+++ b/src/conf/device_conf.h
|
||||
@@ -193,8 +193,8 @@ void virPCIDeviceAddressFormat(virBuffer *buf,
|
||||
virPCIDeviceAddress addr,
|
||||
bool includeTypeInAddr);
|
||||
|
||||
-int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
- virCCWDeviceAddress *addr);
|
||||
+int virCCWDeviceAddressParseXML(xmlNodePtr node,
|
||||
+ virCCWDeviceAddress *addr);
|
||||
|
||||
int virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
|
||||
virDomainDeviceDriveAddress *addr);
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 1e1c7f01b1..401ddaa1a0 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -6630,8 +6630,7 @@ virDomainDeviceAddressParseXML(xmlNodePtr address,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
|
||||
- if (virDomainDeviceCCWAddressParseXML
|
||||
- (address, &info->addr.ccw) < 0)
|
||||
+ if (virCCWDeviceAddressParseXML(address, &info->addr.ccw) < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 0d3ee4c20a..44b551fb60 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -124,6 +124,7 @@ virCPUModeTypeToString;
|
||||
|
||||
|
||||
# conf/device_conf.h
|
||||
+virCCWDeviceAddressParseXML;
|
||||
virDeviceInfoPCIAddressExtensionIsPresent;
|
||||
virDeviceInfoPCIAddressExtensionIsWanted;
|
||||
virDeviceInfoPCIAddressIsPresent;
|
||||
@@ -131,7 +132,6 @@ virDeviceInfoPCIAddressIsWanted;
|
||||
virDomainDeviceAddressIsValid;
|
||||
virDomainDeviceAddressTypeToString;
|
||||
virDomainDeviceCcidAddressParseXML;
|
||||
-virDomainDeviceCCWAddressParseXML;
|
||||
virDomainDeviceDriveAddressParseXML;
|
||||
virDomainDeviceInfoAddressIsEqual;
|
||||
virDomainDeviceSpaprVioAddressParseXML;
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
From 0c09e4225c511ce1b0ebe22e45962f83d5145e66 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0c09e4225c511ce1b0ebe22e45962f83d5145e66@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Fri, 10 Jun 2022 15:10:29 +0200
|
||||
Subject: [PATCH] conf: virtiofs: add thread_pool element
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add an element to configure the thread pool size:
|
||||
|
||||
...
|
||||
<binary>
|
||||
<thread_pool size='16'/>
|
||||
</binary>
|
||||
...
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2072905
|
||||
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 0df2e7df80452f81edbfeb0ee355235b533346a9)
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2079582
|
||||
---
|
||||
docs/formatdomain.rst | 6 ++++++
|
||||
docs/schemas/domaincommon.rng | 9 +++++++++
|
||||
src/conf/domain_conf.c | 15 +++++++++++++++
|
||||
src/conf/domain_conf.h | 1 +
|
||||
.../qemuxml2argvdata/vhost-user-fs-fd-memory.xml | 1 +
|
||||
5 files changed, 32 insertions(+)
|
||||
|
||||
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
|
||||
index 17e89a0c0d..e6cf2ec083 100644
|
||||
--- a/docs/formatdomain.rst
|
||||
+++ b/docs/formatdomain.rst
|
||||
@@ -3316,6 +3316,7 @@ A directory on the host that can be accessed directly from the guest.
|
||||
<cache mode='always'/>
|
||||
<sandbox mode='namespace'/>
|
||||
<lock posix='on' flock='on'/>
|
||||
+ <thread_pool size='16'/>
|
||||
</binary>
|
||||
<source dir='/path'/>
|
||||
<target dir='mount_tag'/>
|
||||
@@ -3449,6 +3450,11 @@ A directory on the host that can be accessed directly from the guest.
|
||||
``chroot``, see the
|
||||
`virtiofsd documentation <https://qemu.readthedocs.io/en/latest/tools/virtiofsd.html>`__
|
||||
for more details. ( :since:`Since 7.2.0` )
|
||||
+ Element ``thread_pool`` accepts one attribute ``size`` which defines the
|
||||
+ maximum thread pool size. A value of "0" disables the pool.
|
||||
+ The thread pool helps increase the number of requests in flight when used with
|
||||
+ storage that has a higher latency. However, it has an overhead, and so for
|
||||
+ fast, low latency filesystems, it may be best to turn it off. ( :since:`Since 8.5.0` )
|
||||
``source``
|
||||
The resource on the host that is being accessed in the guest. The ``name``
|
||||
attribute must be used with ``type='template'``, and the ``dir`` attribute
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index c9c1529979..79c8979410 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -3064,6 +3064,15 @@
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <element name="thread_pool">
|
||||
+ <optional>
|
||||
+ <attribute name="size">
|
||||
+ <data type="integer"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 92510973e6..95afd9226e 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -2447,6 +2447,8 @@ virDomainFSDefNew(virDomainXMLOption *xmlopt)
|
||||
|
||||
ret->src = virStorageSourceNew();
|
||||
|
||||
+ ret->thread_pool_size = -1;
|
||||
+
|
||||
if (xmlopt &&
|
||||
xmlopt->privateData.fsNew &&
|
||||
!(ret->privateData = xmlopt->privateData.fsNew()))
|
||||
@@ -9869,6 +9871,7 @@ virDomainFSDefParseXML(virDomainXMLOption *xmlopt,
|
||||
if (def->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) {
|
||||
g_autofree char *queue_size = virXPathString("string(./driver/@queue)", ctxt);
|
||||
g_autofree char *binary = virXPathString("string(./binary/@path)", ctxt);
|
||||
+ g_autofree char *thread_pool_size = virXPathString("string(./binary/thread_pool/@size)", ctxt);
|
||||
g_autofree char *xattr = virXPathString("string(./binary/@xattr)", ctxt);
|
||||
g_autofree char *cache = virXPathString("string(./binary/cache/@mode)", ctxt);
|
||||
g_autofree char *sandbox = virXPathString("string(./binary/sandbox/@mode)", ctxt);
|
||||
@@ -9883,6 +9886,14 @@ virDomainFSDefParseXML(virDomainXMLOption *xmlopt,
|
||||
goto error;
|
||||
}
|
||||
|
||||
+ if (thread_pool_size &&
|
||||
+ virStrToLong_i(thread_pool_size, NULL, 10, &def->thread_pool_size) < 0) {
|
||||
+ virReportError(VIR_ERR_XML_ERROR,
|
||||
+ _("cannot parse thread pool size '%s' for virtiofs"),
|
||||
+ queue_size);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if (binary)
|
||||
def->binary = virFileSanitizePath(binary);
|
||||
|
||||
@@ -24205,6 +24216,10 @@ virDomainFSDefFormat(virBuffer *buf,
|
||||
}
|
||||
|
||||
virXMLFormatElement(&binaryBuf, "lock", &lockAttrBuf, NULL);
|
||||
+
|
||||
+ if (def->thread_pool_size >= 0)
|
||||
+ virBufferAsprintf(&binaryBuf, "<thread_pool size='%d'/>\n", def->thread_pool_size);
|
||||
+
|
||||
}
|
||||
|
||||
virDomainVirtioOptionsFormat(&driverAttrBuf, def->virtio);
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 10af94e2e4..d0d0fdc815 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -892,6 +892,7 @@ struct _virDomainFSDef {
|
||||
virTristateSwitch posix_lock;
|
||||
virTristateSwitch flock;
|
||||
virDomainFSSandboxMode sandbox;
|
||||
+ int thread_pool_size;
|
||||
virDomainVirtioOptions *virtio;
|
||||
virObject *privateData;
|
||||
};
|
||||
diff --git a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
|
||||
index abddf0870b..81de8c0dd7 100644
|
||||
--- a/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
|
||||
+++ b/tests/qemuxml2argvdata/vhost-user-fs-fd-memory.xml
|
||||
@@ -32,6 +32,7 @@
|
||||
<cache mode='always'/>
|
||||
<sandbox mode='chroot'/>
|
||||
<lock posix='off' flock='off'/>
|
||||
+ <thread_pool size='16'/>
|
||||
</binary>
|
||||
<source dir='/path'/>
|
||||
<target dir='mount_tag'/>
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
From 46f4cfe513f0f893c862dca7f02ed7d7932b2115 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <46f4cfe513f0f893c862dca7f02ed7d7932b2115@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Tue, 26 Apr 2022 12:50:41 +0200
|
||||
Subject: [PATCH] cpu_map: Disable cpu64-rhel* for host-model and baseline
|
||||
|
||||
These ancient RHEL-only CPU models should not really be used by any CPU
|
||||
definition created by libvirt. We keep them just for backwards
|
||||
compatibility with domains which might still be using them.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit d2e4d66be35cd04da72e5f5129a8a4da6a931505)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/cpu_map/x86_cpu64-rhel5.xml | 2 +-
|
||||
src/cpu_map/x86_cpu64-rhel6.xml | 2 +-
|
||||
tests/cputestdata/x86_64-baseline-no-vendor-result.xml | 3 ++-
|
||||
3 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/cpu_map/x86_cpu64-rhel5.xml b/src/cpu_map/x86_cpu64-rhel5.xml
|
||||
index be6bcdb7a6..7402b7603c 100644
|
||||
--- a/src/cpu_map/x86_cpu64-rhel5.xml
|
||||
+++ b/src/cpu_map/x86_cpu64-rhel5.xml
|
||||
@@ -1,6 +1,6 @@
|
||||
<cpus>
|
||||
<model name='cpu64-rhel5'>
|
||||
- <decode host='on' guest='on'/>
|
||||
+ <decode host='off' guest='off'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
<feature name='cmov'/>
|
||||
diff --git a/src/cpu_map/x86_cpu64-rhel6.xml b/src/cpu_map/x86_cpu64-rhel6.xml
|
||||
index c62b1b5575..061939c733 100644
|
||||
--- a/src/cpu_map/x86_cpu64-rhel6.xml
|
||||
+++ b/src/cpu_map/x86_cpu64-rhel6.xml
|
||||
@@ -1,6 +1,6 @@
|
||||
<cpus>
|
||||
<model name='cpu64-rhel6'>
|
||||
- <decode host='on' guest='on'/>
|
||||
+ <decode host='off' guest='off'/>
|
||||
<feature name='apic'/>
|
||||
<feature name='clflush'/>
|
||||
<feature name='cmov'/>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-no-vendor-result.xml b/tests/cputestdata/x86_64-baseline-no-vendor-result.xml
|
||||
index 00e03b2152..4b4921cf93 100644
|
||||
--- a/tests/cputestdata/x86_64-baseline-no-vendor-result.xml
|
||||
+++ b/tests/cputestdata/x86_64-baseline-no-vendor-result.xml
|
||||
@@ -1,3 +1,4 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>cpu64-rhel6</model>
|
||||
+ <model fallback='allow'>kvm64</model>
|
||||
+ <feature policy='require' name='lahf_lm'/>
|
||||
</cpu>
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
From 99a298a4a0575bf0072f504c4b8e4551400c44c0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <99a298a4a0575bf0072f504c4b8e4551400c44c0@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Tue, 26 Apr 2022 11:58:07 +0200
|
||||
Subject: [PATCH] cpu_x86: Consolidate signature match in x86DecodeUseCandidate
|
||||
|
||||
Checking the signature in two different places makes no sense since the
|
||||
code in between can only mark the candidate as the best option so far,
|
||||
which is what the second signature match does as well.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 35ce086667e68e8f546cf36473591dd7c19c72eb)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 31 ++++++++++++++-----------------
|
||||
1 file changed, 14 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index 5cb9caef8a..f007487824 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -2020,15 +2020,22 @@ x86DecodeUseCandidate(virCPUx86Model *current,
|
||||
}
|
||||
|
||||
/* Ideally we want to select a model with family/model equal to
|
||||
- * family/model of the real CPU. Once we found such model, we only
|
||||
+ * family/model of the real CPU and once we found such model, we only
|
||||
* consider candidates with matching family/model.
|
||||
*/
|
||||
- if (signature &&
|
||||
- virCPUx86SignaturesMatch(current->signatures, signature) &&
|
||||
- !virCPUx86SignaturesMatch(candidate->signatures, signature)) {
|
||||
- VIR_DEBUG("%s differs in signature from matching %s",
|
||||
- cpuCandidate->model, cpuCurrent->model);
|
||||
- return 0;
|
||||
+ if (signature) {
|
||||
+ if (virCPUx86SignaturesMatch(current->signatures, signature) &&
|
||||
+ !virCPUx86SignaturesMatch(candidate->signatures, signature)) {
|
||||
+ VIR_DEBUG("%s differs in signature from matching %s",
|
||||
+ cpuCandidate->model, cpuCurrent->model);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!virCPUx86SignaturesMatch(current->signatures, signature) &&
|
||||
+ virCPUx86SignaturesMatch(candidate->signatures, signature)) {
|
||||
+ VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
|
||||
+ return 1;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (cpuCurrent->nfeatures > cpuCandidate->nfeatures) {
|
||||
@@ -2037,16 +2044,6 @@ x86DecodeUseCandidate(virCPUx86Model *current,
|
||||
return 1;
|
||||
}
|
||||
|
||||
- /* Prefer a candidate with matching signature even though it would
|
||||
- * result in longer list of features.
|
||||
- */
|
||||
- if (signature &&
|
||||
- virCPUx86SignaturesMatch(candidate->signatures, signature) &&
|
||||
- !virCPUx86SignaturesMatch(current->signatures, signature)) {
|
||||
- VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
VIR_DEBUG("%s does not result in shorter feature list than %s",
|
||||
cpuCandidate->model, cpuCurrent->model);
|
||||
return 0;
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
From 752c74eeae67d41e7550991cb3bbe289984ec9d3 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <752c74eeae67d41e7550991cb3bbe289984ec9d3@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 29 Apr 2022 10:35:02 +0200
|
||||
Subject: [PATCH] cpu_x86: Ignore enabled features for input models in
|
||||
x86DecodeUseCandidate
|
||||
|
||||
While we don't want to aim for the shortest list of disabled features in
|
||||
the baseline result (it would select a very old model), we want to do so
|
||||
while looking at any of the input models for which we're trying to
|
||||
compute a baseline CPU model. Given a set of input models, we always
|
||||
want to take the least capable one of them (i.e., the one with shortest
|
||||
list of disabled features) or a better model which is not one of the
|
||||
input models.
|
||||
|
||||
So when considering an input model, we just check whether its list of
|
||||
disabled features is shorter than the currently best one. When looking
|
||||
at other models we check both enabled and disabled features while
|
||||
penalizing disabled features as implemented by the previous patch.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit bb6cedd2082599323257ee0df18c93a6e0551b0b)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 66 ++++++++++++-------
|
||||
...4-baseline-Westmere+Nehalem-migratable.xml | 8 ++-
|
||||
...86_64-baseline-Westmere+Nehalem-result.xml | 8 ++-
|
||||
...-cpuid-baseline-Cooperlake+Cascadelake.xml | 13 ++--
|
||||
4 files changed, 64 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index ebcd96edb1..7b59dad8bf 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -1975,7 +1975,8 @@ virCPUx86Compare(virCPUDef *host,
|
||||
|
||||
static int
|
||||
virCPUx86CompareCandidateFeatureList(virCPUDef *cpuCurrent,
|
||||
- virCPUDef *cpuCandidate)
|
||||
+ virCPUDef *cpuCandidate,
|
||||
+ bool isPreferred)
|
||||
{
|
||||
size_t current = cpuCurrent->nfeatures;
|
||||
size_t enabledCurrent = current;
|
||||
@@ -2017,6 +2018,14 @@ virCPUx86CompareCandidateFeatureList(virCPUDef *cpuCurrent,
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ if (isPreferred && disabled < disabledCurrent) {
|
||||
+ VIR_DEBUG("%s is in the list of preferred models and provides fewer "
|
||||
+ "disabled features than %s: %zu < %zu",
|
||||
+ cpuCandidate->model, cpuCurrent->model,
|
||||
+ disabled, disabledCurrent);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
VIR_DEBUG("%s is not better than %s: %zu (%zu, %zu) >= %zu (%zu, %zu)",
|
||||
cpuCandidate->model, cpuCurrent->model,
|
||||
candidate, enabled, disabled,
|
||||
@@ -2039,8 +2048,10 @@ x86DecodeUseCandidate(virCPUx86Model *current,
|
||||
virCPUx86Model *candidate,
|
||||
virCPUDef *cpuCandidate,
|
||||
uint32_t signature,
|
||||
- const char *preferred)
|
||||
+ const char **preferred)
|
||||
{
|
||||
+ bool isPreferred = false;
|
||||
+
|
||||
if (cpuCandidate->type == VIR_CPU_TYPE_HOST &&
|
||||
!candidate->decodeHost) {
|
||||
VIR_DEBUG("%s is not supposed to be used for host CPU definition",
|
||||
@@ -2064,9 +2075,13 @@ x86DecodeUseCandidate(virCPUx86Model *current,
|
||||
}
|
||||
}
|
||||
|
||||
- if (preferred && STREQ(cpuCandidate->model, preferred)) {
|
||||
- VIR_DEBUG("%s is the preferred model", cpuCandidate->model);
|
||||
- return 2;
|
||||
+ if (preferred) {
|
||||
+ isPreferred = g_strv_contains(preferred, cpuCandidate->model);
|
||||
+
|
||||
+ if (isPreferred && !preferred[1]) {
|
||||
+ VIR_DEBUG("%s is the preferred model", cpuCandidate->model);
|
||||
+ return 2;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (!cpuCurrent) {
|
||||
@@ -2093,7 +2108,8 @@ x86DecodeUseCandidate(virCPUx86Model *current,
|
||||
}
|
||||
}
|
||||
|
||||
- return virCPUx86CompareCandidateFeatureList(cpuCurrent, cpuCandidate);
|
||||
+ return virCPUx86CompareCandidateFeatureList(cpuCurrent, cpuCandidate,
|
||||
+ isPreferred);
|
||||
}
|
||||
|
||||
|
||||
@@ -2136,7 +2152,7 @@ static int
|
||||
x86Decode(virCPUDef *cpu,
|
||||
const virCPUx86Data *cpuData,
|
||||
virDomainCapsCPUModels *models,
|
||||
- const char *preferred,
|
||||
+ const char **preferred,
|
||||
bool migratable)
|
||||
{
|
||||
virCPUx86Map *map;
|
||||
@@ -2169,6 +2185,9 @@ x86Decode(virCPUDef *cpu,
|
||||
|
||||
x86DataFilterTSX(&data, vendor, map);
|
||||
|
||||
+ if (preferred && !preferred[0])
|
||||
+ preferred = NULL;
|
||||
+
|
||||
/* Walk through the CPU models in reverse order to check newest
|
||||
* models first.
|
||||
*/
|
||||
@@ -2176,16 +2195,18 @@ x86Decode(virCPUDef *cpu,
|
||||
candidate = map->models[i];
|
||||
if (models &&
|
||||
!(hvModel = virDomainCapsCPUModelsGet(models, candidate->name))) {
|
||||
- if (preferred && STREQ(candidate->name, preferred)) {
|
||||
+ if (preferred &&
|
||||
+ !preferred[1] &&
|
||||
+ STREQ(candidate->name, preferred[0])) {
|
||||
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("CPU model %s is not supported by hypervisor"),
|
||||
- preferred);
|
||||
+ preferred[0]);
|
||||
return -1;
|
||||
} else {
|
||||
VIR_WARN("Preferred CPU model %s not allowed by"
|
||||
" hypervisor; closest supported model will be"
|
||||
- " used", preferred);
|
||||
+ " used", preferred[0]);
|
||||
}
|
||||
} else {
|
||||
VIR_DEBUG("CPU model %s not allowed by hypervisor; ignoring",
|
||||
@@ -2793,8 +2814,8 @@ virCPUx86Baseline(virCPUDef **cpus,
|
||||
size_t i;
|
||||
virCPUx86Vendor *vendor = NULL;
|
||||
bool outputVendor = true;
|
||||
- const char *modelName;
|
||||
- bool matchingNames = true;
|
||||
+ g_autofree char **modelNames = NULL;
|
||||
+ size_t namesLen = 0;
|
||||
g_autoptr(virCPUData) featData = NULL;
|
||||
|
||||
if (!(map = virCPUx86GetMap()))
|
||||
@@ -2816,19 +2837,17 @@ virCPUx86Baseline(virCPUDef **cpus,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- modelName = cpus[0]->model;
|
||||
+ modelNames = g_new0(char *, ncpus + 1);
|
||||
+ if (cpus[0]->model)
|
||||
+ modelNames[namesLen++] = cpus[0]->model;
|
||||
+
|
||||
for (i = 1; i < ncpus; i++) {
|
||||
g_autoptr(virCPUx86Model) model = NULL;
|
||||
const char *vn = NULL;
|
||||
|
||||
- if (matchingNames && cpus[i]->model) {
|
||||
- if (!modelName) {
|
||||
- modelName = cpus[i]->model;
|
||||
- } else if (STRNEQ(modelName, cpus[i]->model)) {
|
||||
- modelName = NULL;
|
||||
- matchingNames = false;
|
||||
- }
|
||||
- }
|
||||
+ if (cpus[i]->model &&
|
||||
+ !g_strv_contains((const char **) modelNames, cpus[i]->model))
|
||||
+ modelNames[namesLen++] = cpus[i]->model;
|
||||
|
||||
if (!(model = x86ModelFromCPU(cpus[i], map, -1)))
|
||||
return NULL;
|
||||
@@ -2891,10 +2910,11 @@ virCPUx86Baseline(virCPUDef **cpus,
|
||||
virCPUx86DataAddItem(&base_model->data, &vendor->data) < 0)
|
||||
return NULL;
|
||||
|
||||
- if (x86Decode(cpu, &base_model->data, models, modelName, migratable) < 0)
|
||||
+ if (x86Decode(cpu, &base_model->data, models,
|
||||
+ (const char **) modelNames, migratable) < 0)
|
||||
return NULL;
|
||||
|
||||
- if (STREQ_NULLABLE(cpu->model, modelName))
|
||||
+ if (namesLen == 1 && STREQ(cpu->model, modelNames[0]))
|
||||
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
|
||||
|
||||
if (!outputVendor)
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-migratable.xml b/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-migratable.xml
|
||||
index 775a27de2e..f5846b1619 100644
|
||||
--- a/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-migratable.xml
|
||||
+++ b/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-migratable.xml
|
||||
@@ -1,10 +1,14 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>SandyBridge</model>
|
||||
+ <model fallback='allow'>Westmere</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='pclmuldq'/>
|
||||
<feature policy='require' name='pcid'/>
|
||||
+ <feature policy='require' name='x2apic'/>
|
||||
+ <feature policy='require' name='tsc-deadline'/>
|
||||
+ <feature policy='require' name='xsave'/>
|
||||
<feature policy='require' name='osxsave'/>
|
||||
+ <feature policy='require' name='avx'/>
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
- <feature policy='disable' name='rdtscp'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-result.xml b/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-result.xml
|
||||
index cafca97d62..166833276c 100644
|
||||
--- a/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-result.xml
|
||||
+++ b/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-result.xml
|
||||
@@ -1,11 +1,15 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>SandyBridge</model>
|
||||
+ <model fallback='allow'>Westmere</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='vme'/>
|
||||
<feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='pclmuldq'/>
|
||||
<feature policy='require' name='pcid'/>
|
||||
+ <feature policy='require' name='x2apic'/>
|
||||
+ <feature policy='require' name='tsc-deadline'/>
|
||||
+ <feature policy='require' name='xsave'/>
|
||||
<feature policy='require' name='osxsave'/>
|
||||
+ <feature policy='require' name='avx'/>
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
<feature policy='require' name='invtsc'/>
|
||||
- <feature policy='disable' name='rdtscp'/>
|
||||
</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
|
||||
index 46c32c996f..ecac749b97 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
|
||||
@@ -1,17 +1,22 @@
|
||||
<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>Cooperlake</model>
|
||||
+ <model fallback='allow'>Cascadelake-Server</model>
|
||||
<vendor>Intel</vendor>
|
||||
<feature policy='require' name='ss'/>
|
||||
<feature policy='require' name='vmx'/>
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
- <feature policy='require' name='mpx'/>
|
||||
<feature policy='require' name='umip'/>
|
||||
+ <feature policy='require' name='pku'/>
|
||||
<feature policy='require' name='md-clear'/>
|
||||
+ <feature policy='require' name='stibp'/>
|
||||
+ <feature policy='require' name='arch-capabilities'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
<feature policy='require' name='ibpb'/>
|
||||
<feature policy='require' name='amd-ssbd'/>
|
||||
+ <feature policy='require' name='rdctl-no'/>
|
||||
+ <feature policy='require' name='ibrs-all'/>
|
||||
+ <feature policy='require' name='skip-l1dfl-vmentry'/>
|
||||
+ <feature policy='require' name='mds-no'/>
|
||||
+ <feature policy='require' name='pschange-mc-no'/>
|
||||
<feature policy='require' name='tsx-ctrl'/>
|
||||
- <feature policy='disable' name='avx512-bf16'/>
|
||||
- <feature policy='disable' name='taa-no'/>
|
||||
</cpu>
|
||||
--
|
||||
2.35.1
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,73 @@
|
|||
From 3d7a4041d31e403dc9e762b34f7faf36f7f20a28 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <3d7a4041d31e403dc9e762b34f7faf36f7f20a28@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Tue, 26 Apr 2022 15:02:51 +0200
|
||||
Subject: [PATCH] cpu_x86: Refactor feature list comparison in
|
||||
x86DecodeUseCandidate
|
||||
|
||||
It will become more complicated and so it deserves to be separated into
|
||||
a new function.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 1d6ca40ac23c039abc4392b668f256d0eda33280)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/cpu/cpu_x86.c | 31 ++++++++++++++++++++++---------
|
||||
1 file changed, 22 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index f007487824..81c2441b8b 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -1970,6 +1970,27 @@ virCPUx86Compare(virCPUDef *host,
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+virCPUx86CompareCandidateFeatureList(virCPUDef *cpuCurrent,
|
||||
+ virCPUDef *cpuCandidate)
|
||||
+{
|
||||
+ size_t current = cpuCurrent->nfeatures;
|
||||
+ size_t candidate = cpuCandidate->nfeatures;
|
||||
+
|
||||
+ if (candidate < current) {
|
||||
+ VIR_DEBUG("%s is better than %s: %zu < %zu",
|
||||
+ cpuCandidate->model, cpuCurrent->model,
|
||||
+ candidate, current);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ VIR_DEBUG("%s is not better than %s: %zu >= %zu",
|
||||
+ cpuCandidate->model, cpuCurrent->model,
|
||||
+ candidate, current);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*
|
||||
* Checks whether a candidate model is a better fit for the CPU data than the
|
||||
* current model.
|
||||
@@ -2038,15 +2059,7 @@ x86DecodeUseCandidate(virCPUx86Model *current,
|
||||
}
|
||||
}
|
||||
|
||||
- if (cpuCurrent->nfeatures > cpuCandidate->nfeatures) {
|
||||
- VIR_DEBUG("%s results in shorter feature list than %s",
|
||||
- cpuCandidate->model, cpuCurrent->model);
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
- VIR_DEBUG("%s does not result in shorter feature list than %s",
|
||||
- cpuCandidate->model, cpuCurrent->model);
|
||||
- return 0;
|
||||
+ return virCPUx86CompareCandidateFeatureList(cpuCurrent, cpuCandidate);
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,498 @@
|
|||
From b37a398da4323407de24d19afac937eac80170cc Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b37a398da4323407de24d19afac937eac80170cc@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Thu, 21 Apr 2022 18:25:15 +0200
|
||||
Subject: [PATCH] cputest: Add some real world baseline tests
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 63d633b9a4fc42da7e2acaf45501914607d968a5)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
tests/cputest.c | 118 +++++++++++++++---
|
||||
...id-baseline-Broadwell-IBRS+Cascadelake.xml | 11 ++
|
||||
..._64-cpuid-baseline-Cascadelake+Icelake.xml | 14 +++
|
||||
...puid-baseline-Cascadelake+Skylake-IBRS.xml | 12 ++
|
||||
..._64-cpuid-baseline-Cascadelake+Skylake.xml | 8 ++
|
||||
...-cpuid-baseline-Cooperlake+Cascadelake.xml | 17 +++
|
||||
...6_64-cpuid-baseline-Cooperlake+Icelake.xml | 14 +++
|
||||
.../x86_64-cpuid-baseline-EPYC+Rome.xml | 13 ++
|
||||
.../x86_64-cpuid-baseline-Haswell+Skylake.xml | 14 +++
|
||||
...-baseline-Haswell-noTSX-IBRS+Broadwell.xml | 14 +++
|
||||
...seline-Haswell-noTSX-IBRS+Skylake-IBRS.xml | 14 +++
|
||||
...id-baseline-Haswell-noTSX-IBRS+Skylake.xml | 14 +++
|
||||
.../x86_64-cpuid-baseline-Ryzen+Rome.xml | 13 ++
|
||||
...4-cpuid-baseline-Skylake-Client+Server.xml | 9 ++
|
||||
14 files changed, 271 insertions(+), 14 deletions(-)
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Broadwell-IBRS+Cascadelake.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Icelake.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake-IBRS.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Icelake.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-EPYC+Rome.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Haswell+Skylake.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Broadwell.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake-IBRS.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Ryzen+Rome.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-baseline-Skylake-Client+Server.xml
|
||||
|
||||
diff --git a/tests/cputest.c b/tests/cputest.c
|
||||
index b939e20718..b39ec7e18b 100644
|
||||
--- a/tests/cputest.c
|
||||
+++ b/tests/cputest.c
|
||||
@@ -58,6 +58,8 @@ struct data {
|
||||
const char *name;
|
||||
virDomainCapsCPUModels *models;
|
||||
const char *modelsName;
|
||||
+ const char **cpus;
|
||||
+ int ncpus;
|
||||
unsigned int flags;
|
||||
int result;
|
||||
};
|
||||
@@ -561,6 +563,60 @@ cpuTestCPUID(bool guest, const void *arg)
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+cpuTestCPUIDBaseline(const void *arg)
|
||||
+{
|
||||
+ const struct data *data = arg;
|
||||
+ int ret = -1;
|
||||
+ virCPUDef **cpus = NULL;
|
||||
+ virCPUDef *baseline = NULL;
|
||||
+ g_autofree char *result = NULL;
|
||||
+ size_t i;
|
||||
+
|
||||
+ cpus = g_new0(virCPUDef *, data->ncpus);
|
||||
+ for (i = 0; i < data->ncpus; i++) {
|
||||
+ g_autofree char *name = NULL;
|
||||
+
|
||||
+ name = g_strdup_printf("cpuid-%s-json", data->cpus[i]);
|
||||
+ if (!(cpus[i] = cpuTestLoadXML(data->arch, name)))
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ baseline = virCPUBaseline(data->arch, cpus, data->ncpus, NULL, NULL, false);
|
||||
+ if (!baseline)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ result = g_strdup_printf("cpuid-baseline-%s", data->name);
|
||||
+
|
||||
+ if (cpuTestCompareXML(data->arch, baseline, result) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ for (i = 0; i < data->ncpus; i++) {
|
||||
+ virCPUCompareResult cmp;
|
||||
+
|
||||
+ cmp = virCPUCompare(data->arch, cpus[i], baseline, false);
|
||||
+ if (cmp != VIR_CPU_COMPARE_SUPERSET &&
|
||||
+ cmp != VIR_CPU_COMPARE_IDENTICAL) {
|
||||
+ VIR_TEST_VERBOSE("\nbaseline CPU is incompatible with CPU %zu", i);
|
||||
+ VIR_TEST_VERBOSE("%74s", "... ");
|
||||
+ ret = -1;
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
+ cleanup:
|
||||
+ if (cpus) {
|
||||
+ for (i = 0; i < data->ncpus; i++)
|
||||
+ virCPUDefFree(cpus[i]);
|
||||
+ VIR_FREE(cpus);
|
||||
+ }
|
||||
+ virCPUDefFree(baseline);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
cpuTestHostCPUID(const void *arg)
|
||||
{
|
||||
@@ -888,13 +944,13 @@ mymain(void)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
-#define DO_TEST(arch, api, name, host, cpu, \
|
||||
+#define DO_TEST(arch, api, name, host, cpu, cpus, ncpus, \
|
||||
models, flags, result) \
|
||||
do { \
|
||||
struct data data = { \
|
||||
arch, host, cpu, models, \
|
||||
models == NULL ? NULL : #models, \
|
||||
- flags, result \
|
||||
+ cpus, ncpus, flags, result \
|
||||
}; \
|
||||
g_autofree char *testLabel = NULL; \
|
||||
\
|
||||
@@ -907,12 +963,12 @@ mymain(void)
|
||||
#define DO_TEST_COMPARE(arch, host, cpu, result) \
|
||||
DO_TEST(arch, cpuTestCompare, \
|
||||
host "/" cpu " (" #result ")", \
|
||||
- host, cpu, NULL, 0, result)
|
||||
+ host, cpu, NULL, 0, NULL, 0, result)
|
||||
|
||||
#define DO_TEST_UPDATE_ONLY(arch, host, cpu) \
|
||||
DO_TEST(arch, cpuTestUpdate, \
|
||||
cpu " on " host, \
|
||||
- host, cpu, NULL, 0, 0)
|
||||
+ host, cpu, NULL, 0, NULL, 0, 0)
|
||||
|
||||
#define DO_TEST_UPDATE(arch, host, cpu, result) \
|
||||
do { \
|
||||
@@ -930,31 +986,31 @@ mymain(void)
|
||||
suffix = " (migratable)"; \
|
||||
label = g_strdup_printf("%s%s", name, suffix); \
|
||||
DO_TEST(arch, cpuTestBaseline, label, NULL, \
|
||||
- "baseline-" name, NULL, flags, result); \
|
||||
+ "baseline-" name, NULL, 0, NULL, flags, result); \
|
||||
} while (0)
|
||||
|
||||
#define DO_TEST_HASFEATURE(arch, host, feature, result) \
|
||||
DO_TEST(arch, cpuTestHasFeature, \
|
||||
host "/" feature " (" #result ")", \
|
||||
- host, feature, NULL, 0, result)
|
||||
+ host, feature, NULL, 0, NULL, 0, result)
|
||||
|
||||
#define DO_TEST_GUESTCPU(arch, host, cpu, models, result) \
|
||||
DO_TEST(arch, cpuTestGuestCPU, \
|
||||
host "/" cpu " (" #models ")", \
|
||||
- host, cpu, models, 0, result)
|
||||
+ host, cpu, NULL, 0, models, 0, result)
|
||||
|
||||
#if WITH_QEMU
|
||||
# define DO_TEST_JSON(arch, host, json) \
|
||||
do { \
|
||||
if (json == JSON_MODELS) { \
|
||||
DO_TEST(arch, cpuTestGuestCPUID, host, host, \
|
||||
- NULL, NULL, 0, 0); \
|
||||
+ NULL, NULL, 0, NULL, 0, 0); \
|
||||
} \
|
||||
if (json != JSON_NONE) { \
|
||||
DO_TEST(arch, cpuTestJSONCPUID, host, host, \
|
||||
- NULL, NULL, json, 0); \
|
||||
+ NULL, NULL, 0, NULL, json, 0); \
|
||||
DO_TEST(arch, cpuTestJSONSignature, host, host, \
|
||||
- NULL, NULL, 0, 0); \
|
||||
+ NULL, NULL, 0, NULL, 0, 0); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
@@ -964,18 +1020,26 @@ mymain(void)
|
||||
#define DO_TEST_CPUID(arch, host, json) \
|
||||
do { \
|
||||
DO_TEST(arch, cpuTestHostCPUID, host, host, \
|
||||
- NULL, NULL, 0, 0); \
|
||||
+ NULL, NULL, 0, NULL, 0, 0); \
|
||||
DO_TEST(arch, cpuTestGuestCPUID, host, host, \
|
||||
- NULL, NULL, json, 0); \
|
||||
+ NULL, NULL, 0, NULL, json, 0); \
|
||||
DO_TEST(arch, cpuTestCPUIDSignature, host, host, \
|
||||
- NULL, NULL, 0, 0); \
|
||||
+ NULL, NULL, 0, NULL, 0, 0); \
|
||||
DO_TEST_JSON(arch, host, json); \
|
||||
if (json != JSON_NONE) { \
|
||||
DO_TEST(arch, cpuTestUpdateLive, host, host, \
|
||||
- NULL, NULL, json, 0); \
|
||||
+ NULL, NULL, 0, NULL, json, 0); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
+#define DO_TEST_CPUID_BASELINE(arch, label, cpu1, cpu2) \
|
||||
+ do { \
|
||||
+ const char *cpus[] = {cpu1, cpu2}; \
|
||||
+ DO_TEST(arch, cpuTestCPUIDBaseline, \
|
||||
+ label " (" cpu1 ", " cpu2 ")", \
|
||||
+ NULL, label, cpus, 2, NULL, 0, 0); \
|
||||
+ } while (0)
|
||||
+
|
||||
/* host to host comparison */
|
||||
DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host", VIR_CPU_COMPARE_IDENTICAL);
|
||||
DO_TEST_COMPARE(VIR_ARCH_X86_64, "host", "host-better", VIR_CPU_COMPARE_INCOMPATIBLE);
|
||||
@@ -1157,6 +1221,32 @@ mymain(void)
|
||||
DO_TEST_CPUID(VIR_ARCH_X86_64, "Ice-Lake-Server", JSON_MODELS);
|
||||
DO_TEST_CPUID(VIR_ARCH_X86_64, "Cooperlake", JSON_MODELS);
|
||||
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Ryzen+Rome",
|
||||
+ "Ryzen-7-1800X-Eight-Core", "Ryzen-9-3900X-12-Core");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "EPYC+Rome",
|
||||
+ "EPYC-7601-32-Core", "EPYC-7502-32-Core");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Haswell-noTSX-IBRS+Skylake",
|
||||
+ "Xeon-E5-2609-v3", "Xeon-Gold-6148");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Haswell-noTSX-IBRS+Skylake-IBRS",
|
||||
+ "Xeon-E5-2609-v3", "Xeon-Gold-6130");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Broadwell-IBRS+Cascadelake",
|
||||
+ "Xeon-E5-2623-v4", "Xeon-Platinum-8268");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cascadelake+Skylake-IBRS",
|
||||
+ "Xeon-Platinum-8268", "Xeon-Gold-6130");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cascadelake+Skylake",
|
||||
+ "Xeon-Platinum-9242", "Xeon-Gold-6148");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cascadelake+Icelake",
|
||||
+ "Xeon-Platinum-9242", "Ice-Lake-Server");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cooperlake+Icelake",
|
||||
+ "Cooperlake", "Ice-Lake-Server");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Cooperlake+Cascadelake",
|
||||
+ "Cooperlake", "Xeon-Platinum-9242");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Skylake-Client+Server",
|
||||
+ "Core-i5-6600", "Xeon-Gold-6148");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Haswell-noTSX-IBRS+Broadwell",
|
||||
+ "Xeon-E5-2609-v3", "Xeon-E5-2650-v4");
|
||||
+ DO_TEST_CPUID_BASELINE(VIR_ARCH_X86_64, "Haswell+Skylake",
|
||||
+ "Xeon-E7-8890-v3", "Xeon-Gold-5115");
|
||||
cleanup:
|
||||
#if WITH_QEMU
|
||||
qemuTestDriverFree(&driver);
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Broadwell-IBRS+Cascadelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Broadwell-IBRS+Cascadelake.xml
|
||||
new file mode 100644
|
||||
index 0000000000..4e3f253e9b
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Broadwell-IBRS+Cascadelake.xml
|
||||
@@ -0,0 +1,11 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Skylake-Client-IBRS</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='disable' name='mpx'/>
|
||||
+ <feature policy='disable' name='xsavec'/>
|
||||
+ <feature policy='disable' name='xgetbv1'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Icelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Icelake.xml
|
||||
new file mode 100644
|
||||
index 0000000000..e372a3e446
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Icelake.xml
|
||||
@@ -0,0 +1,14 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Cooperlake</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='mpx'/>
|
||||
+ <feature policy='require' name='umip'/>
|
||||
+ <feature policy='require' name='xsaves'/>
|
||||
+ <feature policy='disable' name='avx512-bf16'/>
|
||||
+ <feature policy='disable' name='mds-no'/>
|
||||
+ <feature policy='disable' name='pschange-mc-no'/>
|
||||
+ <feature policy='disable' name='taa-no'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake-IBRS.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake-IBRS.xml
|
||||
new file mode 100644
|
||||
index 0000000000..e559e01583
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake-IBRS.xml
|
||||
@@ -0,0 +1,12 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Cascadelake-Server</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='umip'/>
|
||||
+ <feature policy='require' name='pku'/>
|
||||
+ <feature policy='require' name='xsaves'/>
|
||||
+ <feature policy='require' name='skip-l1dfl-vmentry'/>
|
||||
+ <feature policy='disable' name='avx512vnni'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake.xml
|
||||
new file mode 100644
|
||||
index 0000000000..906259df0b
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cascadelake+Skylake.xml
|
||||
@@ -0,0 +1,8 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Skylake-Server</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='clflushopt'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
|
||||
new file mode 100644
|
||||
index 0000000000..46c32c996f
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Cascadelake.xml
|
||||
@@ -0,0 +1,17 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Cooperlake</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='vmx'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='mpx'/>
|
||||
+ <feature policy='require' name='umip'/>
|
||||
+ <feature policy='require' name='md-clear'/>
|
||||
+ <feature policy='require' name='xsaves'/>
|
||||
+ <feature policy='require' name='ibpb'/>
|
||||
+ <feature policy='require' name='amd-ssbd'/>
|
||||
+ <feature policy='require' name='tsx-ctrl'/>
|
||||
+ <feature policy='disable' name='avx512-bf16'/>
|
||||
+ <feature policy='disable' name='taa-no'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Icelake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Icelake.xml
|
||||
new file mode 100644
|
||||
index 0000000000..e372a3e446
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Cooperlake+Icelake.xml
|
||||
@@ -0,0 +1,14 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Cooperlake</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='mpx'/>
|
||||
+ <feature policy='require' name='umip'/>
|
||||
+ <feature policy='require' name='xsaves'/>
|
||||
+ <feature policy='disable' name='avx512-bf16'/>
|
||||
+ <feature policy='disable' name='mds-no'/>
|
||||
+ <feature policy='disable' name='pschange-mc-no'/>
|
||||
+ <feature policy='disable' name='taa-no'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-EPYC+Rome.xml b/tests/cputestdata/x86_64-cpuid-baseline-EPYC+Rome.xml
|
||||
new file mode 100644
|
||||
index 0000000000..e1984b2890
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-EPYC+Rome.xml
|
||||
@@ -0,0 +1,13 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>EPYC</model>
|
||||
+ <vendor>AMD</vendor>
|
||||
+ <feature policy='require' name='x2apic'/>
|
||||
+ <feature policy='require' name='tsc-deadline'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='cmp_legacy'/>
|
||||
+ <feature policy='require' name='npt'/>
|
||||
+ <feature policy='require' name='nrip-save'/>
|
||||
+ <feature policy='disable' name='svm'/>
|
||||
+ <feature policy='disable' name='monitor'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Haswell+Skylake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Haswell+Skylake.xml
|
||||
new file mode 100644
|
||||
index 0000000000..e687a679b3
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Haswell+Skylake.xml
|
||||
@@ -0,0 +1,14 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Haswell</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
+ <feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Broadwell.xml b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Broadwell.xml
|
||||
new file mode 100644
|
||||
index 0000000000..651457b17a
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Broadwell.xml
|
||||
@@ -0,0 +1,14 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Haswell-noTSX</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
+ <feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake-IBRS.xml b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake-IBRS.xml
|
||||
new file mode 100644
|
||||
index 0000000000..8bda1c02e2
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake-IBRS.xml
|
||||
@@ -0,0 +1,14 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Haswell-noTSX-IBRS</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
+ <feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake.xml b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake.xml
|
||||
new file mode 100644
|
||||
index 0000000000..651457b17a
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Haswell-noTSX-IBRS+Skylake.xml
|
||||
@@ -0,0 +1,14 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Haswell-noTSX</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='vme'/>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='f16c'/>
|
||||
+ <feature policy='require' name='rdrand'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='arat'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='xsaveopt'/>
|
||||
+ <feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='abm'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Ryzen+Rome.xml b/tests/cputestdata/x86_64-cpuid-baseline-Ryzen+Rome.xml
|
||||
new file mode 100644
|
||||
index 0000000000..051402b9d5
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Ryzen+Rome.xml
|
||||
@@ -0,0 +1,13 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>EPYC</model>
|
||||
+ <vendor>AMD</vendor>
|
||||
+ <feature policy='require' name='x2apic'/>
|
||||
+ <feature policy='require' name='tsc-deadline'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='cmp_legacy'/>
|
||||
+ <feature policy='require' name='npt'/>
|
||||
+ <feature policy='require' name='nrip-save'/>
|
||||
+ <feature policy='disable' name='sha-ni'/>
|
||||
+ <feature policy='disable' name='monitor'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-baseline-Skylake-Client+Server.xml b/tests/cputestdata/x86_64-cpuid-baseline-Skylake-Client+Server.xml
|
||||
new file mode 100644
|
||||
index 0000000000..d46ff26eeb
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-baseline-Skylake-Client+Server.xml
|
||||
@@ -0,0 +1,9 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='allow'>Skylake-Client</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='pdpe1gb'/>
|
||||
+</cpu>
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,334 @@
|
|||
From 50d94f13286ca19ef1f457be72debdbf77547df6 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <50d94f13286ca19ef1f457be72debdbf77547df6@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 4 May 2022 16:21:38 +0200
|
||||
Subject: [PATCH] cputest: Drop some old artificial baseline tests
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 6aff36019bbaf643f451779621c6c88cab0e64a7)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
tests/cputest.c | 6 ---
|
||||
.../cputestdata/x86_64-baseline-1-result.xml | 5 --
|
||||
tests/cputestdata/x86_64-baseline-1.xml | 20 --------
|
||||
.../cputestdata/x86_64-baseline-2-result.xml | 4 --
|
||||
tests/cputestdata/x86_64-baseline-2.xml | 22 ---------
|
||||
.../x86_64-baseline-5-expanded.xml | 47 -------------------
|
||||
.../cputestdata/x86_64-baseline-5-result.xml | 10 ----
|
||||
tests/cputestdata/x86_64-baseline-5.xml | 35 --------------
|
||||
.../cputestdata/x86_64-baseline-7-result.xml | 4 --
|
||||
tests/cputestdata/x86_64-baseline-7.xml | 24 ----------
|
||||
.../cputestdata/x86_64-baseline-8-result.xml | 4 --
|
||||
tests/cputestdata/x86_64-baseline-8.xml | 28 -----------
|
||||
12 files changed, 209 deletions(-)
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-1-result.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-1.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-2-result.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-2.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-5-expanded.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-5-result.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-5.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-7-result.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-7.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-8-result.xml
|
||||
delete mode 100644 tests/cputestdata/x86_64-baseline-8.xml
|
||||
|
||||
diff --git a/tests/cputest.c b/tests/cputest.c
|
||||
index 0f0621292a..20d56836be 100644
|
||||
--- a/tests/cputest.c
|
||||
+++ b/tests/cputest.c
|
||||
@@ -1051,18 +1051,12 @@ mymain(void)
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "incompatible-vendors", 0, -1);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "no-vendor", 0, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "some-vendors", 0, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "1", 0, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "2", 0, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "3", 0, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "3", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "4", 0, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "4", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "5", 0, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "5", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "6", 0, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "6", VIR_CONNECT_BASELINE_CPU_MIGRATABLE, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "7", 0, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "8", 0, 0);
|
||||
|
||||
DO_TEST_BASELINE(VIR_ARCH_PPC64, "incompatible-vendors", 0, -1);
|
||||
DO_TEST_BASELINE(VIR_ARCH_PPC64, "no-vendor", 0, 0);
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-1-result.xml b/tests/cputestdata/x86_64-baseline-1-result.xml
|
||||
deleted file mode 100644
|
||||
index 96c4f43b3d..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-1-result.xml
|
||||
+++ /dev/null
|
||||
@@ -1,5 +0,0 @@
|
||||
-<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>Conroe</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <feature policy='disable' name='lahf_lm'/>
|
||||
-</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-1.xml b/tests/cputestdata/x86_64-baseline-1.xml
|
||||
deleted file mode 100644
|
||||
index 509e6a85d2..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-1.xml
|
||||
+++ /dev/null
|
||||
@@ -1,20 +0,0 @@
|
||||
-<cpuTest>
|
||||
-<cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>Penryn</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='2' cores='4' threads='1'/>
|
||||
-</cpu>
|
||||
-<cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>Conroe</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='1' cores='1' threads='1'/>
|
||||
-</cpu>
|
||||
-<cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>core2duo</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='1' cores='1' threads='1'/>
|
||||
-</cpu>
|
||||
-</cpuTest>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-2-result.xml b/tests/cputestdata/x86_64-baseline-2-result.xml
|
||||
deleted file mode 100644
|
||||
index a11352d0b1..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-2-result.xml
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>core2duo</model>
|
||||
- <feature policy='disable' name='nx'/>
|
||||
-</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-2.xml b/tests/cputestdata/x86_64-baseline-2.xml
|
||||
deleted file mode 100644
|
||||
index 055223fd34..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-2.xml
|
||||
+++ /dev/null
|
||||
@@ -1,22 +0,0 @@
|
||||
-<cpuTest>
|
||||
-<cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>core2duo</model>
|
||||
- <topology sockets='1' cores='2' threads='1'/>
|
||||
-</cpu>
|
||||
-<cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>pentiumpro</model>
|
||||
- <topology sockets='1' cores='2' threads='1'/>
|
||||
- <feature name='mtrr'/>
|
||||
- <feature name='clflush'/>
|
||||
- <feature name='mca'/>
|
||||
- <feature name='vme'/>
|
||||
- <feature name='pse36'/>
|
||||
- <feature name='pni'/>
|
||||
- <feature name='monitor'/>
|
||||
- <feature name='ssse3'/>
|
||||
- <feature name='lm'/>
|
||||
- <feature name='syscall'/>
|
||||
-</cpu>
|
||||
-</cpuTest>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-5-expanded.xml b/tests/cputestdata/x86_64-baseline-5-expanded.xml
|
||||
deleted file mode 100644
|
||||
index 2c1b400150..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-5-expanded.xml
|
||||
+++ /dev/null
|
||||
@@ -1,47 +0,0 @@
|
||||
-<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>SandyBridge</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <feature policy='require' name='aes'/>
|
||||
- <feature policy='require' name='apic'/>
|
||||
- <feature policy='require' name='avx'/>
|
||||
- <feature policy='require' name='clflush'/>
|
||||
- <feature policy='require' name='cmov'/>
|
||||
- <feature policy='require' name='cx16'/>
|
||||
- <feature policy='require' name='cx8'/>
|
||||
- <feature policy='require' name='de'/>
|
||||
- <feature policy='require' name='fpu'/>
|
||||
- <feature policy='require' name='fxsr'/>
|
||||
- <feature policy='require' name='hypervisor'/>
|
||||
- <feature policy='require' name='lahf_lm'/>
|
||||
- <feature policy='require' name='lm'/>
|
||||
- <feature policy='require' name='mca'/>
|
||||
- <feature policy='require' name='mce'/>
|
||||
- <feature policy='require' name='mmx'/>
|
||||
- <feature policy='require' name='msr'/>
|
||||
- <feature policy='require' name='mtrr'/>
|
||||
- <feature policy='require' name='nx'/>
|
||||
- <feature policy='require' name='osxsave'/>
|
||||
- <feature policy='require' name='pae'/>
|
||||
- <feature policy='require' name='pat'/>
|
||||
- <feature policy='require' name='pcid'/>
|
||||
- <feature policy='require' name='pclmuldq'/>
|
||||
- <feature policy='require' name='pge'/>
|
||||
- <feature policy='require' name='pni'/>
|
||||
- <feature policy='require' name='popcnt'/>
|
||||
- <feature policy='require' name='pse'/>
|
||||
- <feature policy='require' name='pse36'/>
|
||||
- <feature policy='disable' name='rdtscp'/>
|
||||
- <feature policy='require' name='sep'/>
|
||||
- <feature policy='require' name='ss'/>
|
||||
- <feature policy='require' name='sse'/>
|
||||
- <feature policy='require' name='sse2'/>
|
||||
- <feature policy='require' name='sse4.1'/>
|
||||
- <feature policy='require' name='sse4.2'/>
|
||||
- <feature policy='require' name='ssse3'/>
|
||||
- <feature policy='require' name='syscall'/>
|
||||
- <feature policy='require' name='tsc'/>
|
||||
- <feature policy='require' name='tsc-deadline'/>
|
||||
- <feature policy='require' name='vme'/>
|
||||
- <feature policy='require' name='x2apic'/>
|
||||
- <feature policy='require' name='xsave'/>
|
||||
-</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-5-result.xml b/tests/cputestdata/x86_64-baseline-5-result.xml
|
||||
deleted file mode 100644
|
||||
index 775a27de2e..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-5-result.xml
|
||||
+++ /dev/null
|
||||
@@ -1,10 +0,0 @@
|
||||
-<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>SandyBridge</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <feature policy='require' name='vme'/>
|
||||
- <feature policy='require' name='ss'/>
|
||||
- <feature policy='require' name='pcid'/>
|
||||
- <feature policy='require' name='osxsave'/>
|
||||
- <feature policy='require' name='hypervisor'/>
|
||||
- <feature policy='disable' name='rdtscp'/>
|
||||
-</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-5.xml b/tests/cputestdata/x86_64-baseline-5.xml
|
||||
deleted file mode 100644
|
||||
index 80cd533ca4..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-5.xml
|
||||
+++ /dev/null
|
||||
@@ -1,35 +0,0 @@
|
||||
-<cpuTest>
|
||||
-<cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>Westmere</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='4' cores='1' threads='1'/>
|
||||
- <feature name='hypervisor'/>
|
||||
- <feature name='avx'/>
|
||||
- <feature name='osxsave'/>
|
||||
- <feature name='xsave'/>
|
||||
- <feature name='tsc-deadline'/>
|
||||
- <feature name='x2apic'/>
|
||||
- <feature name='pcid'/>
|
||||
- <feature name='pclmuldq'/>
|
||||
- <feature name='ss'/>
|
||||
- <feature name='vme'/>
|
||||
-</cpu>
|
||||
-<cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>Nehalem</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='4' cores='1' threads='1'/>
|
||||
- <feature name='aes'/>
|
||||
- <feature name='hypervisor'/>
|
||||
- <feature name='avx'/>
|
||||
- <feature name='osxsave'/>
|
||||
- <feature name='xsave'/>
|
||||
- <feature name='tsc-deadline'/>
|
||||
- <feature name='x2apic'/>
|
||||
- <feature name='pcid'/>
|
||||
- <feature name='pclmuldq'/>
|
||||
- <feature name='ss'/>
|
||||
- <feature name='vme'/>
|
||||
-</cpu>
|
||||
-</cpuTest>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-7-result.xml b/tests/cputestdata/x86_64-baseline-7-result.xml
|
||||
deleted file mode 100644
|
||||
index 2af549e77a..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-7-result.xml
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>Haswell-noTSX</model>
|
||||
- <vendor>Intel</vendor>
|
||||
-</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-7.xml b/tests/cputestdata/x86_64-baseline-7.xml
|
||||
deleted file mode 100644
|
||||
index b7e61b160c..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-7.xml
|
||||
+++ /dev/null
|
||||
@@ -1,24 +0,0 @@
|
||||
-<cpuTest>
|
||||
- <cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>SandyBridge</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='1' cores='2' threads='2'/>
|
||||
- <feature name='invpcid'/>
|
||||
- <feature name='erms'/>
|
||||
- <feature name='bmi2'/>
|
||||
- <feature name='smep'/>
|
||||
- <feature name='avx2'/>
|
||||
- <feature name='bmi1'/>
|
||||
- <feature name='fsgsbase'/>
|
||||
- <feature name='movbe'/>
|
||||
- <feature name='pcid'/>
|
||||
- <feature name='fma'/>
|
||||
- </cpu>
|
||||
- <cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>Haswell-noTSX</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='1' cores='2' threads='2'/>
|
||||
- </cpu>
|
||||
-</cpuTest>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-8-result.xml b/tests/cputestdata/x86_64-baseline-8-result.xml
|
||||
deleted file mode 100644
|
||||
index 88226b3dab..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-8-result.xml
|
||||
+++ /dev/null
|
||||
@@ -1,4 +0,0 @@
|
||||
-<cpu mode='custom' match='exact'>
|
||||
- <model fallback='allow'>Broadwell-noTSX</model>
|
||||
- <vendor>Intel</vendor>
|
||||
-</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-8.xml b/tests/cputestdata/x86_64-baseline-8.xml
|
||||
deleted file mode 100644
|
||||
index f1ee67d542..0000000000
|
||||
--- a/tests/cputestdata/x86_64-baseline-8.xml
|
||||
+++ /dev/null
|
||||
@@ -1,28 +0,0 @@
|
||||
-<cpuTest>
|
||||
- <cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>SandyBridge</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='1' cores='2' threads='2'/>
|
||||
- <feature name='invpcid'/>
|
||||
- <feature name='erms'/>
|
||||
- <feature name='bmi2'/>
|
||||
- <feature name='smep'/>
|
||||
- <feature name='avx2'/>
|
||||
- <feature name='bmi1'/>
|
||||
- <feature name='fsgsbase'/>
|
||||
- <feature name='movbe'/>
|
||||
- <feature name='pcid'/>
|
||||
- <feature name='fma'/>
|
||||
- <feature name='3dnowprefetch'/>
|
||||
- <feature name='rdseed'/>
|
||||
- <feature name='adx'/>
|
||||
- <feature name='smap'/>
|
||||
- </cpu>
|
||||
- <cpu>
|
||||
- <arch>x86_64</arch>
|
||||
- <model>Broadwell-noTSX</model>
|
||||
- <vendor>Intel</vendor>
|
||||
- <topology sockets='1' cores='2' threads='2'/>
|
||||
- </cpu>
|
||||
-</cpuTest>
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
From 6cf9cd8f6d9e90eadd58d8a37129e7401876e4e8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6cf9cd8f6d9e90eadd58d8a37129e7401876e4e8@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 4 May 2022 16:28:03 +0200
|
||||
Subject: [PATCH] cputest: Give better names to baseline tests
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 3daa68e26514dc114d71f4c44f7d728e93a53cd0)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1851227
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
tests/cputest.c | 12 ++++++------
|
||||
... x86_64-baseline-Westmere+Nehalem-migratable.xml} | 0
|
||||
...l => x86_64-baseline-Westmere+Nehalem-result.xml} | 0
|
||||
...ne-6.xml => x86_64-baseline-Westmere+Nehalem.xml} | 0
|
||||
...ded.xml => x86_64-baseline-features-expanded.xml} | 0
|
||||
...esult.xml => x86_64-baseline-features-result.xml} | 0
|
||||
...4-baseline-4.xml => x86_64-baseline-features.xml} | 0
|
||||
...anded.xml => x86_64-baseline-simple-expanded.xml} | 0
|
||||
...-result.xml => x86_64-baseline-simple-result.xml} | 0
|
||||
..._64-baseline-3.xml => x86_64-baseline-simple.xml} | 0
|
||||
10 files changed, 6 insertions(+), 6 deletions(-)
|
||||
rename tests/cputestdata/{x86_64-baseline-6-migratable.xml => x86_64-baseline-Westmere+Nehalem-migratable.xml} (100%)
|
||||
rename tests/cputestdata/{x86_64-baseline-6-result.xml => x86_64-baseline-Westmere+Nehalem-result.xml} (100%)
|
||||
rename tests/cputestdata/{x86_64-baseline-6.xml => x86_64-baseline-Westmere+Nehalem.xml} (100%)
|
||||
rename tests/cputestdata/{x86_64-baseline-4-expanded.xml => x86_64-baseline-features-expanded.xml} (100%)
|
||||
rename tests/cputestdata/{x86_64-baseline-4-result.xml => x86_64-baseline-features-result.xml} (100%)
|
||||
rename tests/cputestdata/{x86_64-baseline-4.xml => x86_64-baseline-features.xml} (100%)
|
||||
rename tests/cputestdata/{x86_64-baseline-3-expanded.xml => x86_64-baseline-simple-expanded.xml} (100%)
|
||||
rename tests/cputestdata/{x86_64-baseline-3-result.xml => x86_64-baseline-simple-result.xml} (100%)
|
||||
rename tests/cputestdata/{x86_64-baseline-3.xml => x86_64-baseline-simple.xml} (100%)
|
||||
|
||||
diff --git a/tests/cputest.c b/tests/cputest.c
|
||||
index 20d56836be..b939e20718 100644
|
||||
--- a/tests/cputest.c
|
||||
+++ b/tests/cputest.c
|
||||
@@ -1051,12 +1051,12 @@ mymain(void)
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "incompatible-vendors", 0, -1);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "no-vendor", 0, 0);
|
||||
DO_TEST_BASELINE(VIR_ARCH_X86_64, "some-vendors", 0, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "3", 0, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "3", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "4", 0, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "4", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "6", 0, 0);
|
||||
- DO_TEST_BASELINE(VIR_ARCH_X86_64, "6", VIR_CONNECT_BASELINE_CPU_MIGRATABLE, 0);
|
||||
+ DO_TEST_BASELINE(VIR_ARCH_X86_64, "simple", 0, 0);
|
||||
+ DO_TEST_BASELINE(VIR_ARCH_X86_64, "simple", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
|
||||
+ DO_TEST_BASELINE(VIR_ARCH_X86_64, "features", 0, 0);
|
||||
+ DO_TEST_BASELINE(VIR_ARCH_X86_64, "features", VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, 0);
|
||||
+ DO_TEST_BASELINE(VIR_ARCH_X86_64, "Westmere+Nehalem", 0, 0);
|
||||
+ DO_TEST_BASELINE(VIR_ARCH_X86_64, "Westmere+Nehalem", VIR_CONNECT_BASELINE_CPU_MIGRATABLE, 0);
|
||||
|
||||
DO_TEST_BASELINE(VIR_ARCH_PPC64, "incompatible-vendors", 0, -1);
|
||||
DO_TEST_BASELINE(VIR_ARCH_PPC64, "no-vendor", 0, 0);
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-6-migratable.xml b/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-migratable.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-6-migratable.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-Westmere+Nehalem-migratable.xml
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-6-result.xml b/tests/cputestdata/x86_64-baseline-Westmere+Nehalem-result.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-6-result.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-Westmere+Nehalem-result.xml
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-6.xml b/tests/cputestdata/x86_64-baseline-Westmere+Nehalem.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-6.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-Westmere+Nehalem.xml
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-4-expanded.xml b/tests/cputestdata/x86_64-baseline-features-expanded.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-4-expanded.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-features-expanded.xml
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-4-result.xml b/tests/cputestdata/x86_64-baseline-features-result.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-4-result.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-features-result.xml
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-4.xml b/tests/cputestdata/x86_64-baseline-features.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-4.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-features.xml
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-3-expanded.xml b/tests/cputestdata/x86_64-baseline-simple-expanded.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-3-expanded.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-simple-expanded.xml
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-3-result.xml b/tests/cputestdata/x86_64-baseline-simple-result.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-3-result.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-simple-result.xml
|
||||
diff --git a/tests/cputestdata/x86_64-baseline-3.xml b/tests/cputestdata/x86_64-baseline-simple.xml
|
||||
similarity index 100%
|
||||
rename from tests/cputestdata/x86_64-baseline-3.xml
|
||||
rename to tests/cputestdata/x86_64-baseline-simple.xml
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
From 8363046dd5f3e018aaea7b6d9b711fb3d1e417cc Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <8363046dd5f3e018aaea7b6d9b711fb3d1e417cc@dist-git>
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Fri, 7 Jan 2022 14:35:10 -0700
|
||||
Subject: [PATCH] docs: Add man page for libvirt-guests
|
||||
|
||||
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
(cherry picked from commit 161727417a91bdddf8f3167cf70c3de2829be81c)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2042529
|
||||
---
|
||||
docs/manpages/index.rst | 1 +
|
||||
docs/manpages/libvirt-guests.rst | 151 +++++++++++++++++++++++++++++++
|
||||
docs/manpages/meson.build | 1 +
|
||||
libvirt.spec.in | 1 +
|
||||
tools/libvirt-guests.service.in | 2 +-
|
||||
5 files changed, 155 insertions(+), 1 deletion(-)
|
||||
create mode 100644 docs/manpages/libvirt-guests.rst
|
||||
|
||||
diff --git a/docs/manpages/index.rst b/docs/manpages/index.rst
|
||||
index fb4a36d46a..8fd0d90041 100644
|
||||
--- a/docs/manpages/index.rst
|
||||
+++ b/docs/manpages/index.rst
|
||||
@@ -41,6 +41,7 @@ Tools
|
||||
* `virt-admin(1) <virt-admin.html>`__ - daemon administration interface
|
||||
* `virsh(1) <virsh.html>`__ - management user interface
|
||||
* `virt-qemu-run(1) <virt-qemu-run.html>`__ - run standalone QEMU instances
|
||||
+* `libvirt-guests(8) <libvirt-guests.html>`__ - suspend/resume running libvirt guests
|
||||
|
||||
Key codes
|
||||
=========
|
||||
diff --git a/docs/manpages/libvirt-guests.rst b/docs/manpages/libvirt-guests.rst
|
||||
new file mode 100644
|
||||
index 0000000000..76045ed11a
|
||||
--- /dev/null
|
||||
+++ b/docs/manpages/libvirt-guests.rst
|
||||
@@ -0,0 +1,151 @@
|
||||
+==============
|
||||
+libvirt-guests
|
||||
+==============
|
||||
+
|
||||
+-------------------------------------
|
||||
+suspend/resume running libvirt guests
|
||||
+-------------------------------------
|
||||
+
|
||||
+:Manual section: 8
|
||||
+:Manual group: Virtualization Support
|
||||
+
|
||||
+.. contents::
|
||||
+
|
||||
+SYNOPSIS
|
||||
+========
|
||||
+
|
||||
+``libvirt-guests`` *COMMAND*
|
||||
+
|
||||
+
|
||||
+DESCRIPTION
|
||||
+===========
|
||||
+
|
||||
+``libvirt-guests`` is a service that can be used to coordinate guest and host
|
||||
+lifecyle actions. By default, ``libvirt-guests`` will suspend running guests
|
||||
+when the host shuts down, and restore them to their pre-shutdown state when
|
||||
+the host reboots.
|
||||
+
|
||||
+``libvirt-guests`` is typically under control of systemd. When
|
||||
+``libvirt-guests.service`` is enabled, systemd will call ``libvirt-guests``
|
||||
+with the ``start`` *COMMAND* when the host boots. Conversely, systemd will call
|
||||
+``libvirt-guests`` with the ``stop`` *COMMAND* when the host shuts down.
|
||||
+
|
||||
+``libvirt-guests`` can be used directly. In addition to the ``start`` and
|
||||
+``stop`` *COMMAND*\s, it also supports ``status``, ``restart``, ``condrestart``,
|
||||
+``try-restart``, ``reload``, ``force-reload``, ``gueststatus``, and
|
||||
+``shutdown`` *COMMAND*\s.
|
||||
+
|
||||
+
|
||||
+FILES
|
||||
+=====
|
||||
+
|
||||
+``libvirt-guests`` defines several variables to control service behavior.
|
||||
+The default vaule of these variables can be overridden in:
|
||||
+
|
||||
+* ``@SYSCONFDIR@/sysconfig/libvirt-guests``
|
||||
+
|
||||
+The following variables are supported:
|
||||
+
|
||||
+- URIS=default
|
||||
+
|
||||
+ URIs to check for running guests. Example:
|
||||
+ ``URIS='default xen:///system xen+tcp://host/system lxc:///system'``
|
||||
+
|
||||
+- ON_BOOT=start
|
||||
+
|
||||
+ Action taken on host boot
|
||||
+
|
||||
+ * start
|
||||
+
|
||||
+ All guests which were running on shutdown are started on boot regardless
|
||||
+ of their autostart settings
|
||||
+
|
||||
+ * ignore
|
||||
+
|
||||
+ ``libvirt-guests`` won't start any guest on boot, however, guests marked
|
||||
+ as autostart will still be automatically started by libvirtd
|
||||
+
|
||||
+- START_DELAY=0
|
||||
+
|
||||
+ Number of seconds to wait between each guest start. Set to 0 to allow parallel
|
||||
+ startup.
|
||||
+
|
||||
+- ON_SHUTDOWN=suspend
|
||||
+
|
||||
+ Action taken on host shutdown
|
||||
+
|
||||
+ * suspend
|
||||
+
|
||||
+ All running guests are suspended using virsh managedsave
|
||||
+
|
||||
+ * shutdown
|
||||
+
|
||||
+ All running guests are asked to shutdown. Please be careful with this
|
||||
+ settings since there is no way to distinguish between a guest which is
|
||||
+ stuck or ignores shutdown requests and a guest which just needs a long
|
||||
+ time to shutdown. When setting ON_SHUTDOWN=shutdown, you must also set
|
||||
+ SHUTDOWN_TIMEOUT to a value suitable for your guests.
|
||||
+
|
||||
+- PARALLEL_SHUTDOWN=0
|
||||
+
|
||||
+ Number of guests will be shutdown concurrently, taking effect when
|
||||
+ "ON_SHUTDOWN" is set to "shutdown". If Set to 0, guests will be shutdown one
|
||||
+ after another. Number of guests on shutdown at any time will not exceed number
|
||||
+ set in this variable.
|
||||
+
|
||||
+- SHUTDOWN_TIMEOUT=300
|
||||
+
|
||||
+ Number of seconds we're willing to wait for a guest to shut down. If parallel
|
||||
+ shutdown is enabled, this timeout applies as a timeout for shutting down all
|
||||
+ guests on a single URI defined in the variable URIS. If this is 0, then there
|
||||
+ is no time out (use with caution, as guests might not respond to a shutdown
|
||||
+ request). The default value is 300 seconds (5 minutes).
|
||||
+
|
||||
+- BYPASS_CACHE=0
|
||||
+
|
||||
+ If non-zero, try to bypass the file system cache when saving and
|
||||
+ restoring guests, even though this may give slower operation for
|
||||
+ some file systems.
|
||||
+
|
||||
+- SYNC_TIME=0
|
||||
+
|
||||
+ If non-zero, try to sync guest time on domain resume. Be aware, that
|
||||
+ this requires guest agent with support for time synchronization
|
||||
+ running in the guest. By default, this functionality is turned off.
|
||||
+
|
||||
+
|
||||
+BUGS
|
||||
+====
|
||||
+
|
||||
+Please report all bugs you discover. This should be done via either:
|
||||
+
|
||||
+#. the mailing list
|
||||
+
|
||||
+ `https://libvirt.org/contact.html <https://libvirt.org/contact.html>`_
|
||||
+
|
||||
+#. the bug tracker
|
||||
+
|
||||
+ `https://libvirt.org/bugs.html <https://libvirt.org/bugs.html>`_
|
||||
+
|
||||
+Alternatively, you may report bugs to your software distributor / vendor.
|
||||
+
|
||||
+
|
||||
+AUTHORS
|
||||
+=======
|
||||
+
|
||||
+Please refer to the AUTHORS file distributed with libvirt.
|
||||
+
|
||||
+
|
||||
+LICENSE
|
||||
+=======
|
||||
+
|
||||
+``libvirt-guests`` is distributed under the terms of the GNU LGPL v2.1+.
|
||||
+This is free software; see the source for copying conditions. There
|
||||
+is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
+PURPOSE
|
||||
+
|
||||
+
|
||||
+SEE ALSO
|
||||
+========
|
||||
+
|
||||
+libvirtd(8), `https://libvirt.org/ <https://libvirt.org/>`_
|
||||
diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build
|
||||
index 150f45d296..bad9b62a2e 100644
|
||||
--- a/docs/manpages/meson.build
|
||||
+++ b/docs/manpages/meson.build
|
||||
@@ -21,6 +21,7 @@ docs_man_files = [
|
||||
{ 'name': 'virt-qemu-run', 'section': '1', 'install': conf.has('WITH_QEMU') },
|
||||
{ 'name': 'virt-xml-validate', 'section': '1', 'install': true },
|
||||
|
||||
+ { 'name': 'libvirt-guests', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
|
||||
{ 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
|
||||
{ 'name': 'virt-sanlock-cleanup', 'section': '8', 'install': conf.has('WITH_SANLOCK') },
|
||||
{ 'name': 'virt-ssh-helper', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
|
||||
diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
|
||||
index 10c664016a..1a9b233e11 100644
|
||||
--- a/tools/libvirt-guests.service.in
|
||||
+++ b/tools/libvirt-guests.service.in
|
||||
@@ -6,7 +6,7 @@ After=network.target
|
||||
After=time-sync.target
|
||||
After=libvirtd.service
|
||||
After=virt-guest-shutdown.target
|
||||
-Documentation=man:libvirtd(8)
|
||||
+Documentation=man:libvirt-guests(8)
|
||||
Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
--
|
||||
2.35.0
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
From 296343c5a950668d790f9cd5ebd7b466e8156d03 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <296343c5a950668d790f9cd5ebd7b466e8156d03@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 14 Jun 2022 13:23:29 +0200
|
||||
Subject: [PATCH] domain_validate: Split out validation of disk startup policy
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Move the code into 'virDomainDiskDefValidateStartupPolicy' which will be
|
||||
later reused in the qemu driver.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 3603a18bcec18842cedecbd8329723062b87795c)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2095758
|
||||
---
|
||||
src/conf/domain_validate.c | 45 ++++++++++++++++++++++++--------------
|
||||
src/conf/domain_validate.h | 2 ++
|
||||
src/libvirt_private.syms | 1 +
|
||||
3 files changed, 31 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
|
||||
index 452742e67c..bfff7339ef 100644
|
||||
--- a/src/conf/domain_validate.c
|
||||
+++ b/src/conf/domain_validate.c
|
||||
@@ -598,6 +598,32 @@ virDomainDiskDefSourceLUNValidate(const virStorageSource *src)
|
||||
}
|
||||
|
||||
|
||||
+int
|
||||
+virDomainDiskDefValidateStartupPolicy(const virDomainDiskDef *disk)
|
||||
+{
|
||||
+ if (disk->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_DEFAULT)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (disk->src->type == VIR_STORAGE_TYPE_NETWORK) {
|
||||
+ virReportError(VIR_ERR_XML_ERROR,
|
||||
+ _("disk startupPolicy '%s' is not allowed for disk of '%s' type"),
|
||||
+ virDomainStartupPolicyTypeToString(disk->startupPolicy),
|
||||
+ virStorageTypeToString(disk->src->type));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
||||
+ disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
||||
+ disk->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_REQUISITE) {
|
||||
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
+ _("disk startupPolicy 'requisite' is allowed only for cdrom or floppy"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
virDomainDiskDefValidate(const virDomainDef *def,
|
||||
const virDomainDiskDef *disk)
|
||||
@@ -775,23 +801,8 @@ virDomainDiskDefValidate(const virDomainDef *def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (disk->startupPolicy != VIR_DOMAIN_STARTUP_POLICY_DEFAULT) {
|
||||
- if (disk->src->type == VIR_STORAGE_TYPE_NETWORK) {
|
||||
- virReportError(VIR_ERR_XML_ERROR,
|
||||
- _("disk startupPolicy '%s' is not allowed for disk of '%s' type"),
|
||||
- virDomainStartupPolicyTypeToString(disk->startupPolicy),
|
||||
- virStorageTypeToString(disk->src->type));
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
||||
- disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
||||
- disk->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_REQUISITE) {
|
||||
- virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
- _("disk startupPolicy 'requisite' is allowed only for cdrom or floppy"));
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
+ if (virDomainDiskDefValidateStartupPolicy(disk) < 0)
|
||||
+ return -1;
|
||||
|
||||
if (disk->wwn && !virValidateWWN(disk->wwn))
|
||||
return -1;
|
||||
diff --git a/src/conf/domain_validate.h b/src/conf/domain_validate.h
|
||||
index 430d61fd3c..07b99195e3 100644
|
||||
--- a/src/conf/domain_validate.h
|
||||
+++ b/src/conf/domain_validate.h
|
||||
@@ -41,4 +41,6 @@ int virDomainDeviceDefValidate(const virDomainDeviceDef *dev,
|
||||
|
||||
int virDomainDiskDefValidateSource(const virStorageSource *src);
|
||||
|
||||
+int virDomainDiskDefValidateStartupPolicy(const virDomainDiskDef *disk);
|
||||
+
|
||||
int virDomainDiskDefSourceLUNValidate(const virStorageSource *src);
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 2c42e2a5e8..5b7a056151 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -777,6 +777,7 @@ virDomainActualNetDefValidate;
|
||||
virDomainDefValidate;
|
||||
virDomainDeviceValidateAliasForHotplug;
|
||||
virDomainDiskDefSourceLUNValidate;
|
||||
+virDomainDiskDefValidateStartupPolicy;
|
||||
|
||||
|
||||
# conf/interface_conf.h
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
From 08ddc711a2e6d94a0fce55fec8e012a434655d2c Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <08ddc711a2e6d94a0fce55fec8e012a434655d2c.1690812875.git.jdenemar@redhat.com>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Fri, 1 Apr 2022 14:30:05 +0200
|
||||
Subject: [PATCH] lib: Set up cpuset controller for restrictive numatune
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The aim of 'restrictive' numatune mode is to rely solely on
|
||||
CGroups to have QEMU running on configured NUMA nodes. However,
|
||||
we were never setting the cpuset controller when a domain was
|
||||
starting up. We are doing so only when
|
||||
virDomainSetNumaParameters() is called (aka live pinning).
|
||||
|
||||
This is obviously wrong. Fortunately, fix is simple as
|
||||
'restrictive' is similar to 'strict' - every location where
|
||||
VIR_DOMAIN_NUMATUNE_MEM_STRICT occurs can be audited and
|
||||
VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE case can be added.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2070380
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 629282d8845407c1aff9a26f5dc026e15121f8cd)
|
||||
|
||||
Conflicts:
|
||||
- src/ch/ch_process.c: The CH driver diverged because it's
|
||||
unsupported downstream. Just drop the conflicting hunk from
|
||||
there.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2223464
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/lxc/lxc_controller.c | 3 ++-
|
||||
src/qemu/qemu_process.c | 6 ++++--
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
|
||||
index 3c930eaacd..6fd8373256 100644
|
||||
--- a/src/lxc/lxc_controller.c
|
||||
+++ b/src/lxc/lxc_controller.c
|
||||
@@ -812,7 +812,8 @@ static int virLXCControllerSetupResourceLimits(virLXCController *ctrl)
|
||||
virDomainNumatuneMemMode mode;
|
||||
|
||||
if (virDomainNumatuneGetMode(ctrl->def->numa, -1, &mode) == 0) {
|
||||
- if (mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT &&
|
||||
+ if ((mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT ||
|
||||
+ mode == VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) &&
|
||||
virCgroupControllerAvailable(VIR_CGROUP_CONTROLLER_CPUSET)) {
|
||||
/* Use virNuma* API iff necessary. Once set and child is exec()-ed,
|
||||
* there's no way for us to change it. Rely on cgroups (if available
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 0fb665bc82..73d54f01cd 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -2645,7 +2645,8 @@ qemuProcessSetupPid(virDomainObj *vm,
|
||||
virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) {
|
||||
|
||||
if (virDomainNumatuneGetMode(vm->def->numa, -1, &mem_mode) == 0 &&
|
||||
- mem_mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT &&
|
||||
+ (mem_mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT ||
|
||||
+ mem_mode == VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) &&
|
||||
virDomainNumatuneMaybeFormatNodeset(vm->def->numa,
|
||||
priv->autoNodeset,
|
||||
&mem_mask, -1) < 0)
|
||||
@@ -3162,7 +3163,8 @@ static int qemuProcessHook(void *data)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainNumatuneGetMode(h->vm->def->numa, -1, &mode) == 0) {
|
||||
- if (mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT &&
|
||||
+ if ((mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT ||
|
||||
+ mode == VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) &&
|
||||
h->cfg->cgroupControllers & (1 << VIR_CGROUP_CONTROLLER_CPUSET) &&
|
||||
virCgroupControllerAvailable(VIR_CGROUP_CONTROLLER_CPUSET)) {
|
||||
/* Use virNuma* API iff necessary. Once set and child is exec()-ed,
|
||||
--
|
||||
2.41.0
|
|
@ -0,0 +1,84 @@
|
|||
From 71a79a215d278d83f3cd3da330e0378209983b6b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <71a79a215d278d83f3cd3da330e0378209983b6b@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Wed, 26 Jan 2022 14:00:13 +0100
|
||||
Subject: [PATCH] node_device: Rework udevKludgeStorageType()
|
||||
|
||||
The udevKludgeStorageType() function looks at devlink name
|
||||
(/dev/XXX) and guesses the type of the (storage) device using a
|
||||
series of STRPREFIX() calls. Well those can be turn into an array
|
||||
and a for() loop, especially if we are about to add a new case
|
||||
(in the next commit).
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit ec9e2adb961f2e1a121f47e7985142e827f3347b)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2056673
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/node_device/node_device_udev.c | 43 ++++++++++++++++--------------
|
||||
1 file changed, 23 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index cd1722f934..dd18401e78 100644
|
||||
--- a/src/node_device/node_device_udev.c
|
||||
+++ b/src/node_device/node_device_udev.c
|
||||
@@ -890,32 +890,35 @@ udevProcessDASD(struct udev_device *device,
|
||||
static int
|
||||
udevKludgeStorageType(virNodeDeviceDef *def)
|
||||
{
|
||||
+ size_t i;
|
||||
+ const struct {
|
||||
+ const char *prefix;
|
||||
+ const char *subst;
|
||||
+ } fixups[] = {
|
||||
+ /* virtio disk */
|
||||
+ { "/dev/vd", "disk" },
|
||||
+
|
||||
+ /* For Direct Access Storage Devices (DASDs) there are
|
||||
+ * currently no identifiers in udev besides ID_PATH. Since
|
||||
+ * ID_TYPE=disk does not exist on DASDs they fall through
|
||||
+ * the udevProcessStorage detection logic. */
|
||||
+ { "/dev/dasd", "dasd" },
|
||||
+ };
|
||||
+
|
||||
VIR_DEBUG("Could not find definitive storage type for device "
|
||||
"with sysfs path '%s', trying to guess it",
|
||||
def->sysfs_path);
|
||||
|
||||
- /* virtio disk */
|
||||
- if (STRPREFIX(def->caps->data.storage.block, "/dev/vd")) {
|
||||
- def->caps->data.storage.drive_type = g_strdup("disk");
|
||||
- VIR_DEBUG("Found storage type '%s' for device "
|
||||
- "with sysfs path '%s'",
|
||||
- def->caps->data.storage.drive_type,
|
||||
- def->sysfs_path);
|
||||
- return 0;
|
||||
+ for (i = 0; i < G_N_ELEMENTS(fixups); i++) {
|
||||
+ if (STRPREFIX(def->caps->data.storage.block, fixups[i].prefix)) {
|
||||
+ def->caps->data.storage.drive_type = g_strdup(fixups[i].subst);
|
||||
+ VIR_DEBUG("Found storage type '%s' for device with sysfs path '%s'",
|
||||
+ def->caps->data.storage.drive_type,
|
||||
+ def->sysfs_path);
|
||||
+ return 0;
|
||||
+ }
|
||||
}
|
||||
|
||||
- /* For Direct Access Storage Devices (DASDs) there are
|
||||
- * currently no identifiers in udev besides ID_PATH. Since
|
||||
- * ID_TYPE=disk does not exist on DASDs they fall through
|
||||
- * the udevProcessStorage detection logic. */
|
||||
- if (STRPREFIX(def->caps->data.storage.block, "/dev/dasd")) {
|
||||
- def->caps->data.storage.drive_type = g_strdup("dasd");
|
||||
- VIR_DEBUG("Found storage type '%s' for device "
|
||||
- "with sysfs path '%s'",
|
||||
- def->caps->data.storage.drive_type,
|
||||
- def->sysfs_path);
|
||||
- return 0;
|
||||
- }
|
||||
VIR_DEBUG("Could not determine storage type "
|
||||
"for device with sysfs path '%s'", def->sysfs_path);
|
||||
return -1;
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From c04c7a986bd3514730e4169bf1a70bbec1fda006 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c04c7a986bd3514730e4169bf1a70bbec1fda006@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Wed, 26 Jan 2022 13:47:33 +0100
|
||||
Subject: [PATCH] node_device: Treat NVMe disks as regular disks
|
||||
|
||||
Unfortunately, udev doesn't set ID_TYPE attribute for NVMe disks,
|
||||
therefore we have to add another case into udevKludgeStorageType()
|
||||
to treat /dev/nvme* devlinks as any other disk.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2045953
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit f103976ff34a52298df1810d82ececa3e7da4291)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2056673
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/node_device/node_device_udev.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index dd18401e78..a9e8bf10da 100644
|
||||
--- a/src/node_device/node_device_udev.c
|
||||
+++ b/src/node_device/node_device_udev.c
|
||||
@@ -903,6 +903,11 @@ udevKludgeStorageType(virNodeDeviceDef *def)
|
||||
* ID_TYPE=disk does not exist on DASDs they fall through
|
||||
* the udevProcessStorage detection logic. */
|
||||
{ "/dev/dasd", "dasd" },
|
||||
+
|
||||
+ /* NVMe disk. While strictly speaking /dev/nvme is a
|
||||
+ * controller not a disk, this function is called if and
|
||||
+ * only if @def is of VIR_NODE_DEV_CAP_STORAGE type. */
|
||||
+ { "/dev/nvme", "disk" },
|
||||
};
|
||||
|
||||
VIR_DEBUG("Could not find definitive storage type for device "
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
From 989a569c9c9da0fbf89aab7f292669366b2503f1 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <989a569c9c9da0fbf89aab7f292669366b2503f1@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Wed, 30 Nov 2022 14:53:21 +0100
|
||||
Subject: [PATCH] node_device_conf: Avoid memleak in
|
||||
virNodeDeviceGetPCIVPDDynamicCap()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virNodeDeviceGetPCIVPDDynamicCap() function is called from
|
||||
virNodeDeviceGetPCIDynamicCaps() and therefore has to be a wee
|
||||
bit more clever about adding VPD capability. Namely, it has to
|
||||
remove the old one before adding a new one. This is how other
|
||||
functions called from virNodeDeviceGetPCIDynamicCaps() behave
|
||||
as well.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2143235
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit 64d32118540aca3d42bc5ee21c8b780cafe04bfa)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2023-2700
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/conf/node_device_conf.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
||||
index 16b9497faf..eee94a3900 100644
|
||||
--- a/src/conf/node_device_conf.c
|
||||
+++ b/src/conf/node_device_conf.c
|
||||
@@ -3100,6 +3100,9 @@ virNodeDeviceGetPCIVPDDynamicCap(virNodeDevCapPCIDev *devCapPCIDev)
|
||||
virPCIDeviceAddress devAddr;
|
||||
g_autoptr(virPCIVPDResource) res = NULL;
|
||||
|
||||
+ g_clear_pointer(&devCapPCIDev->vpd, virPCIVPDResourceFree);
|
||||
+ devCapPCIDev->flags &= ~VIR_NODE_DEV_CAP_FLAG_PCI_VPD;
|
||||
+
|
||||
devAddr.domain = devCapPCIDev->domain;
|
||||
devAddr.bus = devCapPCIDev->bus;
|
||||
devAddr.slot = devCapPCIDev->slot;
|
||||
@@ -3113,8 +3116,6 @@ virNodeDeviceGetPCIVPDDynamicCap(virNodeDevCapPCIDev *devCapPCIDev)
|
||||
if ((res = virPCIDeviceGetVPD(pciDev))) {
|
||||
devCapPCIDev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VPD;
|
||||
devCapPCIDev->vpd = g_steal_pointer(&res);
|
||||
- } else {
|
||||
- virPCIVPDResourceFree(g_steal_pointer(&devCapPCIDev->vpd));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
--
|
||||
2.40.1
|
|
@ -0,0 +1,151 @@
|
|||
From 5921eeddf0a284ccbec04896901c9bd4177de6dd Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <5921eeddf0a284ccbec04896901c9bd4177de6dd@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:15 +0200
|
||||
Subject: [PATCH] nodedev: add optional device address of channel device to css
|
||||
device
|
||||
|
||||
Add the new introduced sysfs attribute dev_busid which provides the address
|
||||
of the device in the subchannel independent from the bound device driver.
|
||||
It is added if available in the sysfs as optional channel_dev_addr element into
|
||||
the css device capabilty providing the ccw deivce address attributes cssid,
|
||||
ssid and devno.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 122b975e4004c83b6fc442ec6cdfd71eb5b55cc4)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
docs/schemas/nodedev.rng | 5 +++++
|
||||
src/conf/node_device_conf.c | 28 ++++++++++++++++++++++++++++
|
||||
src/conf/node_device_conf.h | 2 ++
|
||||
src/node_device/node_device_udev.c | 8 ++++++++
|
||||
4 files changed, 43 insertions(+)
|
||||
|
||||
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
|
||||
index 29515d2d7e..43f1abc247 100644
|
||||
--- a/docs/schemas/nodedev.rng
|
||||
+++ b/docs/schemas/nodedev.rng
|
||||
@@ -677,6 +677,11 @@
|
||||
<value>css</value>
|
||||
</attribute>
|
||||
<ref name="capccwaddress"/>
|
||||
+ <optional>
|
||||
+ <element name="channel_dev_addr">
|
||||
+ <ref name="capccwaddress"/>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
<optional>
|
||||
<ref name="mdev_types"/>
|
||||
</optional>
|
||||
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
||||
index fcb5be24e1..16b9497faf 100644
|
||||
--- a/src/conf/node_device_conf.c
|
||||
+++ b/src/conf/node_device_conf.c
|
||||
@@ -643,6 +643,17 @@ virNodeDeviceCapCSSDefFormat(virBuffer *buf,
|
||||
|
||||
virNodeDeviceCapCCWDefFormat(buf, data);
|
||||
|
||||
+ if (ccw_dev.channel_dev_addr) {
|
||||
+ virCCWDeviceAddress *ccw = ccw_dev.channel_dev_addr;
|
||||
+ virBufferAddLit(buf, "<channel_dev_addr>\n");
|
||||
+ virBufferAdjustIndent(buf, 2);
|
||||
+ virBufferAsprintf(buf, "<cssid>0x%x</cssid>\n", ccw->cssid);
|
||||
+ virBufferAsprintf(buf, "<ssid>0x%x</ssid>\n", ccw->ssid);
|
||||
+ virBufferAsprintf(buf, "<devno>0x%04x</devno>\n", ccw->devno);
|
||||
+ virBufferAdjustIndent(buf, -2);
|
||||
+ virBufferAddLit(buf, "</channel_dev_addr>\n");
|
||||
+ }
|
||||
+
|
||||
if (ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV)
|
||||
virNodeDeviceCapMdevTypesFormat(buf,
|
||||
ccw_dev.mdev_types,
|
||||
@@ -1255,6 +1266,7 @@ virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt,
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
int n = 0;
|
||||
size_t i = 0;
|
||||
+ xmlNodePtr channel_ddno = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
@@ -1269,6 +1281,21 @@ virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ /* channel_dev_addr is optional */
|
||||
+ if ((channel_ddno = virXPathNode("./channel_dev_addr[1]", ctxt))) {
|
||||
+ g_autofree virCCWDeviceAddress *channel_dev = NULL;
|
||||
+
|
||||
+ channel_dev = g_new0(virCCWDeviceAddress, 1);
|
||||
+
|
||||
+ if (virNodeDevCCWDeviceAddressParseXML(ctxt,
|
||||
+ channel_ddno,
|
||||
+ def->name,
|
||||
+ channel_dev) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ ccw_dev->channel_dev_addr = g_steal_pointer(&channel_dev);
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2637,6 +2664,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDef *caps)
|
||||
for (i = 0; i < data->ccw_dev.nmdev_types; i++)
|
||||
virMediatedDeviceTypeFree(data->ccw_dev.mdev_types[i]);
|
||||
g_free(data->ccw_dev.mdev_types);
|
||||
+ g_free(data->ccw_dev.channel_dev_addr);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_AP_MATRIX:
|
||||
g_free(data->ap_matrix.addr);
|
||||
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
|
||||
index e4d1f67d53..d1751ed874 100644
|
||||
--- a/src/conf/node_device_conf.h
|
||||
+++ b/src/conf/node_device_conf.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "internal.h"
|
||||
#include "virbitmap.h"
|
||||
+#include "virccw.h"
|
||||
#include "virpcivpd.h"
|
||||
#include "virscsihost.h"
|
||||
#include "virpci.h"
|
||||
@@ -279,6 +280,7 @@ struct _virNodeDevCapCCW {
|
||||
unsigned int flags; /* enum virNodeDevCCWCapFlags */
|
||||
virMediatedDeviceType **mdev_types;
|
||||
size_t nmdev_types;
|
||||
+ virCCWDeviceAddress *channel_dev_addr;
|
||||
};
|
||||
|
||||
typedef struct _virNodeDevCapVDPA virNodeDevCapVDPA;
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index ffcb3e8640..611a2592ca 100644
|
||||
--- a/src/node_device/node_device_udev.c
|
||||
+++ b/src/node_device/node_device_udev.c
|
||||
@@ -1128,6 +1128,8 @@ static int
|
||||
udevProcessCSS(struct udev_device *device,
|
||||
virNodeDeviceDef *def)
|
||||
{
|
||||
+ g_autofree char *dev_busid = NULL;
|
||||
+
|
||||
/* only process IO subchannel and vfio-ccw devices to keep the list sane */
|
||||
if (!def->driver ||
|
||||
(STRNEQ(def->driver, "io_subchannel") &&
|
||||
@@ -1139,6 +1141,12 @@ udevProcessCSS(struct udev_device *device,
|
||||
|
||||
udevGenerateDeviceName(device, def, NULL);
|
||||
|
||||
+ /* process optional channel devices information */
|
||||
+ udevGetStringSysfsAttr(device, "dev_busid", &dev_busid);
|
||||
+
|
||||
+ if (dev_busid != NULL)
|
||||
+ def->caps->data.ccw_dev.channel_dev_addr = virCCWDeviceAddressFromString(dev_busid);
|
||||
+
|
||||
if (virNodeDeviceGetCSSDynamicCaps(def->sysfs_path, &def->caps->data.ccw_dev) < 0)
|
||||
return -1;
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
From ea4976de7bccfe8016950d040629a6818a58db4e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ea4976de7bccfe8016950d040629a6818a58db4e@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:16 +0200
|
||||
Subject: [PATCH] nodedev: add tests for optional device address to css device
|
||||
|
||||
Add nodedev schema parsing and format tests for the optional new device
|
||||
address on the css devices.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 127fda5e84790af2c5a16b61a87e339391cccb3b)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
.../css_0_0_10000-invalid.xml | 10 +++++++++
|
||||
...s_0_0_fffe_mdev_types_channel_dev_addr.xml | 22 +++++++++++++++++++
|
||||
.../css_0_0_ffff_channel_dev_addr-invalid.xml | 15 +++++++++++++
|
||||
.../css_0_0_ffff_channel_dev_addr.xml | 15 +++++++++++++
|
||||
...s_0_0_fffe_mdev_types_channel_dev_addr.xml | 1 +
|
||||
.../css_0_0_ffff_channel_dev_addr.xml | 1 +
|
||||
tests/nodedevxml2xmltest.c | 2 ++
|
||||
7 files changed, 66 insertions(+)
|
||||
create mode 100644 tests/nodedevschemadata/css_0_0_10000-invalid.xml
|
||||
create mode 100644 tests/nodedevschemadata/css_0_0_fffe_mdev_types_channel_dev_addr.xml
|
||||
create mode 100644 tests/nodedevschemadata/css_0_0_ffff_channel_dev_addr-invalid.xml
|
||||
create mode 100644 tests/nodedevschemadata/css_0_0_ffff_channel_dev_addr.xml
|
||||
create mode 120000 tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types_channel_dev_addr.xml
|
||||
create mode 120000 tests/nodedevxml2xmlout/css_0_0_ffff_channel_dev_addr.xml
|
||||
|
||||
diff --git a/tests/nodedevschemadata/css_0_0_10000-invalid.xml b/tests/nodedevschemadata/css_0_0_10000-invalid.xml
|
||||
new file mode 100644
|
||||
index 0000000000..740bb489a7
|
||||
--- /dev/null
|
||||
+++ b/tests/nodedevschemadata/css_0_0_10000-invalid.xml
|
||||
@@ -0,0 +1,10 @@
|
||||
+<device>
|
||||
+ <name>css_0_0_10000</name>
|
||||
+ <path>/sys/devices/css0/0.0.10000</path>
|
||||
+ <parent>computer</parent>
|
||||
+ <capability type='css'>
|
||||
+ <cssid>0x0</cssid>
|
||||
+ <ssid>0x0</ssid>
|
||||
+ <devno>0x10000</devno>
|
||||
+ </capability>
|
||||
+</device>
|
||||
diff --git a/tests/nodedevschemadata/css_0_0_fffe_mdev_types_channel_dev_addr.xml b/tests/nodedevschemadata/css_0_0_fffe_mdev_types_channel_dev_addr.xml
|
||||
new file mode 100644
|
||||
index 0000000000..198dcb0cb0
|
||||
--- /dev/null
|
||||
+++ b/tests/nodedevschemadata/css_0_0_fffe_mdev_types_channel_dev_addr.xml
|
||||
@@ -0,0 +1,22 @@
|
||||
+<device>
|
||||
+ <name>css_0_0_fffe</name>
|
||||
+ <path>/sys/devices/css0/0.0.fffe</path>
|
||||
+ <parent>computer</parent>
|
||||
+ <capability type='css'>
|
||||
+ <cssid>0x0</cssid>
|
||||
+ <ssid>0x0</ssid>
|
||||
+ <devno>0xfffe</devno>
|
||||
+ <channel_dev_addr>
|
||||
+ <cssid>0x0</cssid>
|
||||
+ <ssid>0x0</ssid>
|
||||
+ <devno>0x0815</devno>
|
||||
+ </channel_dev_addr>
|
||||
+ <capability type='mdev_types'>
|
||||
+ <type id='vfio_ccw-io'>
|
||||
+ <name>I/O subchannel (Non-QDIO)</name>
|
||||
+ <deviceAPI>vfio-ccw</deviceAPI>
|
||||
+ <availableInstances>1</availableInstances>
|
||||
+ </type>
|
||||
+ </capability>
|
||||
+ </capability>
|
||||
+</device>
|
||||
diff --git a/tests/nodedevschemadata/css_0_0_ffff_channel_dev_addr-invalid.xml b/tests/nodedevschemadata/css_0_0_ffff_channel_dev_addr-invalid.xml
|
||||
new file mode 100644
|
||||
index 0000000000..3f2c5558c7
|
||||
--- /dev/null
|
||||
+++ b/tests/nodedevschemadata/css_0_0_ffff_channel_dev_addr-invalid.xml
|
||||
@@ -0,0 +1,15 @@
|
||||
+<device>
|
||||
+ <name>css_0_0_ffff</name>
|
||||
+ <path>/sys/devices/css0/0.0.ffff</path>
|
||||
+ <parent>computer</parent>
|
||||
+ <capability type='css'>
|
||||
+ <cssid>0x0</cssid>
|
||||
+ <ssid>0x0</ssid>
|
||||
+ <devno>0xffff</devno>
|
||||
+ <channel_dev_addr>
|
||||
+ <cssid>0x0</cssid>
|
||||
+ <ssid>0x0</ssid>
|
||||
+ <devno>0x10000</devno>
|
||||
+ </channel_dev_addr>
|
||||
+ </capability>
|
||||
+</device>
|
||||
diff --git a/tests/nodedevschemadata/css_0_0_ffff_channel_dev_addr.xml b/tests/nodedevschemadata/css_0_0_ffff_channel_dev_addr.xml
|
||||
new file mode 100644
|
||||
index 0000000000..17a77cb282
|
||||
--- /dev/null
|
||||
+++ b/tests/nodedevschemadata/css_0_0_ffff_channel_dev_addr.xml
|
||||
@@ -0,0 +1,15 @@
|
||||
+<device>
|
||||
+ <name>css_0_0_ffff</name>
|
||||
+ <path>/sys/devices/css0/0.0.ffff</path>
|
||||
+ <parent>computer</parent>
|
||||
+ <capability type='css'>
|
||||
+ <cssid>0x0</cssid>
|
||||
+ <ssid>0x0</ssid>
|
||||
+ <devno>0xffff</devno>
|
||||
+ <channel_dev_addr>
|
||||
+ <cssid>0x0</cssid>
|
||||
+ <ssid>0x0</ssid>
|
||||
+ <devno>0x0815</devno>
|
||||
+ </channel_dev_addr>
|
||||
+ </capability>
|
||||
+</device>
|
||||
diff --git a/tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types_channel_dev_addr.xml b/tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types_channel_dev_addr.xml
|
||||
new file mode 120000
|
||||
index 0000000000..65ab582ee8
|
||||
--- /dev/null
|
||||
+++ b/tests/nodedevxml2xmlout/css_0_0_fffe_mdev_types_channel_dev_addr.xml
|
||||
@@ -0,0 +1 @@
|
||||
+../nodedevschemadata/css_0_0_fffe_mdev_types_channel_dev_addr.xml
|
||||
\ No newline at end of file
|
||||
diff --git a/tests/nodedevxml2xmlout/css_0_0_ffff_channel_dev_addr.xml b/tests/nodedevxml2xmlout/css_0_0_ffff_channel_dev_addr.xml
|
||||
new file mode 120000
|
||||
index 0000000000..cbfe719777
|
||||
--- /dev/null
|
||||
+++ b/tests/nodedevxml2xmlout/css_0_0_ffff_channel_dev_addr.xml
|
||||
@@ -0,0 +1 @@
|
||||
+../nodedevschemadata/css_0_0_ffff_channel_dev_addr.xml
|
||||
\ No newline at end of file
|
||||
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
|
||||
index 557347fb07..ad9562cc82 100644
|
||||
--- a/tests/nodedevxml2xmltest.c
|
||||
+++ b/tests/nodedevxml2xmltest.c
|
||||
@@ -125,7 +125,9 @@ mymain(void)
|
||||
DO_TEST("mdev_3627463d_b7f0_4fea_b468_f1da537d301b");
|
||||
DO_TEST("ccw_0_0_ffff");
|
||||
DO_TEST("css_0_0_ffff");
|
||||
+ DO_TEST("css_0_0_ffff_channel_dev_addr");
|
||||
DO_TEST("css_0_0_fffe_mdev_types");
|
||||
+ DO_TEST("css_0_0_fffe_mdev_types_channel_dev_addr");
|
||||
DO_TEST("ap_card07");
|
||||
DO_TEST("ap_07_0038");
|
||||
DO_TEST("ap_matrix");
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
From d82e4473a66da27d2c6f41f8ecadacbd00f44430 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d82e4473a66da27d2c6f41f8ecadacbd00f44430@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:00 +0200
|
||||
Subject: [PATCH] nodedev: fix reported error msg in css cap XML parsing
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 78094a4bd1562fec73ae99c67ddcbedd83953d5c)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/node_device_conf.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
||||
index 0bac0fde8d..a6ebf4b66f 100644
|
||||
--- a/src/conf/node_device_conf.c
|
||||
+++ b/src/conf/node_device_conf.c
|
||||
@@ -1193,7 +1193,7 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
||||
if (virStrToLong_uip(ssid, NULL, 0, &ccw_dev->ssid) < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("invalid ssid value '%s' for '%s'"),
|
||||
- cssid, def->name);
|
||||
+ ssid, def->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
From 7c60078d7a6442dc8cb5a711876d28f70d892bff Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <7c60078d7a6442dc8cb5a711876d28f70d892bff@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Mon, 23 May 2022 17:56:21 +0200
|
||||
Subject: [PATCH] nodedev: prevent internal error on dev_busid parse
|
||||
|
||||
As "none" is a legal value represented in the sysfs attribute dev_busid
|
||||
this patch prevents libvirt from incorrectly reporting an internal error.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Suggested-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit e37c39747be0792d03c450e56ddb3c78d08cbf3e)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/node_device/node_device_udev.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index 611a2592ca..b76e3de681 100644
|
||||
--- a/src/node_device/node_device_udev.c
|
||||
+++ b/src/node_device/node_device_udev.c
|
||||
@@ -1144,7 +1144,7 @@ udevProcessCSS(struct udev_device *device,
|
||||
/* process optional channel devices information */
|
||||
udevGetStringSysfsAttr(device, "dev_busid", &dev_busid);
|
||||
|
||||
- if (dev_busid != NULL)
|
||||
+ if (dev_busid != NULL && STRNEQ(dev_busid, "none"))
|
||||
def->caps->data.ccw_dev.channel_dev_addr = virCCWDeviceAddressFromString(dev_busid);
|
||||
|
||||
if (virNodeDeviceGetCSSDynamicCaps(def->sysfs_path, &def->caps->data.ccw_dev) < 0)
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
From ef8c30a091b5b0f08f9405878b49c21c5525dd0a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ef8c30a091b5b0f08f9405878b49c21c5525dd0a@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:12 +0200
|
||||
Subject: [PATCH] nodedev: refactor ccw device address parsing from XML
|
||||
|
||||
Move ccw device address XML parsing into new method for later reuse.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 4402295d371a62ab8632d23002283b8a7721e6a7)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/node_device_conf.c | 96 ++++++++++++++++++++++---------------
|
||||
1 file changed, 58 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
||||
index 1e00f65717..8982368465 100644
|
||||
--- a/src/conf/node_device_conf.c
|
||||
+++ b/src/conf/node_device_conf.c
|
||||
@@ -1141,6 +1141,58 @@ virNodeDevAPMatrixCapabilityParseXML(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+virNodeDevCCWDeviceAddressParseXML(xmlXPathContextPtr ctxt,
|
||||
+ xmlNodePtr node,
|
||||
+ const char *dev_name,
|
||||
+ virCCWDeviceAddress *ccw_addr)
|
||||
+{
|
||||
+ VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
+ g_autofree char *cssid = NULL;
|
||||
+ g_autofree char *ssid = NULL;
|
||||
+ g_autofree char *devno = NULL;
|
||||
+
|
||||
+ ctxt->node = node;
|
||||
+
|
||||
+ if (!(cssid = virXPathString("string(./cssid[1])", ctxt))) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("missing cssid value for '%s'"), dev_name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (virStrToLong_uip(cssid, NULL, 0, &ccw_addr->cssid) < 0) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("invalid cssid value '%s' for '%s'"),
|
||||
+ cssid, dev_name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!(ssid = virXPathString("string(./ssid[1])", ctxt))) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("missing ssid value for '%s'"), dev_name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (virStrToLong_uip(ssid, NULL, 0, &ccw_addr->ssid) < 0) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("invalid ssid value '%s' for '%s'"),
|
||||
+ ssid, dev_name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!(devno = virXPathString("string(./devno[1])", ctxt))) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("missing devno value for '%s'"), dev_name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (virStrToLong_uip(devno, NULL, 16, &ccw_addr->devno) < 0) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("invalid devno value '%s' for '%s'"),
|
||||
+ devno, dev_name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
@@ -1178,50 +1230,18 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
int n = 0;
|
||||
size_t i = 0;
|
||||
- g_autofree char *cssid = NULL;
|
||||
- g_autofree char *ssid = NULL;
|
||||
- g_autofree char *devno = NULL;
|
||||
+ g_autofree virCCWDeviceAddress *ccw_addr = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
- if (!(cssid = virXPathString("string(./cssid[1])", ctxt))) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
- _("missing cssid value for '%s'"), def->name);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (virStrToLong_uip(cssid, NULL, 0, &ccw_dev->cssid) < 0) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
- _("invalid cssid value '%s' for '%s'"),
|
||||
- cssid, def->name);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (!(ssid = virXPathString("string(./ssid[1])", ctxt))) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
- _("missing ssid value for '%s'"), def->name);
|
||||
- return -1;
|
||||
- }
|
||||
+ ccw_addr = g_new0(virCCWDeviceAddress, 1);
|
||||
|
||||
- if (virStrToLong_uip(ssid, NULL, 0, &ccw_dev->ssid) < 0) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
- _("invalid ssid value '%s' for '%s'"),
|
||||
- ssid, def->name);
|
||||
+ if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr) < 0)
|
||||
return -1;
|
||||
- }
|
||||
|
||||
- if (!(devno = virXPathString("string(./devno[1])", ctxt))) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
- _("missing devno value for '%s'"), def->name);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (virStrToLong_uip(devno, NULL, 16, &ccw_dev->devno) < 0) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
- _("invalid devno value '%s' for '%s'"),
|
||||
- devno, def->name);
|
||||
- return -1;
|
||||
- }
|
||||
+ ccw_dev->cssid = ccw_addr->cssid;
|
||||
+ ccw_dev->ssid = ccw_addr->ssid;
|
||||
+ ccw_dev->devno = ccw_addr->devno;
|
||||
|
||||
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0)
|
||||
return -1;
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
From 286c821eee3b682d6aa4aeaa13aad92382708803 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <286c821eee3b682d6aa4aeaa13aad92382708803@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:13 +0200
|
||||
Subject: [PATCH] nodedev: refactor css XML parsing from ccw XML parsing
|
||||
|
||||
In preparation for easier extension later.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 245ff2d6634b3afb0dbf0d295051e458095bfc80)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/node_device_conf.c | 40 +++++++++++++++++++++++++++----------
|
||||
1 file changed, 30 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
||||
index 8982368465..fcb5be24e1 100644
|
||||
--- a/src/conf/node_device_conf.c
|
||||
+++ b/src/conf/node_device_conf.c
|
||||
@@ -1193,6 +1193,31 @@ virNodeDevCCWDeviceAddressParseXML(xmlXPathContextPtr ctxt,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+
|
||||
+static int
|
||||
+virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
||||
+ virNodeDeviceDef *def,
|
||||
+ xmlNodePtr node,
|
||||
+ virNodeDevCapCCW *ccw_dev)
|
||||
+{
|
||||
+ VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
+ g_autofree virCCWDeviceAddress *ccw_addr = NULL;
|
||||
+
|
||||
+ ctxt->node = node;
|
||||
+
|
||||
+ ccw_addr = g_new0(virCCWDeviceAddress, 1);
|
||||
+
|
||||
+ if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ ccw_dev->cssid = ccw_addr->cssid;
|
||||
+ ccw_dev->ssid = ccw_addr->ssid;
|
||||
+ ccw_dev->devno = ccw_addr->devno;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
@@ -1221,7 +1246,7 @@ virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
|
||||
|
||||
|
||||
static int
|
||||
-virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
||||
+virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDef *def,
|
||||
xmlNodePtr node,
|
||||
virNodeDevCapCCW *ccw_dev)
|
||||
@@ -1230,19 +1255,12 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
int n = 0;
|
||||
size_t i = 0;
|
||||
- g_autofree virCCWDeviceAddress *ccw_addr = NULL;
|
||||
|
||||
ctxt->node = node;
|
||||
|
||||
- ccw_addr = g_new0(virCCWDeviceAddress, 1);
|
||||
-
|
||||
- if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr) < 0)
|
||||
+ if (virNodeDevCapCCWParseXML(ctxt, def, node, ccw_dev) < 0)
|
||||
return -1;
|
||||
|
||||
- ccw_dev->cssid = ccw_addr->cssid;
|
||||
- ccw_dev->ssid = ccw_addr->ssid;
|
||||
- ccw_dev->devno = ccw_addr->devno;
|
||||
-
|
||||
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -2282,9 +2300,11 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
||||
ret = virNodeDevCapMdevParseXML(ctxt, def, node, &caps->data.mdev);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_CCW_DEV:
|
||||
- case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
ret = virNodeDevCapCCWParseXML(ctxt, def, node, &caps->data.ccw_dev);
|
||||
break;
|
||||
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
+ ret = virNodeDevCapCSSParseXML(ctxt, def, node, &caps->data.ccw_dev);
|
||||
+ break;
|
||||
case VIR_NODE_DEV_CAP_AP_CARD:
|
||||
ret = virNodeDevCapAPCardParseXML(ctxt, def, node,
|
||||
&caps->data.ap_card);
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
From d370e2e984b4501060ea0d7a10629db0bfe51ef2 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d370e2e984b4501060ea0d7a10629db0bfe51ef2@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:11 +0200
|
||||
Subject: [PATCH] nodedev: refactor css format from ccw format method
|
||||
|
||||
In preparation for easier extension later.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit c5864885060b136214b4bcef25d604cc3d147014)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/node_device_conf.c | 21 +++++++++++++++++----
|
||||
1 file changed, 17 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
||||
index a6ebf4b66f..1e00f65717 100644
|
||||
--- a/src/conf/node_device_conf.c
|
||||
+++ b/src/conf/node_device_conf.c
|
||||
@@ -632,10 +632,21 @@ virNodeDeviceCapCCWDefFormat(virBuffer *buf,
|
||||
data->ccw_dev.ssid);
|
||||
virBufferAsprintf(buf, "<devno>0x%04x</devno>\n",
|
||||
data->ccw_dev.devno);
|
||||
- if (data->ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV)
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+virNodeDeviceCapCSSDefFormat(virBuffer *buf,
|
||||
+ const virNodeDevCapData *data)
|
||||
+{
|
||||
+ virNodeDevCapCCW ccw_dev = data->ccw_dev;
|
||||
+
|
||||
+ virNodeDeviceCapCCWDefFormat(buf, data);
|
||||
+
|
||||
+ if (ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV)
|
||||
virNodeDeviceCapMdevTypesFormat(buf,
|
||||
- data->ccw_dev.mdev_types,
|
||||
- data->ccw_dev.nmdev_types);
|
||||
+ ccw_dev.mdev_types,
|
||||
+ ccw_dev.nmdev_types);
|
||||
}
|
||||
|
||||
|
||||
@@ -724,9 +735,11 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
||||
virNodeDeviceCapMdevDefFormat(&buf, data);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_CCW_DEV:
|
||||
- case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
virNodeDeviceCapCCWDefFormat(&buf, data);
|
||||
break;
|
||||
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
+ virNodeDeviceCapCSSDefFormat(&buf, data);
|
||||
+ break;
|
||||
case VIR_NODE_DEV_CAP_VDPA:
|
||||
virNodeDeviceCapVDPADefFormat(&buf, data);
|
||||
break;
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
From aebcc09c7060f6eace93821c6a782031cf107d85 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <aebcc09c7060f6eace93821c6a782031cf107d85.1687452713.git.jdenemar@redhat.com>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Mon, 8 May 2023 19:10:46 +0200
|
||||
Subject: [PATCH] nodedev: update transient mdevs
|
||||
|
||||
Instead of updating defined mdevs only add another update for active
|
||||
devices as well to cover transient mdev devices as well.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
|
||||
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2143160
|
||||
|
||||
(cherry picked from commit 44a0f2f0c8ff5e78c238013ed297b8fce223ac5a)
|
||||
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
||||
---
|
||||
src/node_device/node_device_driver.c | 31 ++++++++++++++++++++++++++++
|
||||
1 file changed, 31 insertions(+)
|
||||
|
||||
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
|
||||
index e6ab4bb94c..943f6121a0 100644
|
||||
--- a/src/node_device/node_device_driver.c
|
||||
+++ b/src/node_device/node_device_driver.c
|
||||
@@ -1651,6 +1651,24 @@ virMdevctlListDefined(virNodeDeviceDef ***devs, char **errmsg)
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+virMdevctlListActive(virNodeDeviceDef ***devs, char **errmsg)
|
||||
+{
|
||||
+ int status;
|
||||
+ g_autofree char *output = NULL;
|
||||
+ g_autoptr(virCommand) cmd = nodeDeviceGetMdevctlListCommand(false, &output, errmsg);
|
||||
+
|
||||
+ if (virCommandRun(cmd, &status) < 0 || status != 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!output)
|
||||
+ return -1;
|
||||
+
|
||||
+ return nodeDeviceParseMdevctlJSON(output, devs);
|
||||
+}
|
||||
+
|
||||
+
|
||||
typedef struct _virMdevctlForEachData virMdevctlForEachData;
|
||||
struct _virMdevctlForEachData {
|
||||
int ndefs;
|
||||
@@ -1712,6 +1730,8 @@ int
|
||||
nodeDeviceUpdateMediatedDevices(void)
|
||||
{
|
||||
g_autofree virNodeDeviceDef **defs = NULL;
|
||||
+ g_autofree virNodeDeviceDef **act_defs = NULL;
|
||||
+ int act_ndefs = 0;
|
||||
g_autofree char *errmsg = NULL;
|
||||
g_autofree char *mdevctl = NULL;
|
||||
virMdevctlForEachData data = { 0, };
|
||||
@@ -1738,6 +1758,17 @@ nodeDeviceUpdateMediatedDevices(void)
|
||||
if (nodeDeviceUpdateMediatedDevice(defs[i]) < 0)
|
||||
return -1;
|
||||
|
||||
+ /* Update active/transient mdev devices */
|
||||
+ if ((act_ndefs = virMdevctlListActive(&act_defs, &errmsg)) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("failed to query mdevs from mdevctl: %1$s"), errmsg);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < act_ndefs; i++)
|
||||
+ if (nodeDeviceUpdateMediatedDevice(act_defs[i]) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.41.0
|
|
@ -0,0 +1,55 @@
|
|||
From dc6ab8b51ff53ba22abfb84f24641aa87320038a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <dc6ab8b51ff53ba22abfb84f24641aa87320038a@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Tue, 8 Mar 2022 17:28:38 +0000
|
||||
Subject: [PATCH] nwfilter: fix crash when counting number of network filters
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virNWFilterObjListNumOfNWFilters method iterates over the
|
||||
driver->nwfilters, accessing virNWFilterObj instances. As such
|
||||
it needs to be protected against concurrent modification of
|
||||
the driver->nwfilters object.
|
||||
|
||||
This API allows unprivileged users to connect, so users with
|
||||
read-only access to libvirt can cause a denial of service
|
||||
crash if they are able to race with a call of virNWFilterUndefine.
|
||||
Since network filters are usually statically defined, this is
|
||||
considered a low severity problem.
|
||||
|
||||
This is assigned CVE-2022-0897.
|
||||
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit a4947e8f63c3e6b7b067b444f3d6cf674c0d7f36)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2063902
|
||||
---
|
||||
src/nwfilter/nwfilter_driver.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
|
||||
index 200451d6b1..956aca6421 100644
|
||||
--- a/src/nwfilter/nwfilter_driver.c
|
||||
+++ b/src/nwfilter/nwfilter_driver.c
|
||||
@@ -478,11 +478,15 @@ nwfilterLookupByName(virConnectPtr conn,
|
||||
static int
|
||||
nwfilterConnectNumOfNWFilters(virConnectPtr conn)
|
||||
{
|
||||
+ int ret;
|
||||
if (virConnectNumOfNWFiltersEnsureACL(conn) < 0)
|
||||
return -1;
|
||||
|
||||
- return virNWFilterObjListNumOfNWFilters(driver->nwfilters, conn,
|
||||
- virConnectNumOfNWFiltersCheckACL);
|
||||
+ nwfilterDriverLock();
|
||||
+ ret = virNWFilterObjListNumOfNWFilters(driver->nwfilters, conn,
|
||||
+ virConnectNumOfNWFiltersCheckACL);
|
||||
+ nwfilterDriverUnlock();
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
From bbab997f4307da65856dedd3f319037ce442d17e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <bbab997f4307da65856dedd3f319037ce442d17e@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Thu, 24 Feb 2022 18:41:29 +0000
|
||||
Subject: [PATCH] nwfilter: hold filter update lock when creating/deleting
|
||||
bindings
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The nwfilter update lock is historically acquired by the virt
|
||||
drivers in order to achieve serialization between nwfilter
|
||||
define/undefine, and instantiation/teardown of filters.
|
||||
|
||||
When running in the modular daemons, however, the mutex that
|
||||
the virt drivers are locking is in a completely different
|
||||
process from the mutex that the nwfilter driver is locking.
|
||||
|
||||
Serialization is lost and thus call from the virt driver to
|
||||
virNWFilterBindingCreateXML can deadlock with a concurrent
|
||||
call to the virNWFilterDefineXML method.
|
||||
|
||||
The solution is surprisingly easy, the update lock simply
|
||||
needs acquiring in the virNWFilterBindingCreateXML method
|
||||
and virNWFilterBindingUndefine method instead of in the
|
||||
virt drivers.
|
||||
|
||||
The only semantic difference here is that when a virtual
|
||||
machine has multiple NICs, the instantiation and teardown
|
||||
of filters is no longer serialized for the whole VM, but
|
||||
rather for each NIC. This should not be a problem since
|
||||
the virt drivers already need to cope with tearing down
|
||||
a partially created VM where only some of the NICs are
|
||||
setup.
|
||||
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 65dc79f50b96b34b2253601b8972d5ca90658f33)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2044379
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/nwfilter/nwfilter_driver.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
|
||||
index 200451d6b1..a4479fc9fe 100644
|
||||
--- a/src/nwfilter/nwfilter_driver.c
|
||||
+++ b/src/nwfilter/nwfilter_driver.c
|
||||
@@ -760,12 +760,15 @@ nwfilterBindingCreateXML(virConnectPtr conn,
|
||||
if (!(ret = virGetNWFilterBinding(conn, def->portdevname, def->filter)))
|
||||
goto cleanup;
|
||||
|
||||
+ virNWFilterReadLockFilterUpdates();
|
||||
if (virNWFilterInstantiateFilter(driver, def) < 0) {
|
||||
+ virNWFilterUnlockFilterUpdates();
|
||||
virNWFilterBindingObjListRemove(driver->bindings, obj);
|
||||
virObjectUnref(ret);
|
||||
ret = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
+ virNWFilterUnlockFilterUpdates();
|
||||
virNWFilterBindingObjSave(obj, driver->bindingDir);
|
||||
|
||||
cleanup:
|
||||
@@ -802,7 +805,9 @@ nwfilterBindingDelete(virNWFilterBindingPtr binding)
|
||||
if (virNWFilterBindingDeleteEnsureACL(binding->conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
+ virNWFilterReadLockFilterUpdates();
|
||||
virNWFilterTeardownFilter(def);
|
||||
+ virNWFilterUnlockFilterUpdates();
|
||||
virNWFilterBindingObjDelete(obj, driver->bindingDir);
|
||||
virNWFilterBindingObjListRemove(driver->bindings, obj);
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
From 2595c7716b19214b2729b41b86656f96a2cd18bc Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2595c7716b19214b2729b41b86656f96a2cd18bc@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 22 Jun 2022 15:21:30 +0200
|
||||
Subject: [PATCH] qemu: Add qemuDomainSetMaxMemLock helper
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
qemuDomainAdjustMaxMemLock combined computing the desired limit with
|
||||
applying it. This patch separates the code to apply a memory locking
|
||||
limit to a new qemuDomainSetMaxMemLock helper for better reusability.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit dff51c7f5760ded8235076f55d082fe4363f2f78)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_domain.c | 95 ++++++++++++++++++++++++++----------------
|
||||
src/qemu/qemu_domain.h | 3 ++
|
||||
2 files changed, 61 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index ee7d310903..a81789f194 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -9261,6 +9261,61 @@ qemuDomainGetMemLockLimitBytes(virDomainDef *def,
|
||||
}
|
||||
|
||||
|
||||
+/**
|
||||
+ * qemuDomainSetMaxMemLock:
|
||||
+ * @vm: domain
|
||||
+ * @limit: the desired memory locking limit
|
||||
+ * @origPtr: where to store (or load from) the original value of the limit
|
||||
+ *
|
||||
+ * Set the memory locking limit for @vm unless it's already big enough. If
|
||||
+ * @origPtr is non-NULL, the original value of the limit will be store there
|
||||
+ * and can be restored by calling this function with @limit == 0.
|
||||
+ *
|
||||
+ * Returns: 0 on success, -1 otherwise.
|
||||
+ */
|
||||
+int
|
||||
+qemuDomainSetMaxMemLock(virDomainObj *vm,
|
||||
+ unsigned long long limit,
|
||||
+ unsigned long long *origPtr)
|
||||
+{
|
||||
+ unsigned long long current = 0;
|
||||
+
|
||||
+ if (virProcessGetMaxMemLock(vm->pid, ¤t) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (limit > 0) {
|
||||
+ VIR_DEBUG("Requested memory lock limit: %llu", limit);
|
||||
+ /* If the limit is already high enough, we can assume
|
||||
+ * that some external process is taking care of managing
|
||||
+ * process limits and we shouldn't do anything ourselves:
|
||||
+ * we're probably running in a containerized environment
|
||||
+ * where we don't have enough privilege anyway */
|
||||
+ if (current >= limit) {
|
||||
+ VIR_DEBUG("Current limit %llu is big enough", current);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* If this is the first time adjusting the limit, save the current
|
||||
+ * value so that we can restore it once memory locking is no longer
|
||||
+ * required */
|
||||
+ if (origPtr && *origPtr == 0)
|
||||
+ *origPtr = current;
|
||||
+ } else {
|
||||
+ /* Once memory locking is no longer required, we can restore the
|
||||
+ * original, usually very low, limit. But only if we actually stored
|
||||
+ * the original limit before. */
|
||||
+ if (!origPtr || *origPtr == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ limit = *origPtr;
|
||||
+ *origPtr = 0;
|
||||
+ VIR_DEBUG("Resetting memory lock limit back to %llu", limit);
|
||||
+ }
|
||||
+
|
||||
+ return virProcessSetMaxMemLock(vm->pid, limit);
|
||||
+}
|
||||
+
|
||||
+
|
||||
/**
|
||||
* qemuDomainAdjustMaxMemLock:
|
||||
* @vm: domain
|
||||
@@ -9282,43 +9337,9 @@ int
|
||||
qemuDomainAdjustMaxMemLock(virDomainObj *vm,
|
||||
bool forceVFIO)
|
||||
{
|
||||
- qemuDomainObjPrivate *priv = vm->privateData;
|
||||
- unsigned long long currentMemLock = 0;
|
||||
- unsigned long long desiredMemLock = 0;
|
||||
-
|
||||
- desiredMemLock = qemuDomainGetMemLockLimitBytes(vm->def, forceVFIO);
|
||||
- if (virProcessGetMaxMemLock(vm->pid, ¤tMemLock) < 0)
|
||||
- return -1;
|
||||
-
|
||||
- if (desiredMemLock > 0) {
|
||||
- if (currentMemLock < desiredMemLock) {
|
||||
- /* If this is the first time adjusting the limit, save the current
|
||||
- * value so that we can restore it once memory locking is no longer
|
||||
- * required */
|
||||
- if (priv->originalMemlock == 0) {
|
||||
- priv->originalMemlock = currentMemLock;
|
||||
- }
|
||||
- } else {
|
||||
- /* If the limit is already high enough, we can assume
|
||||
- * that some external process is taking care of managing
|
||||
- * process limits and we shouldn't do anything ourselves:
|
||||
- * we're probably running in a containerized environment
|
||||
- * where we don't have enough privilege anyway */
|
||||
- desiredMemLock = 0;
|
||||
- }
|
||||
- } else {
|
||||
- /* Once memory locking is no longer required, we can restore the
|
||||
- * original, usually very low, limit */
|
||||
- desiredMemLock = priv->originalMemlock;
|
||||
- priv->originalMemlock = 0;
|
||||
- }
|
||||
-
|
||||
- if (desiredMemLock > 0 &&
|
||||
- virProcessSetMaxMemLock(vm->pid, desiredMemLock) < 0) {
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
+ return qemuDomainSetMaxMemLock(vm,
|
||||
+ qemuDomainGetMemLockLimitBytes(vm->def, forceVFIO),
|
||||
+ &QEMU_DOMAIN_PRIVATE(vm)->originalMemlock);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
||||
index e9497d20de..6d1d23439a 100644
|
||||
--- a/src/qemu/qemu_domain.h
|
||||
+++ b/src/qemu/qemu_domain.h
|
||||
@@ -789,6 +789,9 @@ int qemuDomainAdjustMaxMemLock(virDomainObj *vm,
|
||||
bool forceVFIO);
|
||||
int qemuDomainAdjustMaxMemLockHostdev(virDomainObj *vm,
|
||||
virDomainHostdevDef *hostdev);
|
||||
+int qemuDomainSetMaxMemLock(virDomainObj *vm,
|
||||
+ unsigned long long limit,
|
||||
+ unsigned long long *origPtr);
|
||||
|
||||
int qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
|
||||
const virDomainMemoryDef *mem);
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From 08fef741d85ecfb3493c47f5f1334f91c30e3233 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <08fef741d85ecfb3493c47f5f1334f91c30e3233@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 9 Feb 2022 11:08:42 +0100
|
||||
Subject: [PATCH] qemu: Ignore missing vm.unprivileged_userfaultfd sysctl
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Older kernels did not support this sysctl, but they did not restrict
|
||||
userfaultfd in any way so everything worked as if
|
||||
vm.unprivileged_userfaultfd was set to 1. Thus we can safely ignore
|
||||
errors when setting the value.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 558f00397a0d46ad22bf53a22a40ed6fc4fdb5eb)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2148578
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/postcopy-migration.sysctl | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/postcopy-migration.sysctl b/src/qemu/postcopy-migration.sysctl
|
||||
index aa8f015ae0..db3f11e49f 100644
|
||||
--- a/src/qemu/postcopy-migration.sysctl
|
||||
+++ b/src/qemu/postcopy-migration.sysctl
|
||||
@@ -3,4 +3,4 @@
|
||||
# privileged processes.
|
||||
# It can be safely overridden by a file in /etc/sysctl.d/ in case post-copy
|
||||
# migration is not used on the host.
|
||||
-vm.unprivileged_userfaultfd = 1
|
||||
+-vm.unprivileged_userfaultfd = 1
|
||||
--
|
||||
2.39.0
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
From 85b7d8295d72214b08f0fff93c473baaa88a569b Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <85b7d8295d72214b08f0fff93c473baaa88a569b@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 15:57:21 +0100
|
||||
Subject: [PATCH] qemu: Make 'struct _qemuMonitorMessage' private
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Move the declaration of the struct into 'qemu_monitor_priv.h' as other
|
||||
code has no business in peeking into the monitor messages.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit f9ae469a6ebb17e0990096e826f049c1c46cd760)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2170472
|
||||
---
|
||||
src/qemu/qemu_monitor.h | 14 --------------
|
||||
src/qemu/qemu_monitor_json.c | 3 +++
|
||||
src/qemu/qemu_monitor_priv.h | 16 ++++++++++++++++
|
||||
tests/qemucapsprobemock.c | 3 +++
|
||||
4 files changed, 22 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
||||
index a4a4edf5a6..d00967d84f 100644
|
||||
--- a/src/qemu/qemu_monitor.h
|
||||
+++ b/src/qemu/qemu_monitor.h
|
||||
@@ -34,21 +34,7 @@
|
||||
#include "virenum.h"
|
||||
|
||||
typedef struct _qemuMonitor qemuMonitor;
|
||||
-
|
||||
typedef struct _qemuMonitorMessage qemuMonitorMessage;
|
||||
-struct _qemuMonitorMessage {
|
||||
- int txFD;
|
||||
-
|
||||
- const char *txBuffer;
|
||||
- int txOffset;
|
||||
- int txLength;
|
||||
-
|
||||
- /* Used by the JSON monitor to hold reply / error */
|
||||
- void *rxObject;
|
||||
-
|
||||
- /* True if rxObject is ready, or a fatal error occurred on the monitor channel */
|
||||
- bool finished;
|
||||
-};
|
||||
|
||||
typedef enum {
|
||||
QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE = 0,
|
||||
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
||||
index 34a46b9b41..7d8755246f 100644
|
||||
--- a/src/qemu/qemu_monitor_json.c
|
||||
+++ b/src/qemu/qemu_monitor_json.c
|
||||
@@ -44,6 +44,9 @@
|
||||
# include "libvirt_qemu_probes.h"
|
||||
#endif
|
||||
|
||||
+#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
|
||||
+#include "qemu_monitor_priv.h"
|
||||
+
|
||||
#define VIR_FROM_THIS VIR_FROM_QEMU
|
||||
|
||||
VIR_LOG_INIT("qemu.qemu_monitor_json");
|
||||
diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h
|
||||
index 31bb3526b9..6115f830de 100644
|
||||
--- a/src/qemu/qemu_monitor_priv.h
|
||||
+++ b/src/qemu/qemu_monitor_priv.h
|
||||
@@ -24,5 +24,21 @@
|
||||
|
||||
#include "qemu_monitor.h"
|
||||
|
||||
+
|
||||
+struct _qemuMonitorMessage {
|
||||
+ int txFD;
|
||||
+
|
||||
+ const char *txBuffer;
|
||||
+ int txOffset;
|
||||
+ int txLength;
|
||||
+
|
||||
+ /* Used by the JSON monitor to hold reply / error */
|
||||
+ void *rxObject;
|
||||
+
|
||||
+ /* True if rxObject is ready, or a fatal error occurred on the monitor channel */
|
||||
+ bool finished;
|
||||
+};
|
||||
+
|
||||
+
|
||||
void
|
||||
qemuMonitorResetCommandID(qemuMonitor *mon);
|
||||
diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c
|
||||
index 915036d178..2717ed5d84 100644
|
||||
--- a/tests/qemucapsprobemock.c
|
||||
+++ b/tests/qemucapsprobemock.c
|
||||
@@ -25,6 +25,9 @@
|
||||
#include "qemu/qemu_monitor.h"
|
||||
#include "qemu/qemu_monitor_json.h"
|
||||
|
||||
+#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
|
||||
+#include "qemu/qemu_monitor_priv.h"
|
||||
+
|
||||
#define REAL_SYM(realFunc) \
|
||||
do { \
|
||||
if (!realFunc && !(realFunc = dlsym(RTLD_NEXT, __FUNCTION__))) { \
|
||||
--
|
||||
2.40.1
|
|
@ -1,5 +1,5 @@
|
|||
From 84cedeca547585a51f6044186d241a501ff757d2 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <84cedeca547585a51f6044186d241a501ff757d2@dist-git>
|
||||
From fa7cff4e684ededd184976d4fdf217cc155825b8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <fa7cff4e684ededd184976d4fdf217cc155825b8@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 31 Jan 2022 12:55:47 +0100
|
||||
Subject: [PATCH] qemu: Validate domain definition even on migration
|
||||
|
@ -44,6 +44,7 @@ Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2048435
|
|||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit 517b8c12b98d7ac0bb4d582e0b491d50d776eb6d)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2050702
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_process.c | 6 +-----
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
From c57b31305a7fc8c2a4d11e11e7a48c4826160fa2 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c57b31305a7fc8c2a4d11e11e7a48c4826160fa2@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Wed, 1 Mar 2023 16:51:42 +0100
|
||||
Subject: [PATCH] qemu: agent: Make fetching of 'can-offline' member from
|
||||
'guest-query-vcpus' optional
|
||||
|
||||
The 'can-offline' member is optional according to agent's schema and in
|
||||
fact in certain cases it's not returned. Libvirt then spams the logs
|
||||
if something is polling the bulk guest stats API.
|
||||
|
||||
Noticed when going through oVirt logs which appears to call the bulk
|
||||
stats API repeatedly.
|
||||
|
||||
Instead of requiring it we simply reply that the vCPU can't be offlined.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
(cherry picked from commit 790ea58153b9ef1120a577d1a87a4ca2e988ee5c)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2174447
|
||||
---
|
||||
src/qemu/qemu_agent.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
|
||||
index db844148a6..09b7340bc8 100644
|
||||
--- a/src/qemu/qemu_agent.c
|
||||
+++ b/src/qemu/qemu_agent.c
|
||||
@@ -1371,12 +1371,8 @@ qemuAgentGetVCPUs(qemuAgent *agent,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (virJSONValueObjectGetBoolean(entry, "can-offline",
|
||||
- &in->offlinable) < 0) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
- _("'can-offline' missing in reply of guest-get-vcpus"));
|
||||
- return -1;
|
||||
- }
|
||||
+ in->offlinable = false;
|
||||
+ ignore_value(virJSONValueObjectGetBoolean(entry, "can-offline", &in->offlinable));
|
||||
}
|
||||
|
||||
return ndata;
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 521e9a7731ac678ca790da4b04dabe4369efb984 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <521e9a7731ac678ca790da4b04dabe4369efb984@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Wed, 1 Mar 2023 17:09:42 +0100
|
||||
Subject: [PATCH] qemu: domain: Fix logic when tainting domain
|
||||
|
||||
Originally the code was skipping all repeated taints with the same taint
|
||||
flag but a logic bug introduced in commit 30626ed15b239c424ae inverted
|
||||
the condition. This caused that actually the first occurence was NOT
|
||||
logged but any subsequent was.
|
||||
|
||||
This was noticed when going through oVirt logs as they use custom guest
|
||||
agent commands and the logs are totally spammed with this message.
|
||||
|
||||
Fixes: 30626ed15b239c424ae891f096057a696eadd715
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
(cherry picked from commit 9134b40d0b43a5e1a9928b0a0d948205941d9807)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2174447
|
||||
---
|
||||
src/qemu/qemu_domain.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index c24d1e4d53..c70661fc49 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -6369,7 +6369,7 @@ void qemuDomainObjTaintMsg(virQEMUDriver *driver,
|
||||
const char *extrasuffix = "";
|
||||
va_list args;
|
||||
|
||||
- if (virDomainObjTaint(obj, taint)) {
|
||||
+ if (!virDomainObjTaint(obj, taint)) {
|
||||
/* If an extra message was given we must always
|
||||
* emit the taint warning, otherwise it is a
|
||||
* one-time only warning per VM
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
From 1911ebd62779701aae271dd3e047415bfd2cd303 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <1911ebd62779701aae271dd3e047415bfd2cd303@dist-git>
|
||||
From 94bc9eaf3bbcaec47bd233378bbbb45f5f1523ca Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <94bc9eaf3bbcaec47bd233378bbbb45f5f1523ca@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Thu, 20 Jan 2022 14:53:33 +0100
|
||||
Subject: [PATCH] qemu: fix inactive snapshot revert
|
||||
|
@ -18,6 +18,9 @@ https://gitlab.com/libvirt/libvirt/-/issues/266
|
|||
Fixes: 85e4a13c3f19078fb6af5ffb4a80022c142cbc7e
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 76deb656132bb8817ddae4b7f417930c4db824c9)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2043584
|
||||
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_snapshot.c | 2 +-
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
From c70b1a8d8a4bc34bcbf9ef4bccac678257b8c494 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c70b1a8d8a4bc34bcbf9ef4bccac678257b8c494@dist-git>
|
||||
From: Vasiliy Ulyanov <vulyanov@suse.de>
|
||||
Date: Wed, 2 Feb 2022 17:28:17 +0100
|
||||
Subject: [PATCH] qemu: gpu: Get pid without binary validation
|
||||
|
||||
The binary validation in virPidFileReadPathIfAlive may fail with EACCES
|
||||
if the calling process does not have CAP_SYS_PTRACE capability.
|
||||
Therefore instead do only the check that the pidfile is locked by the
|
||||
correct process.
|
||||
|
||||
Fixes the same issue as with swtpm.
|
||||
|
||||
Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit e3dfa52d260da8a41a0ec35767d08e37c825824a)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2152188
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_vhost_user_gpu.c | 9 +++------
|
||||
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c
|
||||
index ef198a4820..f7d444e851 100644
|
||||
--- a/src/qemu/qemu_vhost_user_gpu.c
|
||||
+++ b/src/qemu/qemu_vhost_user_gpu.c
|
||||
@@ -54,7 +54,6 @@ qemuVhostUserGPUCreatePidFilename(const char *stateDir,
|
||||
|
||||
/*
|
||||
* qemuVhostUserGPUGetPid:
|
||||
- * @binpath: path of executable associated with the pidfile
|
||||
* @stateDir: the directory where vhost-user-gpu writes the pidfile into
|
||||
* @shortName: short name of the domain
|
||||
* @alias: video device alias
|
||||
@@ -65,8 +64,7 @@ qemuVhostUserGPUCreatePidFilename(const char *stateDir,
|
||||
* set to -1;
|
||||
*/
|
||||
static int
|
||||
-qemuVhostUserGPUGetPid(const char *binPath,
|
||||
- const char *stateDir,
|
||||
+qemuVhostUserGPUGetPid(const char *stateDir,
|
||||
const char *shortName,
|
||||
const char *alias,
|
||||
pid_t *pid)
|
||||
@@ -76,7 +74,7 @@ qemuVhostUserGPUGetPid(const char *binPath,
|
||||
if (!(pidfile = qemuVhostUserGPUCreatePidFilename(stateDir, shortName, alias)))
|
||||
return -1;
|
||||
|
||||
- if (virPidFileReadPathIfAlive(pidfile, pid, binPath) < 0)
|
||||
+ if (virPidFileReadPathIfLocked(pidfile, pid) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -253,8 +251,7 @@ qemuExtVhostUserGPUSetupCgroup(virQEMUDriver *driver,
|
||||
if (!shortname)
|
||||
return -1;
|
||||
|
||||
- rc = qemuVhostUserGPUGetPid(video->driver->vhost_user_binary,
|
||||
- cfg->stateDir, shortname, video->info.alias, &pid);
|
||||
+ rc = qemuVhostUserGPUGetPid(cfg->stateDir, shortname, video->info.alias, &pid);
|
||||
if (rc < 0 || (rc == 0 && pid == (pid_t)-1)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Could not get process id of vhost-user-gpu"));
|
||||
--
|
||||
2.39.0
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
From 7bcd75ca73d8eda05fafa8342309a8fd058cd326 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <7bcd75ca73d8eda05fafa8342309a8fd058cd326@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Thu, 24 Feb 2022 19:02:32 +0000
|
||||
Subject: [PATCH] qemu,lxc: remove use to nwfilter update lock
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Now that the virNWFilterBinding APIs are using the nwfilter
|
||||
update lock directly, there is no need for the virt drivers
|
||||
to do it themselves.
|
||||
|
||||
Reviewed-by: Laine Stump <laine@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 5f8b090f421cd6a6c46f44905431491e2d3cf8f5)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2044379
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/lxc/lxc_driver.c | 6 ------
|
||||
src/qemu/qemu_driver.c | 18 ------------------
|
||||
src/qemu/qemu_migration.c | 3 ---
|
||||
src/qemu/qemu_process.c | 4 ----
|
||||
4 files changed, 31 deletions(-)
|
||||
|
||||
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
|
||||
index 7bc39120ee..e581c62668 100644
|
||||
--- a/src/lxc/lxc_driver.c
|
||||
+++ b/src/lxc/lxc_driver.c
|
||||
@@ -971,8 +971,6 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom,
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, -1);
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
if (!(vm = lxcDomObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
@@ -1014,7 +1012,6 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom,
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1080,8 +1077,6 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
|
||||
if (flags & VIR_DOMAIN_START_VALIDATE)
|
||||
parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA;
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
||||
goto cleanup;
|
||||
|
||||
@@ -1138,7 +1133,6 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
return dom;
|
||||
}
|
||||
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index d3d76c003f..00a86b6c7c 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -1603,8 +1603,6 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
|
||||
if (flags & VIR_DOMAIN_START_AUTODESTROY)
|
||||
start_flags |= VIR_QEMU_PROCESS_START_AUTODESTROY;
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
if (!(def = virDomainDefParseString(xml, driver->xmlopt,
|
||||
NULL, parse_flags)))
|
||||
goto cleanup;
|
||||
@@ -1658,7 +1656,6 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
virObjectEventStateQueue(driver->domainEventState, event2);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
return dom;
|
||||
}
|
||||
|
||||
@@ -5773,8 +5770,6 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
||||
VIR_DOMAIN_SAVE_PAUSED, -1);
|
||||
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
fd = qemuSaveImageOpen(driver, NULL, path, &def, &data,
|
||||
(flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
|
||||
&wrapperFd, false, false);
|
||||
@@ -5846,7 +5841,6 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
||||
if (vm && ret < 0)
|
||||
qemuDomainRemoveInactiveJob(driver, vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -6395,8 +6389,6 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
|
||||
VIR_DOMAIN_START_BYPASS_CACHE |
|
||||
VIR_DOMAIN_START_FORCE_BOOT, -1);
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
if (!(vm = qemuDomainObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
@@ -6425,7 +6417,6 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -7811,8 +7802,6 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom,
|
||||
virDomainObj *vm = NULL;
|
||||
int ret = -1;
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
if (!(vm = qemuDomainObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
@@ -7835,7 +7824,6 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -7865,8 +7853,6 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
|
||||
VIR_DOMAIN_AFFECT_CONFIG |
|
||||
VIR_DOMAIN_DEVICE_MODIFY_FORCE, -1);
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
if (!(vm = qemuDomainObjFromDomain(dom)))
|
||||
@@ -7943,7 +7929,6 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
|
||||
if (dev != dev_copy)
|
||||
virDomainDeviceDefFree(dev_copy);
|
||||
virDomainObjEndAPI(&vm);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -13644,8 +13629,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
|
||||
virDomainObj *vm = NULL;
|
||||
int ret = -1;
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
if (!(vm = qemuDomObjFromSnapshot(snapshot)))
|
||||
goto cleanup;
|
||||
|
||||
@@ -13656,7 +13639,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||||
index 2635ef1162..358cb9c3b5 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -2779,8 +2779,6 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
|
||||
int rv;
|
||||
g_autofree char *tlsAlias = NULL;
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
if (flags & VIR_MIGRATE_OFFLINE) {
|
||||
if (flags & (VIR_MIGRATE_NON_SHARED_DISK |
|
||||
VIR_MIGRATE_NON_SHARED_INC)) {
|
||||
@@ -3101,7 +3099,6 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
qemuMigrationCookieFree(mig);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
virErrorRestore(&origErr);
|
||||
return ret;
|
||||
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 5c6657a876..914f9bef8b 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -8986,7 +8986,6 @@ qemuProcessReconnect(void *opaque)
|
||||
qemuDomainRemoveInactiveJob(driver, obj);
|
||||
}
|
||||
virDomainObjEndAPI(&obj);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
virIdentitySetCurrent(NULL);
|
||||
return;
|
||||
|
||||
@@ -9038,8 +9037,6 @@ qemuProcessReconnectHelper(virDomainObj *obj,
|
||||
data->obj = obj;
|
||||
data->identity = virIdentityGetCurrent();
|
||||
|
||||
- virNWFilterReadLockFilterUpdates();
|
||||
-
|
||||
/* this lock and reference will be eventually transferred to the thread
|
||||
* that handles the reconnect */
|
||||
virObjectLock(obj);
|
||||
@@ -9062,7 +9059,6 @@ qemuProcessReconnectHelper(virDomainObj *obj,
|
||||
qemuDomainRemoveInactiveJobLocked(src->driver, obj);
|
||||
|
||||
virDomainObjEndAPI(&obj);
|
||||
- virNWFilterUnlockFilterUpdates();
|
||||
g_clear_object(&data->identity);
|
||||
VIR_FREE(data);
|
||||
return -1;
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
From a4d8210ae9fd84740e01b96d28bfb6183f3f3270 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a4d8210ae9fd84740e01b96d28bfb6183f3f3270@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 16:02:29 +0100
|
||||
Subject: [PATCH] qemu: monitor: Drop old monitor fields from 'struct
|
||||
_qemuMonitorMessage'
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The fields are no longer used since we've deleted support for HMP-only
|
||||
qemus. The HMP command pass-through works via a QMP command.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit c5eb99a9d9af8683789e99cc904671e343580058)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2170472
|
||||
---
|
||||
src/qemu/qemu_monitor.h | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
||||
index d2037914be..a4a4edf5a6 100644
|
||||
--- a/src/qemu/qemu_monitor.h
|
||||
+++ b/src/qemu/qemu_monitor.h
|
||||
@@ -43,15 +43,10 @@ struct _qemuMonitorMessage {
|
||||
int txOffset;
|
||||
int txLength;
|
||||
|
||||
- /* Used by the text monitor reply / error */
|
||||
- char *rxBuffer;
|
||||
- int rxLength;
|
||||
/* Used by the JSON monitor to hold reply / error */
|
||||
void *rxObject;
|
||||
|
||||
- /* True if rxBuffer / rxObject are ready, or a
|
||||
- * fatal error occurred on the monitor channel
|
||||
- */
|
||||
+ /* True if rxObject is ready, or a fatal error occurred on the monitor channel */
|
||||
bool finished;
|
||||
};
|
||||
|
||||
--
|
||||
2.40.1
|
|
@ -0,0 +1,157 @@
|
|||
From c2ed5aeee7bf365877e0764699f032fb749630b0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c2ed5aeee7bf365877e0764699f032fb749630b0@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 16:07:41 +0100
|
||||
Subject: [PATCH] qemu: monitor: Move declaration of struct _qemuMonitor to
|
||||
qemu_monitor_priv.h
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
In order to mock the SCM_RIGHTS sendmsg to simulate sending
|
||||
filedescriptors to fake qemu in tests we need access to some fields of
|
||||
'struct _qemuMonitor'. Move its declaration to the private header file.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 7c35c483eaa78eb847e0865cbb210d5355f75d7a)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2170472
|
||||
---
|
||||
src/qemu/qemu_monitor.c | 50 ---------------------------------
|
||||
src/qemu/qemu_monitor_priv.h | 54 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 54 insertions(+), 50 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
||||
index 23638d3fe8..bba92592c5 100644
|
||||
--- a/src/qemu/qemu_monitor.c
|
||||
+++ b/src/qemu/qemu_monitor.c
|
||||
@@ -65,56 +65,6 @@ VIR_LOG_INIT("qemu.qemu_monitor");
|
||||
*/
|
||||
#define QEMU_MONITOR_MAX_RESPONSE (10 * 1024 * 1024)
|
||||
|
||||
-struct _qemuMonitor {
|
||||
- virObjectLockable parent;
|
||||
-
|
||||
- virCond notify;
|
||||
-
|
||||
- int fd;
|
||||
-
|
||||
- GMainContext *context;
|
||||
- GSocket *socket;
|
||||
- GSource *watch;
|
||||
-
|
||||
- virDomainObj *vm;
|
||||
- char *domainName;
|
||||
-
|
||||
- qemuMonitorCallbacks *cb;
|
||||
- void *callbackOpaque;
|
||||
-
|
||||
- /* If there's a command being processed this will be
|
||||
- * non-NULL */
|
||||
- qemuMonitorMessage *msg;
|
||||
-
|
||||
- /* Buffer incoming data ready for Text/QMP monitor
|
||||
- * code to process & find message boundaries */
|
||||
- size_t bufferOffset;
|
||||
- size_t bufferLength;
|
||||
- char *buffer;
|
||||
-
|
||||
- /* If anything went wrong, this will be fed back
|
||||
- * the next monitor msg */
|
||||
- virError lastError;
|
||||
-
|
||||
- /* Set to true when EOF is detected on the monitor */
|
||||
- bool goteof;
|
||||
-
|
||||
- int nextSerial;
|
||||
-
|
||||
- bool waitGreeting;
|
||||
-
|
||||
- /* If found, path to the virtio memballoon driver */
|
||||
- char *balloonpath;
|
||||
- bool ballooninit;
|
||||
-
|
||||
- /* Log file context of the qemu process to dig for usable info */
|
||||
- qemuMonitorReportDomainLogError logFunc;
|
||||
- void *logOpaque;
|
||||
- virFreeCallback logDestroy;
|
||||
-
|
||||
- /* true if qemu no longer wants 'props' sub-object of object-add */
|
||||
- bool objectAddNoWrap;
|
||||
-};
|
||||
|
||||
/**
|
||||
* QEMU_CHECK_MONITOR_FULL:
|
||||
diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h
|
||||
index 6115f830de..606aa79fbd 100644
|
||||
--- a/src/qemu/qemu_monitor_priv.h
|
||||
+++ b/src/qemu/qemu_monitor_priv.h
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "qemu_monitor.h"
|
||||
|
||||
+#include <gio/gio.h>
|
||||
+
|
||||
|
||||
struct _qemuMonitorMessage {
|
||||
int txFD;
|
||||
@@ -40,5 +42,57 @@ struct _qemuMonitorMessage {
|
||||
};
|
||||
|
||||
|
||||
+struct _qemuMonitor {
|
||||
+ virObjectLockable parent;
|
||||
+
|
||||
+ virCond notify;
|
||||
+
|
||||
+ int fd;
|
||||
+
|
||||
+ GMainContext *context;
|
||||
+ GSocket *socket;
|
||||
+ GSource *watch;
|
||||
+
|
||||
+ virDomainObj *vm;
|
||||
+ char *domainName;
|
||||
+
|
||||
+ qemuMonitorCallbacks *cb;
|
||||
+ void *callbackOpaque;
|
||||
+
|
||||
+ /* If there's a command being processed this will be
|
||||
+ * non-NULL */
|
||||
+ qemuMonitorMessage *msg;
|
||||
+
|
||||
+ /* Buffer incoming data ready for Text/QMP monitor
|
||||
+ * code to process & find message boundaries */
|
||||
+ size_t bufferOffset;
|
||||
+ size_t bufferLength;
|
||||
+ char *buffer;
|
||||
+
|
||||
+ /* If anything went wrong, this will be fed back
|
||||
+ * the next monitor msg */
|
||||
+ virError lastError;
|
||||
+
|
||||
+ /* Set to true when EOF is detected on the monitor */
|
||||
+ bool goteof;
|
||||
+
|
||||
+ int nextSerial;
|
||||
+
|
||||
+ bool waitGreeting;
|
||||
+
|
||||
+ /* If found, path to the virtio memballoon driver */
|
||||
+ char *balloonpath;
|
||||
+ bool ballooninit;
|
||||
+
|
||||
+ /* Log file context of the qemu process to dig for usable info */
|
||||
+ qemuMonitorReportDomainLogError logFunc;
|
||||
+ void *logOpaque;
|
||||
+ virFreeCallback logDestroy;
|
||||
+
|
||||
+ /* true if qemu no longer wants 'props' sub-object of object-add */
|
||||
+ bool objectAddNoWrap;
|
||||
+};
|
||||
+
|
||||
+
|
||||
void
|
||||
qemuMonitorResetCommandID(qemuMonitor *mon);
|
||||
--
|
||||
2.40.1
|
|
@ -0,0 +1,57 @@
|
|||
From b3ffc8876adf777c7baefb6e467d7552c0a03251 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b3ffc8876adf777c7baefb6e467d7552c0a03251@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Wed, 9 Nov 2022 10:53:49 +0100
|
||||
Subject: [PATCH] qemu: monitor: Store whether 'query-named-block-nodes'
|
||||
supports 'flat' parameter
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Rather than having callers always pass this flag store it in the
|
||||
qemuMonitor object. Following patches will convert the code to use this
|
||||
internal flag.
|
||||
|
||||
In the future this will also simplify removal when all supported qemu
|
||||
versions will support the new mode.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit b0e4ad5263c73a926b8246028c76c552b07fca74)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2170472
|
||||
---
|
||||
src/qemu/qemu_monitor.c | 4 +++-
|
||||
src/qemu/qemu_monitor_priv.h | 2 ++
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
||||
index bba92592c5..99667fdf2f 100644
|
||||
--- a/src/qemu/qemu_monitor.c
|
||||
+++ b/src/qemu/qemu_monitor.c
|
||||
@@ -610,8 +610,10 @@ qemuMonitorOpenInternal(virDomainObj *vm,
|
||||
mon->cb = cb;
|
||||
mon->callbackOpaque = opaque;
|
||||
|
||||
- if (priv)
|
||||
+ if (priv) {
|
||||
mon->objectAddNoWrap = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_JSON);
|
||||
+ mon->queryNamedBlockNodesFlat = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT);
|
||||
+ }
|
||||
|
||||
if (virSetCloseExec(mon->fd) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h
|
||||
index 606aa79fbd..e32928805f 100644
|
||||
--- a/src/qemu/qemu_monitor_priv.h
|
||||
+++ b/src/qemu/qemu_monitor_priv.h
|
||||
@@ -91,6 +91,8 @@ struct _qemuMonitor {
|
||||
|
||||
/* true if qemu no longer wants 'props' sub-object of object-add */
|
||||
bool objectAddNoWrap;
|
||||
+ /* query-named-block-nodes supports the 'flat' option */
|
||||
+ bool queryNamedBlockNodesFlat;
|
||||
};
|
||||
|
||||
|
||||
--
|
||||
2.40.1
|
|
@ -0,0 +1,53 @@
|
|||
From 31986239312c0e460800f5b9921f6593f1556015 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <31986239312c0e460800f5b9921f6593f1556015@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Wed, 9 Nov 2022 10:45:27 +0100
|
||||
Subject: [PATCH] qemu: qemuBlockGetNamedNodeData: Remove pointless error path
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
We don't need automatic freeing for 'blockNamedNodeData' and we can
|
||||
directly return it rather than checking it for NULL-ness first.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 3fe74ebd9037d695df906ed137d22a8d8d77e169)
|
||||
|
||||
Conflicts:
|
||||
src/qemu/qemu_block.c
|
||||
|
||||
- qemuDomainObjEnter/ExitMonitor still needs 'driver'
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2170472
|
||||
---
|
||||
src/qemu/qemu_block.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
|
||||
index aa566d0097..c9229d1918 100644
|
||||
--- a/src/qemu/qemu_block.c
|
||||
+++ b/src/qemu/qemu_block.c
|
||||
@@ -3020,7 +3020,7 @@ qemuBlockGetNamedNodeData(virDomainObj *vm,
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
virQEMUDriver *driver = priv->driver;
|
||||
- g_autoptr(GHashTable) blockNamedNodeData = NULL;
|
||||
+ GHashTable *blockNamedNodeData = NULL;
|
||||
bool supports_flat = virQEMUCapsGet(priv->qemuCaps,
|
||||
QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT);
|
||||
|
||||
@@ -3031,10 +3031,7 @@ qemuBlockGetNamedNodeData(virDomainObj *vm,
|
||||
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
|
||||
- if (!blockNamedNodeData)
|
||||
- return NULL;
|
||||
-
|
||||
- return g_steal_pointer(&blockNamedNodeData);
|
||||
+ return blockNamedNodeData;
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.40.1
|
|
@ -0,0 +1,65 @@
|
|||
From e9418cec1ba24b6cf78f85bbbef8586ed612692a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e9418cec1ba24b6cf78f85bbbef8586ed612692a@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Mon, 13 Mar 2023 13:56:47 +0100
|
||||
Subject: [PATCH] qemu: relax shared memory check for vhostuser daemons
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
For some vhostuser daemons, we validate that the guest memory is shared
|
||||
with the host.
|
||||
|
||||
With earlier versions of QEMU, it was only possible to mark memory
|
||||
as shared by defining an explicit NUMA topology. Later, QEMU exposed
|
||||
the name of the default memory backend (defaultRAMid) so we can mark
|
||||
that memory as shared.
|
||||
|
||||
Since libvirt commit:
|
||||
commit bff2ad5d6b1f25da02802273934d2a519159fec7
|
||||
qemu: Relax validation for mem->access if guest has no NUMA
|
||||
we already check for the case when user requests shared memory,
|
||||
but QEMU did not expose defaultRAMid.
|
||||
|
||||
Drop the duplicit check from vhostuser device validation, to make
|
||||
it pass on hotplug even after libvirtd restart.
|
||||
|
||||
This avoids the need to store the defaultRAMid, since we don't really
|
||||
need it for anything after the VM has been already started.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2078693
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2177701
|
||||
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit d5c7b7870e45575f81fffcb611c2546d0e02e778)
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_validate.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||
index 7bc14293d6..4069f47c12 100644
|
||||
--- a/src/qemu/qemu_validate.c
|
||||
+++ b/src/qemu/qemu_validate.c
|
||||
@@ -1588,16 +1588,12 @@ qemuValidateDomainVirtioOptions(const virDomainVirtioOptions *virtio,
|
||||
static int
|
||||
qemuValidateDomainDefVhostUserRequireSharedMemory(const virDomainDef *def,
|
||||
const char *name,
|
||||
- virQEMUCaps *qemuCaps)
|
||||
+ virQEMUCaps *qemuCaps G_GNUC_UNUSED)
|
||||
{
|
||||
- const char *defaultRAMId = virQEMUCapsGetMachineDefaultRAMid(qemuCaps,
|
||||
- def->virtType,
|
||||
- def->os.machine);
|
||||
size_t numa_nodes = virDomainNumaGetNodeCount(def->numa);
|
||||
size_t i;
|
||||
|
||||
- if (numa_nodes == 0 &&
|
||||
- !(defaultRAMId && def->mem.access == VIR_DOMAIN_MEMORY_ACCESS_SHARED)) {
|
||||
+ if (numa_nodes == 0 && def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_SHARED) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("'%s' requires shared memory"), name);
|
||||
return -1;
|
||||
--
|
||||
2.40.1
|
|
@ -1,471 +0,0 @@
|
|||
From 3cde498c98be902fc8fe87c895dfeaaa95352b38 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <3cde498c98be902fc8fe87c895dfeaaa95352b38@dist-git>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Thu, 3 Feb 2022 13:43:18 +0000
|
||||
Subject: [PATCH] qemu: support firmware descriptor flash 'mode' for optional
|
||||
NVRAM
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Currently the 'nvram_template' entry is mandatory when parsing the
|
||||
firmware descriptor based on flash. QEMU is extending the firmware
|
||||
descriptor spec to make the 'nvram_template' optional, depending
|
||||
on the value of a new 'mode' field:
|
||||
|
||||
- "split"
|
||||
* "executable" contains read-only CODE
|
||||
* "nvram_template" contains read-write VARS
|
||||
|
||||
- "combined"
|
||||
* "executable" contains read-write CODE and VARs
|
||||
* "nvram_template" not present
|
||||
|
||||
- "stateless"
|
||||
* "executable" contains read-only CODE and VARs
|
||||
* "nvram_template" not present
|
||||
|
||||
In the latter case, the guest OS can write vars but the
|
||||
firmware will make no attempt to persist them, so any changes
|
||||
will be lost at poweroff.
|
||||
|
||||
For now we parse this new 'mode' but discard any firmware
|
||||
which is not 'mode=split' when matching for a domain.
|
||||
|
||||
In the tests we have a mixture of files with and without the
|
||||
mode attribute.
|
||||
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 32b9d8b0ae00669555f01f91ee11612a636c4b69)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2057769
|
||||
---
|
||||
src/qemu/qemu_firmware.c | 79 ++++++++++++++++---
|
||||
.../share/qemu/firmware/50-ovmf-sb-keys.json | 33 ++++++++
|
||||
.../out/usr/share/qemu/firmware/61-ovmf.json | 31 ++++++++
|
||||
.../out/usr/share/qemu/firmware/70-aavmf.json | 28 +++++++
|
||||
.../qemu/firmware/45-ovmf-sev-stateless.json | 31 ++++++++
|
||||
.../qemu/firmware/55-ovmf-sb-combined.json | 33 ++++++++
|
||||
.../usr/share/qemu/firmware/60-ovmf-sb.json | 1 +
|
||||
tests/qemufirmwaretest.c | 31 ++++++--
|
||||
8 files changed, 246 insertions(+), 21 deletions(-)
|
||||
create mode 100644 tests/qemufirmwaredata/out/usr/share/qemu/firmware/50-ovmf-sb-keys.json
|
||||
create mode 100644 tests/qemufirmwaredata/out/usr/share/qemu/firmware/61-ovmf.json
|
||||
create mode 100644 tests/qemufirmwaredata/out/usr/share/qemu/firmware/70-aavmf.json
|
||||
create mode 100644 tests/qemufirmwaredata/usr/share/qemu/firmware/45-ovmf-sev-stateless.json
|
||||
create mode 100644 tests/qemufirmwaredata/usr/share/qemu/firmware/55-ovmf-sb-combined.json
|
||||
|
||||
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
|
||||
index 529ab8d68e..7911d45aa0 100644
|
||||
--- a/src/qemu/qemu_firmware.c
|
||||
+++ b/src/qemu/qemu_firmware.c
|
||||
@@ -59,6 +59,22 @@ VIR_ENUM_IMPL(qemuFirmwareOSInterface,
|
||||
);
|
||||
|
||||
|
||||
+typedef enum {
|
||||
+ QEMU_FIRMWARE_FLASH_MODE_SPLIT,
|
||||
+ QEMU_FIRMWARE_FLASH_MODE_COMBINED,
|
||||
+ QEMU_FIRMWARE_FLASH_MODE_STATELESS,
|
||||
+
|
||||
+ QEMU_FIRMWARE_FLASH_MODE_LAST,
|
||||
+} qemuFirmwareFlashMode;
|
||||
+
|
||||
+VIR_ENUM_DECL(qemuFirmwareFlashMode);
|
||||
+VIR_ENUM_IMPL(qemuFirmwareFlashMode,
|
||||
+ QEMU_FIRMWARE_FLASH_MODE_LAST,
|
||||
+ "split",
|
||||
+ "combined",
|
||||
+ "stateless",
|
||||
+);
|
||||
+
|
||||
typedef struct _qemuFirmwareFlashFile qemuFirmwareFlashFile;
|
||||
struct _qemuFirmwareFlashFile {
|
||||
char *filename;
|
||||
@@ -68,6 +84,7 @@ struct _qemuFirmwareFlashFile {
|
||||
|
||||
typedef struct _qemuFirmwareMappingFlash qemuFirmwareMappingFlash;
|
||||
struct _qemuFirmwareMappingFlash {
|
||||
+ qemuFirmwareFlashMode mode;
|
||||
qemuFirmwareFlashFile executable;
|
||||
qemuFirmwareFlashFile nvram_template;
|
||||
};
|
||||
@@ -359,9 +376,31 @@ qemuFirmwareMappingFlashParse(const char *path,
|
||||
virJSONValue *doc,
|
||||
qemuFirmwareMappingFlash *flash)
|
||||
{
|
||||
+ virJSONValue *mode;
|
||||
virJSONValue *executable;
|
||||
virJSONValue *nvram_template;
|
||||
|
||||
+ if (!(mode = virJSONValueObjectGet(doc, "mode"))) {
|
||||
+ /* Historical default */
|
||||
+ flash->mode = QEMU_FIRMWARE_FLASH_MODE_SPLIT;
|
||||
+ } else {
|
||||
+ const char *modestr = virJSONValueGetString(mode);
|
||||
+ int modeval;
|
||||
+ if (!modestr) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("Firmware flash mode value was malformed"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ modeval = qemuFirmwareFlashModeTypeFromString(modestr);
|
||||
+ if (modeval < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Firmware flash mode value '%s' unexpected"),
|
||||
+ modestr);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ flash->mode = modeval;
|
||||
+ }
|
||||
+
|
||||
if (!(executable = virJSONValueObjectGet(doc, "executable"))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("missing 'executable' in '%s'"),
|
||||
@@ -372,15 +411,17 @@ qemuFirmwareMappingFlashParse(const char *path,
|
||||
if (qemuFirmwareFlashFileParse(path, executable, &flash->executable) < 0)
|
||||
return -1;
|
||||
|
||||
- if (!(nvram_template = virJSONValueObjectGet(doc, "nvram-template"))) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("missing 'nvram-template' in '%s'"),
|
||||
- path);
|
||||
- return -1;
|
||||
- }
|
||||
+ if (flash->mode == QEMU_FIRMWARE_FLASH_MODE_SPLIT) {
|
||||
+ if (!(nvram_template = virJSONValueObjectGet(doc, "nvram-template"))) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("missing 'nvram-template' in '%s'"),
|
||||
+ path);
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- if (qemuFirmwareFlashFileParse(path, nvram_template, &flash->nvram_template) < 0)
|
||||
- return -1;
|
||||
+ if (qemuFirmwareFlashFileParse(path, nvram_template, &flash->nvram_template) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -693,10 +734,12 @@ qemuFirmwareMappingFlashFormat(virJSONValue *mapping,
|
||||
g_autoptr(virJSONValue) executable = NULL;
|
||||
g_autoptr(virJSONValue) nvram_template = NULL;
|
||||
|
||||
- if (!(executable = qemuFirmwareFlashFileFormat(flash->executable)))
|
||||
+ if (virJSONValueObjectAppendString(mapping,
|
||||
+ "mode",
|
||||
+ qemuFirmwareFlashModeTypeToString(flash->mode)) < 0)
|
||||
return -1;
|
||||
|
||||
- if (!(nvram_template = qemuFirmwareFlashFileFormat(flash->nvram_template)))
|
||||
+ if (!(executable = qemuFirmwareFlashFileFormat(flash->executable)))
|
||||
return -1;
|
||||
|
||||
if (virJSONValueObjectAppend(mapping,
|
||||
@@ -704,11 +747,15 @@ qemuFirmwareMappingFlashFormat(virJSONValue *mapping,
|
||||
&executable) < 0)
|
||||
return -1;
|
||||
|
||||
+ if (flash->mode == QEMU_FIRMWARE_FLASH_MODE_SPLIT) {
|
||||
+ if (!(nvram_template = qemuFirmwareFlashFileFormat(flash->nvram_template)))
|
||||
+ return -1;
|
||||
|
||||
- if (virJSONValueObjectAppend(mapping,
|
||||
+ if (virJSONValueObjectAppend(mapping,
|
||||
"nvram-template",
|
||||
- &nvram_template) < 0)
|
||||
- return -1;
|
||||
+ &nvram_template) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1053,6 +1100,12 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (fw->mapping.device == QEMU_FIRMWARE_DEVICE_FLASH &&
|
||||
+ fw->mapping.data.flash.mode != QEMU_FIRMWARE_FLASH_MODE_SPLIT) {
|
||||
+ VIR_DEBUG("Discarding loader without split flash");
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
if (def->sec) {
|
||||
switch ((virDomainLaunchSecurity) def->sec->sectype) {
|
||||
case VIR_DOMAIN_LAUNCH_SECURITY_SEV:
|
||||
diff --git a/tests/qemufirmwaredata/out/usr/share/qemu/firmware/50-ovmf-sb-keys.json b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/50-ovmf-sb-keys.json
|
||||
new file mode 100644
|
||||
index 0000000000..c251682cd9
|
||||
--- /dev/null
|
||||
+++ b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/50-ovmf-sb-keys.json
|
||||
@@ -0,0 +1,33 @@
|
||||
+{
|
||||
+ "interface-types": [
|
||||
+ "uefi"
|
||||
+ ],
|
||||
+ "mapping": {
|
||||
+ "device": "flash",
|
||||
+ "mode": "split",
|
||||
+ "executable": {
|
||||
+ "filename": "/usr/share/OVMF/OVMF_CODE.secboot.fd",
|
||||
+ "format": "raw"
|
||||
+ },
|
||||
+ "nvram-template": {
|
||||
+ "filename": "/usr/share/OVMF/OVMF_VARS.secboot.fd",
|
||||
+ "format": "raw"
|
||||
+ }
|
||||
+ },
|
||||
+ "targets": [
|
||||
+ {
|
||||
+ "architecture": "x86_64",
|
||||
+ "machines": [
|
||||
+ "pc-q35-*"
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "features": [
|
||||
+ "acpi-s3",
|
||||
+ "amd-sev",
|
||||
+ "enrolled-keys",
|
||||
+ "requires-smm",
|
||||
+ "secure-boot",
|
||||
+ "verbose-dynamic"
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/tests/qemufirmwaredata/out/usr/share/qemu/firmware/61-ovmf.json b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/61-ovmf.json
|
||||
new file mode 100644
|
||||
index 0000000000..2a9aa23efb
|
||||
--- /dev/null
|
||||
+++ b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/61-ovmf.json
|
||||
@@ -0,0 +1,31 @@
|
||||
+{
|
||||
+ "interface-types": [
|
||||
+ "uefi"
|
||||
+ ],
|
||||
+ "mapping": {
|
||||
+ "device": "flash",
|
||||
+ "mode": "split",
|
||||
+ "executable": {
|
||||
+ "filename": "/usr/share/OVMF/OVMF_CODE.fd",
|
||||
+ "format": "raw"
|
||||
+ },
|
||||
+ "nvram-template": {
|
||||
+ "filename": "/usr/share/OVMF/OVMF_VARS.fd",
|
||||
+ "format": "raw"
|
||||
+ }
|
||||
+ },
|
||||
+ "targets": [
|
||||
+ {
|
||||
+ "architecture": "x86_64",
|
||||
+ "machines": [
|
||||
+ "pc-i440fx-*",
|
||||
+ "pc-q35-*"
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "features": [
|
||||
+ "acpi-s3",
|
||||
+ "amd-sev",
|
||||
+ "verbose-dynamic"
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/tests/qemufirmwaredata/out/usr/share/qemu/firmware/70-aavmf.json b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/70-aavmf.json
|
||||
new file mode 100644
|
||||
index 0000000000..9bd5ac2868
|
||||
--- /dev/null
|
||||
+++ b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/70-aavmf.json
|
||||
@@ -0,0 +1,28 @@
|
||||
+{
|
||||
+ "interface-types": [
|
||||
+ "uefi"
|
||||
+ ],
|
||||
+ "mapping": {
|
||||
+ "device": "flash",
|
||||
+ "mode": "split",
|
||||
+ "executable": {
|
||||
+ "filename": "/usr/share/AAVMF/AAVMF_CODE.fd",
|
||||
+ "format": "raw"
|
||||
+ },
|
||||
+ "nvram-template": {
|
||||
+ "filename": "/usr/share/AAVMF/AAVMF_VARS.fd",
|
||||
+ "format": "raw"
|
||||
+ }
|
||||
+ },
|
||||
+ "targets": [
|
||||
+ {
|
||||
+ "architecture": "aarch64",
|
||||
+ "machines": [
|
||||
+ "virt-*"
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "features": [
|
||||
+
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/tests/qemufirmwaredata/usr/share/qemu/firmware/45-ovmf-sev-stateless.json b/tests/qemufirmwaredata/usr/share/qemu/firmware/45-ovmf-sev-stateless.json
|
||||
new file mode 100644
|
||||
index 0000000000..5a619f3ab0
|
||||
--- /dev/null
|
||||
+++ b/tests/qemufirmwaredata/usr/share/qemu/firmware/45-ovmf-sev-stateless.json
|
||||
@@ -0,0 +1,31 @@
|
||||
+{
|
||||
+ "description": "OVMF for x86_64, with SEV, without SB, without SMM, with NO varstore",
|
||||
+ "interface-types": [
|
||||
+ "uefi"
|
||||
+ ],
|
||||
+ "mapping": {
|
||||
+ "device": "flash",
|
||||
+ "mode": "stateless",
|
||||
+ "executable": {
|
||||
+ "filename": "/usr/share/OVMF/OVMF.sev.fd",
|
||||
+ "format": "raw"
|
||||
+ }
|
||||
+ },
|
||||
+ "targets": [
|
||||
+ {
|
||||
+ "architecture": "x86_64",
|
||||
+ "machines": [
|
||||
+ "pc-q35-*"
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "features": [
|
||||
+ "acpi-s3",
|
||||
+ "amd-sev",
|
||||
+ "amd-sev-es",
|
||||
+ "verbose-dynamic"
|
||||
+ ],
|
||||
+ "tags": [
|
||||
+
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/tests/qemufirmwaredata/usr/share/qemu/firmware/55-ovmf-sb-combined.json b/tests/qemufirmwaredata/usr/share/qemu/firmware/55-ovmf-sb-combined.json
|
||||
new file mode 100644
|
||||
index 0000000000..eb3332e4ab
|
||||
--- /dev/null
|
||||
+++ b/tests/qemufirmwaredata/usr/share/qemu/firmware/55-ovmf-sb-combined.json
|
||||
@@ -0,0 +1,33 @@
|
||||
+{
|
||||
+ "description": "OVMF with SB+SMM, SB enabled, MS certs enrolled",
|
||||
+ "interface-types": [
|
||||
+ "uefi"
|
||||
+ ],
|
||||
+ "mapping": {
|
||||
+ "device": "flash",
|
||||
+ "mode": "combined",
|
||||
+ "executable": {
|
||||
+ "filename": "/usr/share/OVMF/OVMF.secboot.fd",
|
||||
+ "format": "raw"
|
||||
+ }
|
||||
+ },
|
||||
+ "targets": [
|
||||
+ {
|
||||
+ "architecture": "x86_64",
|
||||
+ "machines": [
|
||||
+ "pc-q35-*"
|
||||
+ ]
|
||||
+ }
|
||||
+ ],
|
||||
+ "features": [
|
||||
+ "acpi-s3",
|
||||
+ "amd-sev",
|
||||
+ "enrolled-keys",
|
||||
+ "requires-smm",
|
||||
+ "secure-boot",
|
||||
+ "verbose-dynamic"
|
||||
+ ],
|
||||
+ "tags": [
|
||||
+
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/tests/qemufirmwaredata/usr/share/qemu/firmware/60-ovmf-sb.json b/tests/qemufirmwaredata/usr/share/qemu/firmware/60-ovmf-sb.json
|
||||
index 5e8a94ae78..a5273a5e8b 100644
|
||||
--- a/tests/qemufirmwaredata/usr/share/qemu/firmware/60-ovmf-sb.json
|
||||
+++ b/tests/qemufirmwaredata/usr/share/qemu/firmware/60-ovmf-sb.json
|
||||
@@ -5,6 +5,7 @@
|
||||
],
|
||||
"mapping": {
|
||||
"device": "flash",
|
||||
+ "mode": "split",
|
||||
"executable": {
|
||||
"filename": "/usr/share/OVMF/OVMF_CODE.secboot.fd",
|
||||
"format": "raw"
|
||||
diff --git a/tests/qemufirmwaretest.c b/tests/qemufirmwaretest.c
|
||||
index cad4b6d383..fc3416b2ae 100644
|
||||
--- a/tests/qemufirmwaretest.c
|
||||
+++ b/tests/qemufirmwaretest.c
|
||||
@@ -17,22 +17,31 @@ static int
|
||||
testParseFormatFW(const void *opaque)
|
||||
{
|
||||
const char *filename = opaque;
|
||||
- g_autofree char *path = NULL;
|
||||
+ g_autofree char *inpath = NULL;
|
||||
+ g_autofree char *outpath = NULL;
|
||||
g_autoptr(qemuFirmware) fw = NULL;
|
||||
- g_autofree char *buf = NULL;
|
||||
g_autoptr(virJSONValue) json = NULL;
|
||||
g_autofree char *expected = NULL;
|
||||
g_autofree char *actual = NULL;
|
||||
+ g_autofree char *buf = NULL;
|
||||
|
||||
- path = g_strdup_printf("%s/qemufirmwaredata/%s", abs_srcdir, filename);
|
||||
+ inpath = g_strdup_printf("%s/qemufirmwaredata/%s", abs_srcdir, filename);
|
||||
+ outpath = g_strdup_printf("%s/qemufirmwaredata/out/%s", abs_srcdir, filename);
|
||||
|
||||
- if (!(fw = qemuFirmwareParse(path)))
|
||||
+ if (!(fw = qemuFirmwareParse(inpath)))
|
||||
return -1;
|
||||
|
||||
- if (virFileReadAll(path,
|
||||
- 1024 * 1024, /* 1MiB */
|
||||
- &buf) < 0)
|
||||
- return -1;
|
||||
+ if (virFileExists(outpath)) {
|
||||
+ if (virFileReadAll(outpath,
|
||||
+ 1024 * 1024, /* 1MiB */
|
||||
+ &buf) < 0)
|
||||
+ return -1;
|
||||
+ } else {
|
||||
+ if (virFileReadAll(inpath,
|
||||
+ 1024 * 1024, /* 1MiB */
|
||||
+ &buf) < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
if (!(json = virJSONValueFromString(buf)))
|
||||
return -1;
|
||||
@@ -60,7 +69,9 @@ testFWPrecedence(const void *opaque G_GNUC_UNUSED)
|
||||
const char *expected[] = {
|
||||
PREFIX "/share/qemu/firmware/40-bios.json",
|
||||
SYSCONFDIR "/qemu/firmware/40-ovmf-sb-keys.json",
|
||||
+ PREFIX "/share/qemu/firmware/45-ovmf-sev-stateless.json",
|
||||
PREFIX "/share/qemu/firmware/50-ovmf-sb-keys.json",
|
||||
+ PREFIX "/share/qemu/firmware/55-ovmf-sb-combined.json",
|
||||
PREFIX "/share/qemu/firmware/61-ovmf.json",
|
||||
PREFIX "/share/qemu/firmware/70-aavmf.json",
|
||||
NULL
|
||||
@@ -218,7 +229,9 @@ mymain(void)
|
||||
} while (0)
|
||||
|
||||
DO_PARSE_TEST("usr/share/qemu/firmware/40-bios.json");
|
||||
+ DO_PARSE_TEST("usr/share/qemu/firmware/45-ovmf-sev-stateless.json");
|
||||
DO_PARSE_TEST("usr/share/qemu/firmware/50-ovmf-sb-keys.json");
|
||||
+ DO_PARSE_TEST("usr/share/qemu/firmware/55-ovmf-sb-combined.json");
|
||||
DO_PARSE_TEST("usr/share/qemu/firmware/60-ovmf-sb.json");
|
||||
DO_PARSE_TEST("usr/share/qemu/firmware/61-ovmf.json");
|
||||
DO_PARSE_TEST("usr/share/qemu/firmware/70-aavmf.json");
|
||||
@@ -250,6 +263,8 @@ mymain(void)
|
||||
DO_SUPPORTED_TEST("pc-q35-3.1", VIR_ARCH_X86_64, true,
|
||||
"/usr/share/seabios/bios-256k.bin:NULL:"
|
||||
"/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.secboot.fd:"
|
||||
+ "/usr/share/OVMF/OVMF.sev.fd:NULL:"
|
||||
+ "/usr/share/OVMF/OVMF.secboot.fd:NULL:"
|
||||
"/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd",
|
||||
VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS,
|
||||
VIR_DOMAIN_OS_DEF_FIRMWARE_EFI);
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
From 563e17f59f088d4ba76e7a95ea8958792ae165e2 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <563e17f59f088d4ba76e7a95ea8958792ae165e2@dist-git>
|
||||
From: Jonathon Jongsma <jjongsma@redhat.com>
|
||||
Date: Tue, 1 Mar 2022 16:55:21 -0600
|
||||
Subject: [PATCH] qemu: support multiqueue for vdpa net device
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024406
|
||||
|
||||
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
|
||||
(cherry picked from commit a5e659f071ae5f5fc9aadb46ad7c31736425f8cf)
|
||||
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_domain.c | 3 +-
|
||||
.../net-vdpa-multiqueue.x86_64-latest.args | 36 +++++++++++++++++++
|
||||
.../qemuxml2argvdata/net-vdpa-multiqueue.xml | 30 ++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 1 +
|
||||
.../net-vdpa-multiqueue.xml | 36 +++++++++++++++++++
|
||||
tests/qemuxml2xmltest.c | 1 +
|
||||
6 files changed, 106 insertions(+), 1 deletion(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
|
||||
create mode 100644 tests/qemuxml2argvdata/net-vdpa-multiqueue.xml
|
||||
create mode 100644 tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index a8401bac30..68052769af 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -4511,7 +4511,8 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net,
|
||||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
||||
actualType == VIR_DOMAIN_NET_TYPE_DIRECT ||
|
||||
actualType == VIR_DOMAIN_NET_TYPE_ETHERNET ||
|
||||
- actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER)) {
|
||||
+ actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER ||
|
||||
+ actualType == VIR_DOMAIN_NET_TYPE_VDPA)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("interface %s - multiqueue is not supported for network interfaces of type %s"),
|
||||
macstr, virDomainNetTypeToString(actualType));
|
||||
diff --git a/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
|
||||
new file mode 100644
|
||||
index 0000000000..61ba85a847
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
|
||||
@@ -0,0 +1,36 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
|
||||
+USER=test \
|
||||
+LOGNAME=test \
|
||||
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
|
||||
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
|
||||
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
||||
+/usr/bin/qemu-system-x86_64 \
|
||||
+-name guest=QEMUGuest1,debug-threads=on \
|
||||
+-S \
|
||||
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
|
||||
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
|
||||
+-accel tcg \
|
||||
+-cpu qemu64 \
|
||||
+-m 214 \
|
||||
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
|
||||
+-overcommit mem-lock=off \
|
||||
+-smp 1,sockets=1,cores=1,threads=1 \
|
||||
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
+-display none \
|
||||
+-no-user-config \
|
||||
+-nodefaults \
|
||||
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
+-rtc base=utc \
|
||||
+-no-shutdown \
|
||||
+-no-acpi \
|
||||
+-boot strict=on \
|
||||
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
||||
+-add-fd set=0,fd=1732,opaque=/dev/vhost-vdpa-0 \
|
||||
+-netdev vhost-vdpa,vhostdev=/dev/fdset/0,id=hostnet0 \
|
||||
+-device virtio-net-pci,mq=on,vectors=6,netdev=hostnet0,id=net0,mac=52:54:00:95:db:c0,bus=pci.0,addr=0x2 \
|
||||
+-audiodev '{"id":"audio1","driver":"none"}' \
|
||||
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
||||
+-msg timestamp=on
|
||||
diff --git a/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml b/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml
|
||||
new file mode 100644
|
||||
index 0000000000..6e369c1916
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml
|
||||
@@ -0,0 +1,30 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu placement='static'>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='x86_64' machine='pc'>hvm</type>
|
||||
+ <boot dev='hd'/>
|
||||
+ </os>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
+ <controller type='usb' index='0'/>
|
||||
+ <controller type='ide' index='0'/>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <interface type='vdpa'>
|
||||
+ <mac address='52:54:00:95:db:c0'/>
|
||||
+ <source dev='/dev/vhost-vdpa-0'/>
|
||||
+ <model type='virtio'/>
|
||||
+ <driver queues='2'/>
|
||||
+ </interface>
|
||||
+ <input type='mouse' bus='ps2'/>
|
||||
+ <input type='keyboard' bus='ps2'/>
|
||||
+ <memballoon model='none'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index cc67d806e4..1abb5d0124 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1652,6 +1652,7 @@ mymain(void)
|
||||
DO_TEST_FAILURE("net-hostdev-fail",
|
||||
QEMU_CAPS_DEVICE_VFIO_PCI);
|
||||
DO_TEST_CAPS_LATEST("net-vdpa");
|
||||
+ DO_TEST_CAPS_LATEST("net-vdpa-multiqueue");
|
||||
|
||||
DO_TEST("hostdev-pci-multifunction",
|
||||
QEMU_CAPS_KVM,
|
||||
diff --git a/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml b/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml
|
||||
new file mode 100644
|
||||
index 0000000000..0876d5df62
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml
|
||||
@@ -0,0 +1,36 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu placement='static'>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='x86_64' machine='pc'>hvm</type>
|
||||
+ <boot dev='hd'/>
|
||||
+ </os>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
+ <controller type='usb' index='0'>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
+ </controller>
|
||||
+ <controller type='ide' index='0'>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
+ </controller>
|
||||
+ <controller type='pci' index='0' model='pci-root'/>
|
||||
+ <interface type='vdpa'>
|
||||
+ <mac address='52:54:00:95:db:c0'/>
|
||||
+ <source dev='/dev/vhost-vdpa-0'/>
|
||||
+ <model type='virtio'/>
|
||||
+ <driver queues='2'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||
+ </interface>
|
||||
+ <input type='mouse' bus='ps2'/>
|
||||
+ <input type='keyboard' bus='ps2'/>
|
||||
+ <audio id='1' type='none'/>
|
||||
+ <memballoon model='none'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
||||
index fb438269b9..772586cf19 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -461,6 +461,7 @@ mymain(void)
|
||||
DO_TEST_NOCAPS("net-coalesce");
|
||||
DO_TEST_NOCAPS("net-many-models");
|
||||
DO_TEST("net-vdpa", QEMU_CAPS_NETDEV_VHOST_VDPA);
|
||||
+ DO_TEST("net-vdpa-multiqueue", QEMU_CAPS_NETDEV_VHOST_VDPA);
|
||||
|
||||
DO_TEST_NOCAPS("serial-tcp-tlsx509-chardev");
|
||||
DO_TEST_NOCAPS("serial-tcp-tlsx509-chardev-notls");
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,219 @@
|
|||
From e3487aab5319df05c5a06a83e4d3e4a87c1e51a9 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e3487aab5319df05c5a06a83e4d3e4a87c1e51a9@dist-git>
|
||||
From: Vasiliy Ulyanov <vulyanov@suse.de>
|
||||
Date: Wed, 2 Feb 2022 17:28:16 +0100
|
||||
Subject: [PATCH] qemu: tpm: Get swtpm pid without binary validation
|
||||
|
||||
Access to /proc/[pid]/exe may be restricted in certain environments (e.g.
|
||||
in containers) and any attempt to stat(2) or readlink(2) the file will
|
||||
result in 'permission denied' error if the calling process does not have
|
||||
CAP_SYS_PTRACE capability. According to proc(5) manpage:
|
||||
|
||||
Permission to dereference or read (readlink(2)) this symbolic link is
|
||||
governed by a ptrace access mode PTRACE_MODE_READ_FSCREDS check; see
|
||||
ptrace(2).
|
||||
|
||||
The binary validation in virPidFileReadPathIfAlive may fail with EACCES.
|
||||
Therefore instead do only the check that the pidfile is locked by the
|
||||
correct process. To ensure this is always the case the daemonization and
|
||||
pidfile handling of the swtpm command is now controlled by libvirt.
|
||||
|
||||
Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit a9c500d2b50c5c041a1bb6ae9724402cf1cec8fe)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2152188
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_tpm.c | 94 ++++++++++++++++++++++++++-------------------
|
||||
1 file changed, 54 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
|
||||
index 7e7b01768e..9c5d1ffed4 100644
|
||||
--- a/src/qemu/qemu_tpm.c
|
||||
+++ b/src/qemu/qemu_tpm.c
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "qemu_tpm.h"
|
||||
#include "virtpm.h"
|
||||
#include "virsecret.h"
|
||||
+#include "virtime.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
||||
@@ -258,13 +259,13 @@ qemuTPMEmulatorGetPid(const char *swtpmStateDir,
|
||||
const char *shortName,
|
||||
pid_t *pid)
|
||||
{
|
||||
- g_autofree char *swtpm = virTPMGetSwtpm();
|
||||
g_autofree char *pidfile = qemuTPMEmulatorCreatePidFilename(swtpmStateDir,
|
||||
shortName);
|
||||
+
|
||||
if (!pidfile)
|
||||
return -1;
|
||||
|
||||
- if (virPidFileReadPathIfAlive(pidfile, pid, swtpm) < 0)
|
||||
+ if (virPidFileReadPathIfLocked(pidfile, pid) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -660,9 +661,6 @@ qemuTPMEmulatorReconfigure(const char *storagepath,
|
||||
* @privileged: whether we are running in privileged mode
|
||||
* @swtpm_user: The uid for the swtpm to run as (drop privileges to from root)
|
||||
* @swtpm_group: The gid for the swtpm to run as
|
||||
- * @swtpmStateDir: the directory where swtpm writes the pid file and creates the
|
||||
- * Unix socket
|
||||
- * @shortName: the short name of the VM
|
||||
* @incomingMigration: whether we have an incoming migration
|
||||
*
|
||||
* Create the virCommand use for starting the emulator
|
||||
@@ -676,13 +674,10 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm,
|
||||
bool privileged,
|
||||
uid_t swtpm_user,
|
||||
gid_t swtpm_group,
|
||||
- const char *swtpmStateDir,
|
||||
- const char *shortName,
|
||||
bool incomingMigration)
|
||||
{
|
||||
g_autoptr(virCommand) cmd = NULL;
|
||||
bool created = false;
|
||||
- g_autofree char *pidfile = NULL;
|
||||
g_autofree char *swtpm = virTPMGetSwtpm();
|
||||
int pwdfile_fd = -1;
|
||||
int migpwdfile_fd = -1;
|
||||
@@ -721,7 +716,7 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm,
|
||||
|
||||
virCommandClearCaps(cmd);
|
||||
|
||||
- virCommandAddArgList(cmd, "socket", "--daemon", "--ctrl", NULL);
|
||||
+ virCommandAddArgList(cmd, "socket", "--ctrl", NULL);
|
||||
virCommandAddArgFormat(cmd, "type=unixio,path=%s,mode=0600",
|
||||
tpm->data.emulator.source->data.nix.path);
|
||||
|
||||
@@ -748,12 +743,6 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm,
|
||||
break;
|
||||
}
|
||||
|
||||
- if (!(pidfile = qemuTPMEmulatorCreatePidFilename(swtpmStateDir, shortName)))
|
||||
- goto error;
|
||||
-
|
||||
- virCommandAddArg(cmd, "--pid");
|
||||
- virCommandAddArgFormat(cmd, "file=%s", pidfile);
|
||||
-
|
||||
if (tpm->data.emulator.hassecretuuid) {
|
||||
if (!virTPMSwtpmCapsGet(VIR_TPM_SWTPM_FEATURE_CMDARG_PWD_FD)) {
|
||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
|
||||
@@ -904,12 +893,14 @@ qemuExtTPMStartEmulator(virQEMUDriver *driver,
|
||||
bool incomingMigration)
|
||||
{
|
||||
g_autoptr(virCommand) cmd = NULL;
|
||||
- int exitstatus = 0;
|
||||
- g_autofree char *errbuf = NULL;
|
||||
+ VIR_AUTOCLOSE errfd = -1;
|
||||
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
||||
g_autofree char *shortName = virDomainDefGetShortName(vm->def);
|
||||
- int cmdret = 0, timeout, rc;
|
||||
- pid_t pid;
|
||||
+ g_autofree char *pidfile = NULL;
|
||||
+ virTimeBackOffVar timebackoff;
|
||||
+ const unsigned long long timeout = 1000; /* ms */
|
||||
+ int cmdret = 0;
|
||||
+ pid_t pid = -1;
|
||||
|
||||
if (!shortName)
|
||||
return -1;
|
||||
@@ -923,48 +914,71 @@ qemuExtTPMStartEmulator(virQEMUDriver *driver,
|
||||
driver->privileged,
|
||||
cfg->swtpm_user,
|
||||
cfg->swtpm_group,
|
||||
- cfg->swtpmStateDir, shortName,
|
||||
incomingMigration)))
|
||||
return -1;
|
||||
|
||||
if (qemuExtDeviceLogCommand(driver, vm, cmd, "TPM Emulator") < 0)
|
||||
return -1;
|
||||
|
||||
- virCommandSetErrorBuffer(cmd, &errbuf);
|
||||
+ if (!(pidfile = qemuTPMEmulatorCreatePidFilename(cfg->swtpmStateDir, shortName)))
|
||||
+ return -1;
|
||||
+
|
||||
+ virCommandDaemonize(cmd);
|
||||
+ virCommandSetPidFile(cmd, pidfile);
|
||||
+ virCommandSetErrorFD(cmd, &errfd);
|
||||
|
||||
if (qemuSecurityStartTPMEmulator(driver, vm, cmd,
|
||||
cfg->swtpm_user, cfg->swtpm_group,
|
||||
- &exitstatus, &cmdret) < 0)
|
||||
+ NULL, &cmdret) < 0)
|
||||
return -1;
|
||||
|
||||
- if (cmdret < 0 || exitstatus != 0) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("Could not start 'swtpm'. exitstatus: %d, "
|
||||
- "error: %s"), exitstatus, errbuf);
|
||||
- return -1;
|
||||
+ if (cmdret < 0) {
|
||||
+ /* virCommandRun() hidden in qemuSecurityStartTPMEmulator()
|
||||
+ * already reported error. */
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
- /* check that the swtpm has written its pid into the file */
|
||||
- timeout = 1000; /* ms */
|
||||
- while (timeout > 0) {
|
||||
- rc = qemuTPMEmulatorGetPid(cfg->swtpmStateDir, shortName, &pid);
|
||||
- if (rc < 0) {
|
||||
- timeout -= 50;
|
||||
- g_usleep(50 * 1000);
|
||||
+ if (virPidFileReadPath(pidfile, &pid) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("swtpm didn't show up"));
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ if (virTimeBackOffStart(&timebackoff, 1, timeout) < 0)
|
||||
+ goto error;
|
||||
+ while (virTimeBackOffWait(&timebackoff)) {
|
||||
+ char errbuf[1024] = { 0 };
|
||||
+
|
||||
+ if (virFileExists(tpm->data.emulator.source->data.nix.path))
|
||||
+ break;
|
||||
+
|
||||
+ if (virProcessKill(pid, 0) == 0)
|
||||
continue;
|
||||
+
|
||||
+ if (saferead(errfd, errbuf, sizeof(errbuf) - 1) < 0) {
|
||||
+ virReportSystemError(errno, "%s",
|
||||
+ _("swtpm died unexpectedly"));
|
||||
+ } else {
|
||||
+ virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
+ _("swtpm died and reported: %s"), errbuf);
|
||||
}
|
||||
- if (rc == 0 && pid == (pid_t)-1)
|
||||
- goto error;
|
||||
- break;
|
||||
+ goto error;
|
||||
}
|
||||
- if (timeout <= 0)
|
||||
+
|
||||
+ if (!virFileExists(tpm->data.emulator.source->data.nix.path)) {
|
||||
+ virReportError(VIR_ERR_OPERATION_TIMEOUT, "%s",
|
||||
+ _("swtpm socket did not show up"));
|
||||
goto error;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
- _("swtpm failed to start"));
|
||||
+ virCommandAbort(cmd);
|
||||
+ if (pid >= 0)
|
||||
+ virProcessKillPainfully(pid, true);
|
||||
+ if (pidfile)
|
||||
+ unlink(pidfile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
--
|
||||
2.39.0
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
From 44f83782ba882f9eb037a54fb75231c305d98712 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <44f83782ba882f9eb037a54fb75231c305d98712@dist-git>
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Fri, 10 Jun 2022 15:25:00 +0200
|
||||
Subject: [PATCH] qemu: virtiofs: format --thread-pool-size
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2079582
|
||||
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 2753eba20ce76d3d8785b23a6e940574ca12fe3c)
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_virtiofs.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c
|
||||
index 1b853a5a59..1ee3781286 100644
|
||||
--- a/src/qemu/qemu_virtiofs.c
|
||||
+++ b/src/qemu/qemu_virtiofs.c
|
||||
@@ -163,6 +163,10 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg,
|
||||
virBufferAddLit(&opts, ",no_posix_lock");
|
||||
|
||||
virCommandAddArgBuffer(cmd, &opts);
|
||||
+
|
||||
+ if (fs->thread_pool_size >= 0)
|
||||
+ virCommandAddArgFormat(cmd, "--thread-pool-size=%i", fs->thread_pool_size);
|
||||
+
|
||||
if (cfg->virtiofsdDebug)
|
||||
virCommandAddArg(cmd, "-d");
|
||||
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
From 1ad707f19e570b76c1f6517194d9cc86b084014d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <1ad707f19e570b76c1f6517194d9cc86b084014d@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Thu, 1 Dec 2022 17:02:42 +0100
|
||||
Subject: [PATCH] qemuAgentGetDisks: Don't use virJSONValueObjectGetStringArray
|
||||
for optional data
|
||||
|
||||
The 'dependencies' field in the return data may be missing in some
|
||||
cases. Historically 'virJSONValueObjectGetStringArray' didn't report
|
||||
error in such case, but later refactor (commit 043b50b948ef3c2 ) added
|
||||
an error in order to use it in other places too.
|
||||
|
||||
Unfortunately this results in the error log being spammed with an
|
||||
irrelevant error in case when qemuAgentGetDisks is invoked on a VM
|
||||
running windows.
|
||||
|
||||
Replace the use of virJSONValueObjectGetStringArray by fetching the
|
||||
array first and calling virJSONValueArrayToStringList only when we have
|
||||
an array.
|
||||
|
||||
Fixes: 043b50b948ef3c2a4adf5fa32a93ec2589851ac6
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2149752
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 3b576601dfb924bb518870a01de5d1a421cbb467)
|
||||
---
|
||||
src/qemu/qemu_agent.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
|
||||
index f33cd47078..8a55044c9e 100644
|
||||
--- a/src/qemu/qemu_agent.c
|
||||
+++ b/src/qemu/qemu_agent.c
|
||||
@@ -2550,6 +2550,7 @@ int qemuAgentGetDisks(qemuAgent *agent,
|
||||
for (i = 0; i < ndata; i++) {
|
||||
virJSONValue *addr;
|
||||
virJSONValue *entry = virJSONValueArrayGet(data, i);
|
||||
+ virJSONValue *dependencies;
|
||||
qemuAgentDiskInfo *disk;
|
||||
|
||||
if (!entry) {
|
||||
@@ -2575,7 +2576,11 @@ int qemuAgentGetDisks(qemuAgent *agent,
|
||||
goto error;
|
||||
}
|
||||
|
||||
- disk->dependencies = virJSONValueObjectGetStringArray(entry, "dependencies");
|
||||
+ if ((dependencies = virJSONValueObjectGetArray(entry, "dependencies"))) {
|
||||
+ if (!(disk->dependencies = virJSONValueArrayToStringList(dependencies)))
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
disk->alias = g_strdup(virJSONValueObjectGetString(entry, "alias"));
|
||||
addr = virJSONValueObjectGetObject(entry, "address");
|
||||
if (addr) {
|
||||
--
|
||||
2.39.0
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
From 0eec7bae9f59b2693798d25d346243109e92aeff Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0eec7bae9f59b2693798d25d346243109e92aeff@dist-git>
|
||||
From ab4488be3282dd5d0b9582e6a5d1dafbe7b90489 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ab4488be3282dd5d0b9582e6a5d1dafbe7b90489@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 25 Jan 2022 17:49:00 +0100
|
||||
Subject: [PATCH] qemuDomainSetupDisk: Initialize 'targetPaths'
|
||||
|
@ -18,7 +18,7 @@ Closes: https://gitlab.com/libvirt/libvirt/-/issues/268
|
|||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
(cherry picked from commit ddb2384f0c78a91c40d95afdbc7fe325e95ef2bc)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2046170
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2046172
|
||||
---
|
||||
src/qemu/qemu_namespace.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
From f20062e1fe1e7bca8b97d2383f9e8a06f0f4111a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f20062e1fe1e7bca8b97d2383f9e8a06f0f4111a@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Wed, 9 Nov 2022 11:06:25 +0100
|
||||
Subject: [PATCH] qemuMonitorJSONBlockStatsUpdateCapacityBlockdev: Use 'flat'
|
||||
mode of query-named-block-nodes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
'query-named-block-nodes' in non-flat mode returns redundantly nested
|
||||
data under the 'backing-image' field. Fortunately we don't need it when
|
||||
updating the capacity stats.
|
||||
|
||||
This function was unfortunately not fixed originally when the support
|
||||
for flat mode was added. Use the flat cached in the monitor object to
|
||||
force flat mode if available.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit bbd4d4899391b3bd1906cce61a3634f42f4b1bdf)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2170472
|
||||
---
|
||||
src/qemu/qemu_monitor_json.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
||||
index 7d8755246f..789554e225 100644
|
||||
--- a/src/qemu/qemu_monitor_json.c
|
||||
+++ b/src/qemu/qemu_monitor_json.c
|
||||
@@ -2679,7 +2679,7 @@ qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon,
|
||||
{
|
||||
g_autoptr(virJSONValue) nodes = NULL;
|
||||
|
||||
- if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, false)))
|
||||
+ if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, mon->queryNamedBlockNodesFlat)))
|
||||
return -1;
|
||||
|
||||
if (virJSONValueArrayForeachSteal(nodes,
|
||||
--
|
||||
2.40.1
|
|
@ -0,0 +1,57 @@
|
|||
From c5c8bb4aafc8f247e6da146a6683174038611600 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c5c8bb4aafc8f247e6da146a6683174038611600@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Wed, 28 Sep 2022 10:12:36 +0200
|
||||
Subject: [PATCH] qemuProcessReconnect: Don't build memory paths
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Let me take you on a short trip to history. A long time ago,
|
||||
libvirt would configure all QEMUs to use $hugetlbfs/libvirt/qemu
|
||||
for their hugepages setup. This was problematic, because it did
|
||||
not allow enough separation between guests. Therefore in
|
||||
v3.0.0-rc1~367 the path changed to a per-domain basis:
|
||||
|
||||
$hugetlbfs/libvirt/qemu/$domainShortName
|
||||
|
||||
And to help with migration on daemon restart a call to
|
||||
qemuProcessBuildDestroyMemoryPaths() was added to
|
||||
qemuProcessReconnect() (well, it was named
|
||||
qemuProcessBuildDestroyHugepagesPath() back then, see
|
||||
v3.10.0-rc1~174). This was desirable then, because the memory
|
||||
hotplug code did not call the function, it simply assumes
|
||||
per-domain paths to exist. But this changed in v3.5.0-rc1~92
|
||||
after which the per-domain paths are created on memory hotplug
|
||||
too.
|
||||
|
||||
Therefore, it's no longer necessary to create these paths in
|
||||
qemuProcessReconnect(). They are created exactly when needed
|
||||
(domain startup and memory hotplug).
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 3478cca80ea7382cfdbff836d5d0b92aa014297b)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_process.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 1164340aa9..0fb665bc82 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -8869,9 +8869,6 @@ qemuProcessReconnect(void *opaque)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (qemuProcessBuildDestroyMemoryPaths(driver, obj, NULL, true) < 0)
|
||||
- goto error;
|
||||
-
|
||||
if ((qemuDomainAssignAddresses(obj->def, priv->qemuCaps,
|
||||
driver, obj, false)) < 0) {
|
||||
goto error;
|
||||
--
|
||||
2.38.0
|
||||
|
|
@ -0,0 +1,314 @@
|
|||
From c387e7680c07d7dbb934dbe972e99ab78cebad28 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c387e7680c07d7dbb934dbe972e99ab78cebad28@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 16:55:05 +0100
|
||||
Subject: [PATCH] qemu_capabilities: Detect memory-backend-*.prealloc-threads
|
||||
property
|
||||
|
||||
The prealloc-threads is property of memory-backend class which is
|
||||
parent to the other three classes memory-backend-{ram,file,memfd}.
|
||||
Therefore the property is present for all, or none if QEMU is
|
||||
older than v5.0.0-rc0~75^2~1^2~3 which introduced the property.
|
||||
|
||||
Anyway, the .reserve property is the same story, and we chose
|
||||
memory-backend-file to detect it, so stick with our earlier
|
||||
decision and use the same backend to detect this new property.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit a30dac15dcdb7a6c7a3e9b6cfc5cd77bae185081)
|
||||
|
||||
Conflicts:
|
||||
src/qemu/qemu_capabilities.c: Context
|
||||
src/qemu/qemu_capabilities.h
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
|
||||
tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
|
||||
tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
|
||||
tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2067126
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 2 ++
|
||||
src/qemu/qemu_capabilities.h | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 +
|
||||
tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 +
|
||||
20 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 8ae80ef8d7..c4f7db55c8 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -657,6 +657,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
|
||||
|
||||
/* 420 */
|
||||
"blockdev-reopen.__com.redhat_rhel-av-8_2_0-api", /* QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API */
|
||||
+ "memory-backend-file.prealloc-threads", /* QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS */
|
||||
);
|
||||
|
||||
|
||||
@@ -1713,6 +1714,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendFile[] =
|
||||
* released qemu versions. */
|
||||
{ "x-use-canonical-path-for-ramblock-id", QEMU_CAPS_X_USE_CANONICAL_PATH_FOR_RAMBLOCK_ID },
|
||||
{ "reserve", QEMU_CAPS_MEMORY_BACKEND_RESERVE },
|
||||
+ { "prealloc-threads", QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS },
|
||||
};
|
||||
|
||||
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendMemfd[] = {
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index cde6c18b4c..8e65635e0d 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -636,6 +636,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
|
||||
|
||||
/* 420 */
|
||||
QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API, /* downstream support for blockdev reopen in rhel-av-8.2.0 */
|
||||
+ QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS, /* -object memory-backend-*.prealloc-threads */
|
||||
|
||||
QEMU_CAPS_LAST /* this must always be the last item */
|
||||
} virQEMUCapsFlags;
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
|
||||
index bb6a7d5ee7..3b18f160db 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
|
||||
@@ -179,6 +179,7 @@
|
||||
<flag name='input-linux'/>
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>61700241</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
|
||||
index f8317c1117..c90f2be296 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
|
||||
@@ -187,6 +187,7 @@
|
||||
<flag name='input-linux'/>
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900241</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
|
||||
index 58c7eb6651..8fbe8f114f 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
|
||||
@@ -171,6 +171,7 @@
|
||||
<flag name='input-linux'/>
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>0</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
|
||||
index 69f49020e7..b76c4346a4 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
|
||||
@@ -221,6 +221,7 @@
|
||||
<flag name='input-linux'/>
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100241</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml b/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
|
||||
index 58af90b29f..7de7c291f5 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
|
||||
@@ -90,6 +90,7 @@
|
||||
<flag name='rotation-rate'/>
|
||||
<flag name='input-linux'/>
|
||||
<flag name='query-display-options'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5001000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>0</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
|
||||
index 578e16e8b0..9b5cb3cd7a 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
|
||||
@@ -224,6 +224,7 @@
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
<flag name='virtio-mem-pci'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5001000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100242</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
|
||||
index b943eaedaf..020c04c1c4 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
|
||||
@@ -184,6 +184,7 @@
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>61700243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
|
||||
index ec64e1cacf..5346b1552c 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
|
||||
@@ -190,6 +190,7 @@
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
|
||||
index a11d15f91a..9f6974f85d 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
|
||||
@@ -174,6 +174,7 @@
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>0</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
|
||||
index 552e1d43c9..44753b64c3 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
|
||||
@@ -141,6 +141,7 @@
|
||||
<flag name='query-display-options'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>39100243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
|
||||
index bcc262551a..db11c99739 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
|
||||
@@ -227,6 +227,7 @@
|
||||
<flag name='virtio-mem-pci'/>
|
||||
<flag name='piix4.acpi-root-pci-hotplug'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>5002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
|
||||
index 0fefe64537..5f9a97df43 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
|
||||
@@ -192,6 +192,7 @@
|
||||
<flag name='set-action'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>6000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>61700242</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
|
||||
index 61685066b8..46bd1d3d2d 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
|
||||
@@ -149,6 +149,7 @@
|
||||
<flag name='set-action'/>
|
||||
<flag name='virtio-blk.queue-size'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>6000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>39100242</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
|
||||
index 0d6763e9a3..99bbb6e237 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
|
||||
@@ -236,6 +236,7 @@
|
||||
<flag name='piix4.acpi-root-pci-hotplug'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
<flag name='sev-inject-launch-secret'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>6000000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100242</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
|
||||
index 228f397c67..ff0715e605 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
|
||||
@@ -240,6 +240,7 @@
|
||||
<flag name='query-dirty-rate'/>
|
||||
<flag name='rbd-encryption'/>
|
||||
<flag name='sev-inject-launch-secret'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>6001000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100243</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
|
||||
index 6bf9933bc5..dd6f0e6919 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
|
||||
@@ -203,6 +203,7 @@
|
||||
<flag name='memory-backend-file.reserve'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
<flag name='rbd-encryption'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>6001050</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>61700244</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
|
||||
index 06cd7fb396..2646cdf88f 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
|
||||
@@ -199,6 +199,7 @@
|
||||
<flag name='piix4.acpi-root-pci-hotplug'/>
|
||||
<flag name='query-dirty-rate'/>
|
||||
<flag name='rbd-encryption'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>6001050</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>42900244</microcodeVersion>
|
||||
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
|
||||
index 75aaeed03c..f25ec1b84a 100644
|
||||
--- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
|
||||
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
|
||||
@@ -241,6 +241,7 @@
|
||||
<flag name='rbd-encryption'/>
|
||||
<flag name='sev-guest-kernel-hashes'/>
|
||||
<flag name='sev-inject-launch-secret'/>
|
||||
+ <flag name='memory-backend-file.prealloc-threads'/>
|
||||
<version>6002000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<microcodeVersion>43100244</microcodeVersion>
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
From 6f692c60b1d58135f439ad91e95d18540dfa6556 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6f692c60b1d58135f439ad91e95d18540dfa6556@dist-git>
|
||||
From e4e8b74f2cf090c8b29efcd3ceac4e4c4d07b929 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e4e8b74f2cf090c8b29efcd3ceac4e4c4d07b929@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Thu, 27 Jan 2022 11:13:53 +0100
|
||||
Subject: [PATCH] qemu_command: Generate memory only after controllers
|
||||
|
@ -41,6 +41,7 @@ tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args:
|
|||
These happened because downstream we don't use JSON for -device,
|
||||
but upstream we do (as of 1a691fe1c84090da80a652c4c80ac00a6134a69b).
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2050697
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_command.c | 6 +++---
|
||||
|
@ -72,10 +73,10 @@ Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|||
26 files changed, 65 insertions(+), 65 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index d822533ccb..509bab08ef 100644
|
||||
index 6b4647a711..2acdcca2ff 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -10543,9 +10543,6 @@ qemuBuildCommandLine(virQEMUDriver *driver,
|
||||
@@ -10565,9 +10565,6 @@ qemuBuildCommandLine(virQEMUDriver *driver,
|
||||
qemuBuildNumaCommandLine(cfg, def, cmd, priv) < 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -85,7 +86,7 @@ index d822533ccb..509bab08ef 100644
|
|||
virUUIDFormat(def->uuid, uuid);
|
||||
virCommandAddArgList(cmd, "-uuid", uuid, NULL);
|
||||
|
||||
@@ -10595,6 +10592,9 @@ qemuBuildCommandLine(virQEMUDriver *driver,
|
||||
@@ -10617,6 +10614,9 @@ qemuBuildCommandLine(virQEMUDriver *driver,
|
||||
if (qemuBuildControllersCommandLine(cmd, def, qemuCaps) < 0)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
From e52b12a986de8ac469b98135b2c1d2a8a63b9052 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e52b12a986de8ac469b98135b2c1d2a8a63b9052@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 17:10:15 +0100
|
||||
Subject: [PATCH] qemu_command: Generate prealloc-threads property
|
||||
|
||||
Let's generate prealloc-threads property onto the cmd line if
|
||||
domain configuration requests so.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit b8d6ecc70c8a8e9c90bab48b6829b42d8b77c748)
|
||||
|
||||
Conflicts:
|
||||
tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args:
|
||||
Upstream has moved some cmd line arguments
|
||||
(v8.0.0-260-gaf23241cfe) but that is not backported.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2067126
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_command.c | 5 ++++-
|
||||
tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args | 4 ++--
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 2acdcca2ff..d23af97e0c 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -3856,7 +3856,10 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
|
||||
return -1;
|
||||
} else {
|
||||
if (!priv->memPrealloc &&
|
||||
- virJSONValueObjectAdd(&props, "B:prealloc", prealloc, NULL) < 0)
|
||||
+ virJSONValueObjectAdd(&props,
|
||||
+ "B:prealloc", prealloc,
|
||||
+ "p:prealloc-threads", def->mem.allocation_threads,
|
||||
+ NULL) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
|
||||
index 04a320d469..9b2e6086c3 100644
|
||||
--- a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
|
||||
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
|
||||
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
|
||||
-m size=14680064k,slots=16,maxmem=1099511627776k \
|
||||
-overcommit mem-lock=off \
|
||||
-smp 8,sockets=1,dies=1,cores=8,threads=1 \
|
||||
--object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,"hugetlbsize":2097152,"share":true,"prealloc":true,"size":15032385536,"host-nodes":[3],"policy":"preferred"}' \
|
||||
+-object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,"hugetlbsize":2097152,"share":true,"prealloc":true,"prealloc-threads":8,"size":15032385536,"host-nodes":[3],"policy":"preferred"}' \
|
||||
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
|
||||
-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
|
||||
-display none \
|
||||
@@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
|
||||
-no-acpi \
|
||||
-boot strict=on \
|
||||
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
||||
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"size":536870912,"host-nodes":[3],"policy":"preferred"}' \
|
||||
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"prealloc-threads":8,"size":536870912,"host-nodes":[3],"policy":"preferred"}' \
|
||||
-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
|
||||
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
From b221b3ab6d881efedc544e0e0ed9c507e21fd178 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b221b3ab6d881efedc544e0e0ed9c507e21fd178@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Wed, 11 May 2022 16:37:27 +0200
|
||||
Subject: [PATCH] qemu_domain: Format qemuDomainObjPrivate::originalMemlock
|
||||
|
||||
Now that qemuDomainObjPrivate struct gained new member format it
|
||||
into XML and parse it so that the value is preserved across
|
||||
daemon restarts.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit 21aec91790ae14d24512856b20cff49764ede637)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_domain.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 86d673dafa..ee7d310903 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -2383,6 +2383,12 @@ qemuDomainObjPrivateXMLFormat(virBuffer *buf,
|
||||
if (qemuDomainObjPrivateXMLFormatBackups(buf, vm) < 0)
|
||||
return -1;
|
||||
|
||||
+ if (priv->originalMemlock > 0) {
|
||||
+ virBufferAsprintf(buf,
|
||||
+ "<originalMemlock>%llu</originalMemlock>\n",
|
||||
+ priv->originalMemlock);
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3104,6 +3110,13 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
|
||||
|
||||
priv->memPrealloc = virXPathBoolean("boolean(./memPrealloc)", ctxt) == 1;
|
||||
|
||||
+ if (virXPathULongLong("string(./originalMemlock)",
|
||||
+ ctxt, &priv->originalMemlock) == -2) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("failed to parse original memlock size"));
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
|
||||
error:
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
From 35f06623b82d99dd380340eef465394975dd1c80 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <35f06623b82d99dd380340eef465394975dd1c80@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 22 Jun 2022 16:37:31 +0200
|
||||
Subject: [PATCH] qemu_migration: Implement VIR_MIGRATE_ZEROCOPY flag
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/306
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit d375993ab314a41bca7ef6c846e07afc18c37774)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
|
||||
|
||||
Conflicts:
|
||||
src/qemu/qemu_migration.c
|
||||
src/qemu/qemu_migration.h
|
||||
- post-copy recovery not bacported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_migration.c | 21 +++++++++++++++++++++
|
||||
src/qemu/qemu_migration.h | 1 +
|
||||
src/qemu/qemu_migration_params.c | 6 ++++++
|
||||
src/qemu/qemu_migration_params.h | 1 +
|
||||
4 files changed, 29 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||||
index 35ad201580..db5163e993 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -2366,6 +2366,12 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ if (flags & VIR_MIGRATE_ZEROCOPY && !(flags & VIR_MIGRATE_PARALLEL)) {
|
||||
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("zero-copy is only available for parallel migration"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
if (flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC)) {
|
||||
if (flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES &&
|
||||
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
@@ -4137,6 +4143,21 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
|
||||
migParams) < 0)
|
||||
goto error;
|
||||
|
||||
+ if (flags & VIR_MIGRATE_ZEROCOPY) {
|
||||
+ /* Zero-copy requires pages in transfer to be locked in host memory.
|
||||
+ * Unfortunately, we have no reliable way of computing how many pages
|
||||
+ * will need to be locked at the same time. Thus we set the limit to
|
||||
+ * the whole guest memory and reset it back once migration is done. */
|
||||
+ unsigned long long limit;
|
||||
+
|
||||
+ if (virMemoryLimitIsSet(vm->def->mem.hard_limit))
|
||||
+ limit = vm->def->mem.hard_limit;
|
||||
+ else
|
||||
+ limit = virDomainDefGetMemoryTotal(vm->def);
|
||||
+
|
||||
+ if (qemuDomainSetMaxMemLock(vm, limit << 10, &priv->preMigrationMemlock) < 0)
|
||||
+ goto error;
|
||||
+ }
|
||||
|
||||
if (storageMigration) {
|
||||
if (mig->nbd) {
|
||||
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
|
||||
index b233358a51..6f737f7b4c 100644
|
||||
--- a/src/qemu/qemu_migration.h
|
||||
+++ b/src/qemu/qemu_migration.h
|
||||
@@ -60,6 +60,7 @@
|
||||
VIR_MIGRATE_TLS | \
|
||||
VIR_MIGRATE_PARALLEL | \
|
||||
VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES | \
|
||||
+ VIR_MIGRATE_ZEROCOPY | \
|
||||
0)
|
||||
|
||||
/* All supported migration parameters and their types. */
|
||||
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
|
||||
index 7b225fdf4b..c985583861 100644
|
||||
--- a/src/qemu/qemu_migration_params.c
|
||||
+++ b/src/qemu/qemu_migration_params.c
|
||||
@@ -96,6 +96,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability,
|
||||
"multifd",
|
||||
"dirty-bitmaps",
|
||||
"return-path",
|
||||
+ "zero-copy-send",
|
||||
);
|
||||
|
||||
|
||||
@@ -177,6 +178,11 @@ static const qemuMigrationParamsFlagMapItem qemuMigrationParamsFlagMap[] = {
|
||||
VIR_MIGRATE_TUNNELLED,
|
||||
QEMU_MIGRATION_CAP_RETURN_PATH,
|
||||
QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
|
||||
+
|
||||
+ {QEMU_MIGRATION_FLAG_REQUIRED,
|
||||
+ VIR_MIGRATE_ZEROCOPY,
|
||||
+ QEMU_MIGRATION_CAP_ZERO_COPY_SEND,
|
||||
+ QEMU_MIGRATION_SOURCE},
|
||||
};
|
||||
|
||||
/* Translation from VIR_MIGRATE_PARAM_* typed parameters to
|
||||
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
|
||||
index b4de8dda7b..caa5e47f0f 100644
|
||||
--- a/src/qemu/qemu_migration_params.h
|
||||
+++ b/src/qemu/qemu_migration_params.h
|
||||
@@ -41,6 +41,7 @@ typedef enum {
|
||||
QEMU_MIGRATION_CAP_MULTIFD,
|
||||
QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS,
|
||||
QEMU_MIGRATION_CAP_RETURN_PATH,
|
||||
+ QEMU_MIGRATION_CAP_ZERO_COPY_SEND,
|
||||
|
||||
QEMU_MIGRATION_CAP_LAST
|
||||
} qemuMigrationCapability;
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
From 8cccd9634ecd91a5b7343eddc037e0fa7de2f9f6 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <8cccd9634ecd91a5b7343eddc037e0fa7de2f9f6@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 22 Jun 2022 16:12:02 +0200
|
||||
Subject: [PATCH] qemu_migration: Restore original memory locking limit
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
For RDMA migration we update memory locking limit, but never set it back
|
||||
once migration finishes (on the destination host) or aborts (on the
|
||||
source host).
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit d4d3bb813031275c2c7cf72724b83c97ce82ab7a)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
|
||||
|
||||
Conflicts:
|
||||
src/qemu/qemu_migration.c
|
||||
- post-copy resovery not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_domain.c | 12 ++++++++++++
|
||||
src/qemu/qemu_domain.h | 3 +++
|
||||
src/qemu/qemu_migration.c | 10 ++++++++--
|
||||
3 files changed, 23 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index a81789f194..c24d1e4d53 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -2389,6 +2389,11 @@ qemuDomainObjPrivateXMLFormat(virBuffer *buf,
|
||||
priv->originalMemlock);
|
||||
}
|
||||
|
||||
+ if (priv->preMigrationMemlock > 0) {
|
||||
+ virBufferAsprintf(buf, "<preMigrationMemlock>%llu</preMigrationMemlock>\n",
|
||||
+ priv->preMigrationMemlock);
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3117,6 +3122,13 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
|
||||
goto error;
|
||||
}
|
||||
|
||||
+ if (virXPathULongLong("string(./preMigrationMemlock)", ctxt,
|
||||
+ &priv->preMigrationMemlock) == -2) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("failed to parse pre-migration memlock limit"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
|
||||
error:
|
||||
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
||||
index 6d1d23439a..d6e8a7a0fb 100644
|
||||
--- a/src/qemu/qemu_domain.h
|
||||
+++ b/src/qemu/qemu_domain.h
|
||||
@@ -146,6 +146,9 @@ struct _qemuDomainObjPrivate {
|
||||
int nbdPort; /* Port used for migration with NBD */
|
||||
unsigned short migrationPort;
|
||||
int preMigrationState;
|
||||
+ unsigned long long preMigrationMemlock; /* Original RLIMIT_MEMLOCK in case
|
||||
+ it was changed for the current
|
||||
+ migration job. */
|
||||
|
||||
virChrdevs *devs;
|
||||
|
||||
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||||
index 10338f8e87..35ad201580 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -2974,7 +2974,8 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
|
||||
|
||||
if (STREQ_NULLABLE(protocol, "rdma") &&
|
||||
vm->def->mem.hard_limit > 0 &&
|
||||
- qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, NULL) < 0) {
|
||||
+ qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
|
||||
+ &priv->preMigrationMemlock) < 0) {
|
||||
goto stopjob;
|
||||
}
|
||||
|
||||
@@ -3451,6 +3452,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver,
|
||||
VIR_DOMAIN_EVENT_STOPPED_MIGRATED);
|
||||
virObjectEventStateQueue(driver->domainEventState, event);
|
||||
qemuDomainEventEmitJobCompleted(driver, vm);
|
||||
+ priv->preMigrationMemlock = 0;
|
||||
} else {
|
||||
virErrorPtr orig_err;
|
||||
int reason;
|
||||
@@ -3471,6 +3473,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver,
|
||||
|
||||
qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
jobPriv->migParams, priv->job.apiFlags);
|
||||
+ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
|
||||
|
||||
qemuDomainSaveStatus(vm);
|
||||
}
|
||||
@@ -4224,7 +4227,8 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
|
||||
case MIGRATION_DEST_HOST:
|
||||
if (STREQ(spec->dest.host.protocol, "rdma") &&
|
||||
vm->def->mem.hard_limit > 0 &&
|
||||
- qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, NULL) < 0) {
|
||||
+ qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
|
||||
+ &priv->preMigrationMemlock) < 0) {
|
||||
goto exit_monitor;
|
||||
}
|
||||
rc = qemuMonitorMigrateToHost(priv->mon, migrate_flags,
|
||||
@@ -5408,6 +5412,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver,
|
||||
if (ret < 0) {
|
||||
qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
jobPriv->migParams, priv->job.apiFlags);
|
||||
+ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
|
||||
qemuMigrationJobFinish(driver, vm);
|
||||
} else {
|
||||
qemuMigrationJobContinue(vm);
|
||||
@@ -5881,6 +5886,7 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
|
||||
cleanup:
|
||||
g_clear_pointer(&jobInfo, qemuDomainJobInfoFree);
|
||||
virPortAllocatorRelease(port);
|
||||
+ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
|
||||
if (priv->mon)
|
||||
qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL);
|
||||
VIR_FREE(priv->origname);
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
From 8354fa1d2e471699331961272bc38f5e4cfe7cb8 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <8354fa1d2e471699331961272bc38f5e4cfe7cb8@dist-git>
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 22 Jun 2022 09:04:04 +0200
|
||||
Subject: [PATCH] qemu_migration: Use qemuDomainSetMaxMemLock
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This helper will not try to set the limit if it is already big enough,
|
||||
which may be useful when libvirt daemon is running in a containerized
|
||||
environment and is not allowed to change memory locking limit.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 22ee8cbf090c45f999b76e3f8dc7a45065fc9edf)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
|
||||
|
||||
Conflicts:
|
||||
src/qemu/qemu_migration.c
|
||||
- refactoring for post-copy recovery not backported
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_migration.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||||
index 2635ef1162..10338f8e87 100644
|
||||
--- a/src/qemu/qemu_migration.c
|
||||
+++ b/src/qemu/qemu_migration.c
|
||||
@@ -2974,7 +2974,7 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
|
||||
|
||||
if (STREQ_NULLABLE(protocol, "rdma") &&
|
||||
vm->def->mem.hard_limit > 0 &&
|
||||
- virProcessSetMaxMemLock(vm->pid, vm->def->mem.hard_limit << 10) < 0) {
|
||||
+ qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, NULL) < 0) {
|
||||
goto stopjob;
|
||||
}
|
||||
|
||||
@@ -4224,7 +4224,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
|
||||
case MIGRATION_DEST_HOST:
|
||||
if (STREQ(spec->dest.host.protocol, "rdma") &&
|
||||
vm->def->mem.hard_limit > 0 &&
|
||||
- virProcessSetMaxMemLock(vm->pid, vm->def->mem.hard_limit << 10) < 0) {
|
||||
+ qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, NULL) < 0) {
|
||||
goto exit_monitor;
|
||||
}
|
||||
rc = qemuMonitorMigrateToHost(priv->mon, migrate_flags,
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
From 77b0485ba92fe5f0520321385af8a7581c286df1 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <77b0485ba92fe5f0520321385af8a7581c286df1@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 31 Oct 2022 15:38:13 +0100
|
||||
Subject: [PATCH] qemu_namespace: Don't leak memory in
|
||||
qemuDomainGetPreservedMounts()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The aim of qemuDomainGetPreservedMounts() is to get a list of
|
||||
filesystems mounted under /dev and optionally generate a path for
|
||||
each one where they are moved temporarily when building the
|
||||
namespace. And the function tries to be a bit clever about it.
|
||||
For instance, if /dev/shm mount point exists, there's no need to
|
||||
consider /dev/shm/a nor /dev/shm/b as preserving just 'top level'
|
||||
/dev/shm gives the same result. To achieve this, the function
|
||||
iterates over the list of filesystem as returned by
|
||||
virFileGetMountSubtree() and removes the nested ones. However, it
|
||||
does so in a bit clumsy way: plain VIR_DELETE_ELEMENT() is used
|
||||
without freeing the string itself. Therefore, if all three
|
||||
aforementioned example paths appeared on the list, /dev/shm/a and
|
||||
/dev/shm/b strings would be leaked.
|
||||
|
||||
And when I think about it more, there's no real need to shrink
|
||||
the array down (realloc()). It's going to be free()-d when
|
||||
returning from the function. Switch to
|
||||
VIR_DELETE_ELEMENT_INPLACE() then.
|
||||
|
||||
Fixes: cdd9205dfffa3aaed935446a41f0d2dd1357c268
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit bca7a53333ead7c1afd178728de74c2977cd4b5e)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2166573
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_namespace.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
|
||||
index 74ffd6fb90..2f50087c1d 100644
|
||||
--- a/src/qemu/qemu_namespace.c
|
||||
+++ b/src/qemu/qemu_namespace.c
|
||||
@@ -160,7 +160,8 @@ qemuDomainGetPreservedMounts(virQEMUDriverConfig *cfg,
|
||||
|
||||
if (c && (*c == '/' || *c == '\0')) {
|
||||
VIR_DEBUG("Dropping path %s because of %s", mounts[j], mounts[i]);
|
||||
- VIR_DELETE_ELEMENT(mounts, j, nmounts);
|
||||
+ VIR_FREE(mounts[j]);
|
||||
+ VIR_DELETE_ELEMENT_INPLACE(mounts, j, nmounts);
|
||||
} else {
|
||||
j++;
|
||||
}
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
From 215adedb16aa082d052f84705338de0d77721fe0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <215adedb16aa082d052f84705338de0d77721fe0@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 6 Sep 2022 13:43:22 +0200
|
||||
Subject: [PATCH] qemu_namespace: Fix a corner case in
|
||||
qemuDomainGetPreservedMounts()
|
||||
|
||||
When setting up namespace for QEMU we look at mount points under
|
||||
/dev (like /dev/pts, /dev/mqueue/, etc.) because we want to
|
||||
preserve those (which is done by moving them to a temp location,
|
||||
unshare(), and then moving them back). We have a convenience
|
||||
helper - qemuDomainGetPreservedMounts() - that processes the
|
||||
mount table and (optionally) moves the other filesystems too.
|
||||
This helper is also used when attempting to create a path in NS,
|
||||
because the path, while starting with "/dev/" prefix, may
|
||||
actually lead to one of those filesystems that we preserved.
|
||||
|
||||
And here comes the corner case: while we require the parent mount
|
||||
table to be in shared mode (equivalent of `mount --make-rshared /'),
|
||||
these mount events propagate iff the target path exist inside the
|
||||
slave mount table (= QEMU's private namespace). And since we
|
||||
create only a subset of /dev nodes, well, that assumption is not
|
||||
always the case.
|
||||
|
||||
For instance, assume that a domain is already running, no
|
||||
hugepages were configured for it nor any hugetlbfs is mounted.
|
||||
Now, when a hugetlbfs is mounted into '/dev/hugepages', this is
|
||||
propagated into the QEMU's namespace, but since the target dir
|
||||
does not exist in the private /dev, the FS is not mounted in the
|
||||
namespace.
|
||||
|
||||
Fortunately, this difference between namespaces is visible when
|
||||
comparing /proc/mounts and /proc/$PID/mounts (where PID is the
|
||||
QEMU's PID). Therefore, if possible we should look at the latter.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 46b03819ae8d833b11c2aaccb2c2a0361727f51b)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_namespace.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
|
||||
index 4bff325a2c..fc286ab0be 100644
|
||||
--- a/src/qemu/qemu_namespace.c
|
||||
+++ b/src/qemu/qemu_namespace.c
|
||||
@@ -110,6 +110,8 @@ qemuDomainGetPreservedMountPath(virQEMUDriverConfig *cfg,
|
||||
* b) generate backup path for all the entries in a)
|
||||
*
|
||||
* Any of the return pointers can be NULL. Both arrays are NULL-terminated.
|
||||
+ * Get the mount table either from @vm's PID (if running), or from the
|
||||
+ * namespace we're in (if @vm's not running).
|
||||
*
|
||||
* Returns 0 on success, -1 otherwise (with error reported)
|
||||
*/
|
||||
@@ -124,12 +126,18 @@ qemuDomainGetPreservedMounts(virQEMUDriverConfig *cfg,
|
||||
size_t nmounts = 0;
|
||||
g_auto(GStrv) paths = NULL;
|
||||
g_auto(GStrv) savePaths = NULL;
|
||||
+ g_autofree char *mountsPath = NULL;
|
||||
size_t i;
|
||||
|
||||
if (ndevPath)
|
||||
*ndevPath = 0;
|
||||
|
||||
- if (virFileGetMountSubtree(QEMU_PROC_MOUNTS, "/dev", &mounts, &nmounts) < 0)
|
||||
+ if (vm->pid > 0)
|
||||
+ mountsPath = g_strdup_printf("/proc/%lld/mounts", (long long) vm->pid);
|
||||
+ else
|
||||
+ mountsPath = g_strdup(QEMU_PROC_MOUNTS);
|
||||
+
|
||||
+ if (virFileGetMountSubtree(mountsPath, "/dev", &mounts, &nmounts) < 0)
|
||||
return -1;
|
||||
|
||||
if (nmounts == 0)
|
||||
--
|
||||
2.38.0
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
From d515c964d740274d01bb8de1e5b0351490d6b9d3 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d515c964d740274d01bb8de1e5b0351490d6b9d3@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 6 Sep 2022 13:43:58 +0200
|
||||
Subject: [PATCH] qemu_namespace: Introduce qemuDomainNamespaceSetupPath()
|
||||
|
||||
Sometimes it may come handy to just bind mount a directory/file
|
||||
into domain's namespace. Implement a thin wrapper over
|
||||
qemuNamespaceMknodPaths() which has all the logic we need.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 5853d707189005a4ea5b2215e80853867b822fd9)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_namespace.c | 19 +++++++++++++++++++
|
||||
src/qemu/qemu_namespace.h | 4 ++++
|
||||
2 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
|
||||
index fc286ab0be..74ffd6fb90 100644
|
||||
--- a/src/qemu/qemu_namespace.c
|
||||
+++ b/src/qemu/qemu_namespace.c
|
||||
@@ -1398,6 +1398,25 @@ qemuNamespaceUnlinkPaths(virDomainObj *vm,
|
||||
}
|
||||
|
||||
|
||||
+int
|
||||
+qemuDomainNamespaceSetupPath(virDomainObj *vm,
|
||||
+ const char *path,
|
||||
+ bool *created)
|
||||
+{
|
||||
+ g_autoptr(virGSListString) paths = NULL;
|
||||
+
|
||||
+ if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
|
||||
+ return 0;
|
||||
+
|
||||
+ paths = g_slist_prepend(paths, g_strdup(path));
|
||||
+
|
||||
+ if (qemuNamespaceMknodPaths(vm, paths, created) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
int
|
||||
qemuDomainNamespaceSetupDisk(virDomainObj *vm,
|
||||
virStorageSource *src,
|
||||
diff --git a/src/qemu/qemu_namespace.h b/src/qemu/qemu_namespace.h
|
||||
index 020aca13d8..1ab9322061 100644
|
||||
--- a/src/qemu/qemu_namespace.h
|
||||
+++ b/src/qemu/qemu_namespace.h
|
||||
@@ -49,6 +49,10 @@ void qemuDomainDestroyNamespace(virQEMUDriver *driver,
|
||||
|
||||
bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);
|
||||
|
||||
+int qemuDomainNamespaceSetupPath(virDomainObj *vm,
|
||||
+ const char *path,
|
||||
+ bool *created);
|
||||
+
|
||||
int qemuDomainNamespaceSetupDisk(virDomainObj *vm,
|
||||
virStorageSource *src,
|
||||
bool *created);
|
||||
--
|
||||
2.38.0
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From 7c7ec6e6c20675a99abe8685c715dc95e7e8dbff Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <7c7ec6e6c20675a99abe8685c715dc95e7e8dbff@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 6 Sep 2022 13:37:23 +0200
|
||||
Subject: [PATCH] qemu_namespace: Tolerate missing ACLs when creating a path in
|
||||
namespace
|
||||
|
||||
When creating a path in a domain's mount namespace we try to set
|
||||
ACLs on it, so that it's a verbatim copy of the path in parent's
|
||||
namespace. The ACLs are queried upfront (by
|
||||
qemuNamespaceMknodItemInit()) but this is fault tolerant so the
|
||||
pointer to ACLs might be NULL (meaning no ACLs were queried, for
|
||||
instance because the underlying filesystem does not support
|
||||
them). But then we take this NULL and pass it to virFileSetACLs()
|
||||
which immediately returns an error because NULL is invalid value.
|
||||
|
||||
Mimic what we do with SELinux label - only set ACLs if they are
|
||||
non-NULL which includes symlinks.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 687374959e160dc566bd4b6d43c7bf1beb470c59)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_namespace.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
|
||||
index 94453033f5..4bff325a2c 100644
|
||||
--- a/src/qemu/qemu_namespace.c
|
||||
+++ b/src/qemu/qemu_namespace.c
|
||||
@@ -1023,8 +1023,7 @@ qemuNamespaceMknodOne(qemuNamespaceMknodItem *data)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- /* Symlinks don't have ACLs. */
|
||||
- if (!isLink &&
|
||||
+ if (data->acl &&
|
||||
virFileSetACLs(data->file, data->acl) < 0 &&
|
||||
errno != ENOTSUP) {
|
||||
virReportSystemError(errno,
|
||||
--
|
||||
2.38.0
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
From f745b9ae2d12df0c0f2253c295f3d411a8a4165d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f745b9ae2d12df0c0f2253c295f3d411a8a4165d@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 5 Sep 2022 10:34:44 +0200
|
||||
Subject: [PATCH] qemu_process: Don't require a hugetlbfs mount for memfd
|
||||
|
||||
The aim of qemuProcessNeedHugepagesPath() is to determine whether
|
||||
a hugetlbfs mount point is required for given domain (as in
|
||||
whether qemuBuildMemoryBackendProps() picks up
|
||||
memory-backend-file pointing to a hugetlbfs mount point). Well,
|
||||
when domain is configured to use memfd backend then that
|
||||
condition can never be true. Therefore, skip creating domain's
|
||||
private path under hugetlbfs mount points.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit f14f8dff9330ed51d817f190a2ee9ac76dfac00b)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_process.c | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 5c6657a876..540eee9ff0 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -3810,8 +3810,18 @@ qemuProcessNeedHugepagesPath(virDomainDef *def,
|
||||
const long system_pagesize = virGetSystemPageSizeKB();
|
||||
size_t i;
|
||||
|
||||
- if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE)
|
||||
+ switch ((virDomainMemorySource)def->mem.source) {
|
||||
+ case VIR_DOMAIN_MEMORY_SOURCE_FILE:
|
||||
+ /* This needs a hugetlbfs mount. */
|
||||
return true;
|
||||
+ case VIR_DOMAIN_MEMORY_SOURCE_MEMFD:
|
||||
+ /* memfd works without a hugetlbfs mount */
|
||||
+ return false;
|
||||
+ case VIR_DOMAIN_MEMORY_SOURCE_NONE:
|
||||
+ case VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS:
|
||||
+ case VIR_DOMAIN_MEMORY_SOURCE_LAST:
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
for (i = 0; i < def->mem.nhugepages; i++) {
|
||||
if (def->mem.hugepages[i].size != system_pagesize)
|
||||
--
|
||||
2.38.0
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
From 2aeb222d9d61868ef40932b4349af84696415e11 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <2aeb222d9d61868ef40932b4349af84696415e11@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 6 Sep 2022 13:45:51 +0200
|
||||
Subject: [PATCH] qemu_process.c: Propagate hugetlbfs mounts on reconnect
|
||||
|
||||
When reconnecting to a running QEMU process, we construct the
|
||||
per-domain path in all hugetlbfs mounts. This is a relict from
|
||||
the past (v3.4.0-100-g5b24d25062) where we switched to a
|
||||
per-domain path and we want to create those paths when libvirtd
|
||||
restarts on upgrade.
|
||||
|
||||
And with namespaces enabled there is one corner case where the
|
||||
path is not created. In fact an error is reported and the
|
||||
reconnect fails. Ideally, all mount events are propagated into
|
||||
the QEMU's namespace. And they probably are, except when the
|
||||
target path does not exist inside the namespace. Now, it's pretty
|
||||
common for users to mount hugetlbfs under /dev (e.g.
|
||||
/dev/hugepages), but if domain is started without hugepages (or
|
||||
more specifically - private hugetlbfs path wasn't created on
|
||||
domain startup), then the reconnect code tries to create it.
|
||||
But it fails to do so, well, it fails to set seclabels on the
|
||||
path because, because the path does not exist in the private
|
||||
namespace. And it doesn't exist because we specifically create
|
||||
only a subset of all possible /dev nodes. Therefore, the mount
|
||||
event, whilst propagated, is not successful and hence the
|
||||
filesystem is not mounted. We have to do it ourselves.
|
||||
|
||||
If hugetlbfs is mount anywhere else there's no problem and this
|
||||
is effectively a dead code.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 0377177c7856bb87a9d8aa1324b54f5fbe9f1e5b)
|
||||
|
||||
Conflicts:
|
||||
- docs/kbase/qemu-passthrough-security.rst: Well, v8.8.0-rc1~32
|
||||
isn't backported, thus we can't remove a paragraph that the
|
||||
backported commit did. It's a documentation after all, so no
|
||||
harm.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_process.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 540eee9ff0..1164340aa9 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -3906,6 +3906,9 @@ qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriver *driver,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (qemuDomainNamespaceSetupPath(vm, path, NULL) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
if (qemuSecurityDomainSetPathLabel(driver, vm, path, true) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
--
|
||||
2.38.0
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
From 87b0f241db1eba0e9db1fd233c5ab8a8d0115979 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <87b0f241db1eba0e9db1fd233c5ab8a8d0115979@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 13:33:06 +0100
|
||||
Subject: [PATCH] qemu_tpm: Do async IO when starting swtpm emulator
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When vTPM is secured via virSecret libvirt passes the secret
|
||||
value via an FD when swtpm is started (arguments --key and
|
||||
--migration-key). The writing of the secret into the FDs is
|
||||
handled via virCommand, specifically qemu_tpm calls
|
||||
virCommandSetSendBuffer()) and then virCommandRunAsync() spawns a
|
||||
thread to handle writing into the FD via
|
||||
virCommandDoAsyncIOHelper. But the thread is not created unless
|
||||
VIR_EXEC_ASYNC_IO flag is set, which it isn't. In order to fix
|
||||
it, virCommandDoAsyncIO() must be called.
|
||||
|
||||
The credit goes to Marc-André Lureau
|
||||
<marcandre.lureau@redhat.com> who has done all the debugging and
|
||||
proposed fix in the bugzilla.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2064115
|
||||
Fixes: a9c500d2b50c5c041a1bb6ae9724402cf1cec8fe
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 4d7bb0177a33c4e90fd001edfe27bc030354d875)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2152188
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_tpm.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
|
||||
index 9c5d1ffed4..29dcb2ac0f 100644
|
||||
--- a/src/qemu/qemu_tpm.c
|
||||
+++ b/src/qemu/qemu_tpm.c
|
||||
@@ -923,6 +923,7 @@ qemuExtTPMStartEmulator(virQEMUDriver *driver,
|
||||
if (!(pidfile = qemuTPMEmulatorCreatePidFilename(cfg->swtpmStateDir, shortName)))
|
||||
return -1;
|
||||
|
||||
+ virCommandDoAsyncIO(cmd);
|
||||
virCommandDaemonize(cmd);
|
||||
virCommandSetPidFile(cmd, pidfile);
|
||||
virCommandSetErrorFD(cmd, &errfd);
|
||||
--
|
||||
2.39.0
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From 088ba382d7a099ddbebe37e5486ce648e24266db Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <088ba382d7a099ddbebe37e5486ce648e24266db@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Mon, 21 Mar 2022 17:09:40 +0100
|
||||
Subject: [PATCH] qemu_validate: Validate prealloc threads against qemuCpas
|
||||
|
||||
Only fairly new QEMUs are capable of user provided number of
|
||||
preallocation threads. Validate this assumption.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 75a4e0165ef199809974e97b507d3953e1de01d1)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2067126
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_validate.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
||||
index 3a69733f81..7bc14293d6 100644
|
||||
--- a/src/qemu/qemu_validate.c
|
||||
+++ b/src/qemu/qemu_validate.c
|
||||
@@ -739,6 +739,13 @@ qemuValidateDomainDefMemory(const virDomainDef *def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (mem->allocation_threads > 0 &&
|
||||
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS)) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("preallocation threads are unsupported with this QEMU"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("hugepages are not allowed with anonymous "
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,218 @@
|
|||
From cb42cd98d347deeee7c225d8d1e9f71f232cad29 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <cb42cd98d347deeee7c225d8d1e9f71f232cad29.1712647819.git.jdenemar@redhat.com>
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Fri, 15 Mar 2024 10:47:50 +0000
|
||||
Subject: [PATCH] remote: check for negative array lengths before allocation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
While the C API entry points will validate non-negative lengths
|
||||
for various parameters, the RPC server de-serialization code
|
||||
will need to allocate memory for arrays before entering the C
|
||||
API. These allocations will thus happen before the non-negative
|
||||
length check is performed.
|
||||
|
||||
Passing a negative length to the g_new0 function will usually
|
||||
result in a crash due to the negative length being treated as
|
||||
a huge positive number.
|
||||
|
||||
This was found and diagnosed by ALT Linux Team with AFLplusplus.
|
||||
|
||||
CVE-2024-2494
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Found-by: Alexandr Shashkin <dutyrok@altlinux.org>
|
||||
Co-developed-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 8a3f8d957507c1f8223fdcf25a3ff885b15557f2)
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
---
|
||||
src/remote/remote_daemon_dispatch.c | 65 +++++++++++++++++++++++++++++
|
||||
src/rpc/gendispatch.pl | 5 +++
|
||||
2 files changed, 70 insertions(+)
|
||||
|
||||
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
|
||||
index 689001889e..c193227926 100644
|
||||
--- a/src/remote/remote_daemon_dispatch.c
|
||||
+++ b/src/remote/remote_daemon_dispatch.c
|
||||
@@ -2306,6 +2306,10 @@ remoteDispatchDomainGetSchedulerParameters(virNetServer *server G_GNUC_UNUSED,
|
||||
if (!conn)
|
||||
goto cleanup;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -2354,6 +2358,10 @@ remoteDispatchDomainGetSchedulerParametersFlags(virNetServer *server G_GNUC_UNUS
|
||||
if (!conn)
|
||||
goto cleanup;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -2512,6 +2520,10 @@ remoteDispatchDomainBlockStatsFlags(virNetServer *server G_GNUC_UNUSED,
|
||||
goto cleanup;
|
||||
flags = args->flags;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -2737,6 +2749,14 @@ remoteDispatchDomainGetVcpuPinInfo(virNetServer *server G_GNUC_UNUSED,
|
||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
+ if (args->ncpumaps < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpumaps must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (args->maplen < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maplen must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->ncpumaps > REMOTE_VCPUINFO_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpumaps > REMOTE_VCPUINFO_MAX"));
|
||||
goto cleanup;
|
||||
@@ -2831,6 +2851,11 @@ remoteDispatchDomainGetEmulatorPinInfo(virNetServer *server G_GNUC_UNUSED,
|
||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
+ if (args->maplen < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maplen must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
/* Allocate buffers to take the results */
|
||||
if (args->maplen > 0)
|
||||
cpumaps = g_new0(unsigned char, args->maplen);
|
||||
@@ -2878,6 +2903,14 @@ remoteDispatchDomainGetVcpus(virNetServer *server G_GNUC_UNUSED,
|
||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||
goto cleanup;
|
||||
|
||||
+ if (args->maxinfo < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (args->maplen < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->maxinfo > REMOTE_VCPUINFO_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX"));
|
||||
goto cleanup;
|
||||
@@ -3117,6 +3150,10 @@ remoteDispatchDomainGetMemoryParameters(virNetServer *server G_GNUC_UNUSED,
|
||||
|
||||
flags = args->flags;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -3177,6 +3214,10 @@ remoteDispatchDomainGetNumaParameters(virNetServer *server G_GNUC_UNUSED,
|
||||
|
||||
flags = args->flags;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_DOMAIN_NUMA_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -3237,6 +3278,10 @@ remoteDispatchDomainGetBlkioParameters(virNetServer *server G_GNUC_UNUSED,
|
||||
|
||||
flags = args->flags;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -3298,6 +3343,10 @@ remoteDispatchNodeGetCPUStats(virNetServer *server G_GNUC_UNUSED,
|
||||
|
||||
flags = args->flags;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_NODE_CPU_STATS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -3365,6 +3414,10 @@ remoteDispatchNodeGetMemoryStats(virNetServer *server G_GNUC_UNUSED,
|
||||
|
||||
flags = args->flags;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_NODE_MEMORY_STATS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -3545,6 +3598,10 @@ remoteDispatchDomainGetBlockIoTune(virNetServer *server G_GNUC_UNUSED,
|
||||
if (!conn)
|
||||
goto cleanup;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -5087,6 +5144,10 @@ remoteDispatchDomainGetInterfaceParameters(virNetServer *server G_GNUC_UNUSED,
|
||||
|
||||
flags = args->flags;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_DOMAIN_INTERFACE_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
@@ -5307,6 +5368,10 @@ remoteDispatchNodeGetMemoryParameters(virNetServer *server G_GNUC_UNUSED,
|
||||
|
||||
flags = args->flags;
|
||||
|
||||
+ if (args->nparams < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
if (args->nparams > REMOTE_NODE_MEMORY_PARAMETERS_MAX) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||
goto cleanup;
|
||||
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
|
||||
index 9f5bf0e316..aacab88808 100755
|
||||
--- a/src/rpc/gendispatch.pl
|
||||
+++ b/src/rpc/gendispatch.pl
|
||||
@@ -1074,6 +1074,11 @@ elsif ($mode eq "server") {
|
||||
print "\n";
|
||||
|
||||
if ($single_ret_as_list) {
|
||||
+ print " if (args->$single_ret_list_max_var < 0) {\n";
|
||||
+ print " virReportError(VIR_ERR_RPC,\n";
|
||||
+ print " \"%s\", _(\"max$single_ret_list_name must be non-negative\"));\n";
|
||||
+ print " goto cleanup;\n";
|
||||
+ print " }\n";
|
||||
print " if (args->$single_ret_list_max_var > $single_ret_list_max_define) {\n";
|
||||
print " virReportError(VIR_ERR_RPC,\n";
|
||||
print " \"%s\", _(\"max$single_ret_list_name > $single_ret_list_max_define\"));\n";
|
||||
--
|
||||
2.44.0
|
|
@ -1,846 +0,0 @@
|
|||
From fabb2642be1ef180b221af36e5810f819622fc58 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <fabb2642be1ef180b221af36e5810f819622fc58@dist-git>
|
||||
From: Olaf Hering <olaf@aepfle.de>
|
||||
Date: Wed, 12 Jan 2022 11:45:08 +0100
|
||||
Subject: [PATCH] remove sysconfig files
|
||||
|
||||
sysconfig files are owned by the admin of the host. They have the
|
||||
liberty to put anything they want into these files. This makes it
|
||||
difficult to provide different built-in defaults.
|
||||
|
||||
Remove the sysconfig file and place the current desired default into
|
||||
the service file.
|
||||
|
||||
Local customizations can now go either into /etc/sysconfig/name
|
||||
or /etc/systemd/system/name.service.d/my-knobs.conf
|
||||
|
||||
Attempt to handle upgrades in libvirt.spec.
|
||||
Dirty files which are marked as %config will be renamed to file.rpmsave.
|
||||
To restore them automatically, move stale .rpmsave files away, and
|
||||
catch any new rpmsave files in %posttrans.
|
||||
|
||||
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
(cherry picked from commit 8eb4461645c5738674232ee26c15f5555230b7ff)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2042529
|
||||
---
|
||||
docs/daemons.rst | 21 ++++++++
|
||||
docs/remote.html.in | 6 +--
|
||||
libvirt.spec.in | 69 +++++++++++++++++++------
|
||||
src/ch/meson.build | 5 --
|
||||
src/ch/virtchd.service.in | 1 +
|
||||
src/ch/virtchd.sysconf | 3 --
|
||||
src/interface/meson.build | 5 --
|
||||
src/interface/virtinterfaced.service.in | 1 +
|
||||
src/interface/virtinterfaced.sysconf | 3 --
|
||||
src/libxl/meson.build | 5 --
|
||||
src/libxl/virtxend.service.in | 1 +
|
||||
src/libxl/virtxend.sysconf | 3 --
|
||||
src/locking/meson.build | 5 --
|
||||
src/locking/virtlockd.service.in | 1 +
|
||||
src/locking/virtlockd.sysconf | 3 --
|
||||
src/logging/meson.build | 5 --
|
||||
src/logging/virtlogd.sysconf | 3 --
|
||||
src/lxc/meson.build | 5 --
|
||||
src/lxc/virtlxcd.service.in | 1 +
|
||||
src/lxc/virtlxcd.sysconf | 3 --
|
||||
src/meson.build | 16 ------
|
||||
src/network/meson.build | 5 --
|
||||
src/network/virtnetworkd.service.in | 1 +
|
||||
src/network/virtnetworkd.sysconf | 3 --
|
||||
src/node_device/meson.build | 5 --
|
||||
src/node_device/virtnodedevd.service.in | 1 +
|
||||
src/node_device/virtnodedevd.sysconf | 3 --
|
||||
src/nwfilter/meson.build | 5 --
|
||||
src/nwfilter/virtnwfilterd.service.in | 1 +
|
||||
src/nwfilter/virtnwfilterd.sysconf | 3 --
|
||||
src/qemu/meson.build | 5 --
|
||||
src/qemu/virtqemud.service.in | 1 +
|
||||
src/qemu/virtqemud.sysconf | 12 -----
|
||||
src/remote/libvirtd.service.in | 1 +
|
||||
src/remote/libvirtd.sysconf | 21 --------
|
||||
src/remote/meson.build | 10 ----
|
||||
src/remote/virtproxyd.service.in | 1 +
|
||||
src/remote/virtproxyd.sysconf | 3 --
|
||||
src/secret/meson.build | 5 --
|
||||
src/secret/virtsecretd.service.in | 1 +
|
||||
src/secret/virtsecretd.sysconf | 3 --
|
||||
src/storage/meson.build | 5 --
|
||||
src/storage/virtstoraged.service.in | 1 +
|
||||
src/storage/virtstoraged.sysconf | 3 --
|
||||
src/vbox/meson.build | 5 --
|
||||
src/vbox/virtvboxd.service.in | 1 +
|
||||
src/vbox/virtvboxd.sysconf | 3 --
|
||||
src/vz/meson.build | 5 --
|
||||
src/vz/virtvzd.service.in | 1 +
|
||||
src/vz/virtvzd.sysconf | 3 --
|
||||
tools/libvirt-guests.sysconf | 50 ------------------
|
||||
tools/meson.build | 6 ---
|
||||
52 files changed, 93 insertions(+), 245 deletions(-)
|
||||
delete mode 100644 src/ch/virtchd.sysconf
|
||||
delete mode 100644 src/interface/virtinterfaced.sysconf
|
||||
delete mode 100644 src/libxl/virtxend.sysconf
|
||||
delete mode 100644 src/locking/virtlockd.sysconf
|
||||
delete mode 100644 src/logging/virtlogd.sysconf
|
||||
delete mode 100644 src/lxc/virtlxcd.sysconf
|
||||
delete mode 100644 src/network/virtnetworkd.sysconf
|
||||
delete mode 100644 src/node_device/virtnodedevd.sysconf
|
||||
delete mode 100644 src/nwfilter/virtnwfilterd.sysconf
|
||||
delete mode 100644 src/qemu/virtqemud.sysconf
|
||||
delete mode 100644 src/remote/libvirtd.sysconf
|
||||
delete mode 100644 src/remote/virtproxyd.sysconf
|
||||
delete mode 100644 src/secret/virtsecretd.sysconf
|
||||
delete mode 100644 src/storage/virtstoraged.sysconf
|
||||
delete mode 100644 src/vbox/virtvboxd.sysconf
|
||||
delete mode 100644 src/vz/virtvzd.sysconf
|
||||
delete mode 100644 tools/libvirt-guests.sysconf
|
||||
|
||||
diff --git a/docs/daemons.rst b/docs/daemons.rst
|
||||
index c8ae3b0cef..1f9bc34260 100644
|
||||
--- a/docs/daemons.rst
|
||||
+++ b/docs/daemons.rst
|
||||
@@ -686,3 +686,24 @@ socket unit names into the service. When using these old versions, the
|
||||
``unix_sock_dir`` setting in ``virtlockd.conf`` must be changed in
|
||||
lock-step with the equivalent setting in the unit files to ensure that
|
||||
``virtlockd`` can identify the sockets.
|
||||
+
|
||||
+Changing command line options for daemons
|
||||
+=========================================
|
||||
+
|
||||
+Two ways exist to override the defaults in the provided service files:
|
||||
+either a systemd "drop-in" configuration file, or a ``/etc/sysconfig/$daemon``
|
||||
+file must be created. For example, to change the command line option
|
||||
+for a debug session of ``libvirtd``, create a file
|
||||
+``/etc/systemd/system/libvirtd.service.d/debug.conf`` with the following content:
|
||||
+
|
||||
+ ::
|
||||
+
|
||||
+ [Unit]
|
||||
+ Description=Virtualization daemon, with override from debug.conf
|
||||
+
|
||||
+ [Service]
|
||||
+ Environment=G_DEBUG=fatal-warnings
|
||||
+ Environment=LIBVIRTD_ARGS="--listen --verbose"
|
||||
+
|
||||
+After changes to systemd "drop-in" configuration files it is required to run
|
||||
+``systemctl daemon-reload``.
|
||||
diff --git a/docs/remote.html.in b/docs/remote.html.in
|
||||
index efdb2b3253..47fb2d4df3 100644
|
||||
--- a/docs/remote.html.in
|
||||
+++ b/docs/remote.html.in
|
||||
@@ -138,9 +138,9 @@ Blank lines and comments beginning with <code>#</code> are ignored.
|
||||
<td> 1 (on) </td>
|
||||
<td>
|
||||
Listen for secure TLS connections on the public TCP/IP port.
|
||||
- Note: it is also necessary to start the server in listening mode by
|
||||
- running it with --listen or editing /etc/sysconfig/libvirtd by uncommenting the LIBVIRTD_ARGS="--listen" line
|
||||
- to cause the server to come up in listening mode whenever it is started.
|
||||
+ Note: it is also necessary to start the server in listening mode
|
||||
+ by running it with --listen or adding a LIBVIRTD_ARGS="--listen"
|
||||
+ line to /etc/sysconfig/libvirtd.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
diff --git a/src/ch/meson.build b/src/ch/meson.build
|
||||
index e0afdb390a..a4bf0c6649 100644
|
||||
--- a/src/ch/meson.build
|
||||
+++ b/src/ch/meson.build
|
||||
@@ -63,11 +63,6 @@ if conf.has('WITH_CH')
|
||||
'sockets': [ 'main', 'ro', 'admin' ],
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtchd',
|
||||
- 'file': files('virtchd.sysconf'),
|
||||
- }
|
||||
-
|
||||
virt_install_dirs += [
|
||||
localstatedir / 'lib' / 'libvirt' / 'ch',
|
||||
runstatedir / 'libvirt' / 'ch',
|
||||
diff --git a/src/ch/virtchd.service.in b/src/ch/virtchd.service.in
|
||||
index cc1e85d1df..f08339f211 100644
|
||||
--- a/src/ch/virtchd.service.in
|
||||
+++ b/src/ch/virtchd.service.in
|
||||
@@ -18,6 +18,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTCHD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtchd
|
||||
ExecStart=@sbindir@/virtchd $VIRTCHD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/ch/virtchd.sysconf b/src/ch/virtchd.sysconf
|
||||
deleted file mode 100644
|
||||
index 5ee44be5cf..0000000000
|
||||
--- a/src/ch/virtchd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtchd.service systemd unit
|
||||
-
|
||||
-VIRTCHD_ARGS="--timeout 120"
|
||||
diff --git a/src/interface/meson.build b/src/interface/meson.build
|
||||
index 2d4e30362c..f9f378aeb0 100644
|
||||
--- a/src/interface/meson.build
|
||||
+++ b/src/interface/meson.build
|
||||
@@ -54,9 +54,4 @@ if conf.has('WITH_INTERFACE')
|
||||
'name': 'virtinterfaced',
|
||||
'in_file': files('virtinterfaced.init.in')
|
||||
}
|
||||
-
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtinterfaced',
|
||||
- 'file': files('virtinterfaced.sysconf'),
|
||||
- }
|
||||
endif
|
||||
diff --git a/src/interface/virtinterfaced.service.in b/src/interface/virtinterfaced.service.in
|
||||
index 73d409b81b..3d944e17a9 100644
|
||||
--- a/src/interface/virtinterfaced.service.in
|
||||
+++ b/src/interface/virtinterfaced.service.in
|
||||
@@ -13,6 +13,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTINTERFACED_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtinterfaced
|
||||
ExecStart=@sbindir@/virtinterfaced $VIRTINTERFACED_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/interface/virtinterfaced.sysconf b/src/interface/virtinterfaced.sysconf
|
||||
deleted file mode 100644
|
||||
index 0685da31b8..0000000000
|
||||
--- a/src/interface/virtinterfaced.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtinterfaced.service systemd unit
|
||||
-
|
||||
-VIRTINTERFACED_ARGS="--timeout 120"
|
||||
diff --git a/src/libxl/meson.build b/src/libxl/meson.build
|
||||
index 9793899106..8347a3c966 100644
|
||||
--- a/src/libxl/meson.build
|
||||
+++ b/src/libxl/meson.build
|
||||
@@ -78,11 +78,6 @@ if conf.has('WITH_LIBXL')
|
||||
'in_file': files('virtxend.init.in'),
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtxend',
|
||||
- 'file': files('virtxend.sysconf'),
|
||||
- }
|
||||
-
|
||||
virt_install_dirs += [
|
||||
localstatedir / 'lib' / 'libvirt' / 'libxl',
|
||||
runstatedir / 'libvirt' / 'libxl',
|
||||
diff --git a/src/libxl/virtxend.service.in b/src/libxl/virtxend.service.in
|
||||
index 19b19ce3e6..2b5163e179 100644
|
||||
--- a/src/libxl/virtxend.service.in
|
||||
+++ b/src/libxl/virtxend.service.in
|
||||
@@ -18,6 +18,7 @@ ConditionPathExists=/proc/xen/capabilities
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTXEND_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtxend
|
||||
ExecStart=@sbindir@/virtxend $VIRTXEND_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/libxl/virtxend.sysconf b/src/libxl/virtxend.sysconf
|
||||
deleted file mode 100644
|
||||
index 301da47e8d..0000000000
|
||||
--- a/src/libxl/virtxend.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtxend.service systemd unit
|
||||
-
|
||||
-VIRTXEND_ARGS="--timeout 120"
|
||||
diff --git a/src/locking/meson.build b/src/locking/meson.build
|
||||
index 184d3c3f56..72f7780438 100644
|
||||
--- a/src/locking/meson.build
|
||||
+++ b/src/locking/meson.build
|
||||
@@ -156,11 +156,6 @@ if conf.has('WITH_LIBVIRTD')
|
||||
'in_file': files('virtlockd.init.in'),
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtlockd',
|
||||
- 'file': files('virtlockd.sysconf'),
|
||||
- }
|
||||
-
|
||||
if conf.has('WITH_SANLOCK')
|
||||
virt_helpers += {
|
||||
'name': 'libvirt_sanlock_helper',
|
||||
diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
|
||||
index 4a6fab05ab..19271d1e7d 100644
|
||||
--- a/src/locking/virtlockd.service.in
|
||||
+++ b/src/locking/virtlockd.service.in
|
||||
@@ -7,6 +7,7 @@ Documentation=man:virtlockd(8)
|
||||
Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
+Environment=VIRTLOCKD_ARGS=
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtlockd
|
||||
ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
|
||||
ExecReload=/bin/kill -USR1 $MAINPID
|
||||
diff --git a/src/locking/virtlockd.sysconf b/src/locking/virtlockd.sysconf
|
||||
deleted file mode 100644
|
||||
index 03aea9e1bc..0000000000
|
||||
--- a/src/locking/virtlockd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtlockd.service systemd unit
|
||||
-
|
||||
-VIRTLOCKD_ARGS=""
|
||||
diff --git a/src/logging/meson.build b/src/logging/meson.build
|
||||
index 89e06a0d5a..7066f16fad 100644
|
||||
--- a/src/logging/meson.build
|
||||
+++ b/src/logging/meson.build
|
||||
@@ -101,11 +101,6 @@ if conf.has('WITH_LIBVIRTD')
|
||||
'name': 'virtlogd',
|
||||
'in_file': files('virtlogd.init.in'),
|
||||
}
|
||||
-
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtlogd',
|
||||
- 'file': files('virtlogd.sysconf'),
|
||||
- }
|
||||
endif
|
||||
|
||||
log_inc_dir = include_directories('.')
|
||||
diff --git a/src/logging/virtlogd.sysconf b/src/logging/virtlogd.sysconf
|
||||
deleted file mode 100644
|
||||
index 67993e83ce..0000000000
|
||||
--- a/src/logging/virtlogd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtlogd.service systemd unit
|
||||
-
|
||||
-VIRTLOGD_ARGS=""
|
||||
diff --git a/src/lxc/meson.build b/src/lxc/meson.build
|
||||
index ad5c659dba..c1f71b43e1 100644
|
||||
--- a/src/lxc/meson.build
|
||||
+++ b/src/lxc/meson.build
|
||||
@@ -175,11 +175,6 @@ if conf.has('WITH_LXC')
|
||||
'in_file': files('virtlxcd.init.in'),
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtlxcd',
|
||||
- 'file': files('virtlxcd.sysconf'),
|
||||
- }
|
||||
-
|
||||
virt_install_dirs += [
|
||||
localstatedir / 'lib' / 'libvirt' / 'lxc',
|
||||
runstatedir / 'libvirt' / 'lxc',
|
||||
diff --git a/src/lxc/virtlxcd.service.in b/src/lxc/virtlxcd.service.in
|
||||
index 3af7c1a52d..d58bde9f5d 100644
|
||||
--- a/src/lxc/virtlxcd.service.in
|
||||
+++ b/src/lxc/virtlxcd.service.in
|
||||
@@ -18,6 +18,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTLXCD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtlxcd
|
||||
ExecStart=@sbindir@/virtlxcd $VIRTLXCD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/lxc/virtlxcd.sysconf b/src/lxc/virtlxcd.sysconf
|
||||
deleted file mode 100644
|
||||
index 119a4a23f3..0000000000
|
||||
--- a/src/lxc/virtlxcd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtlxcd.service systemd unit
|
||||
-
|
||||
-VIRTLXCD_ARGS="--timeout 120"
|
||||
diff --git a/src/meson.build b/src/meson.build
|
||||
index 2408344ef7..fc6c77f5d1 100644
|
||||
--- a/src/meson.build
|
||||
+++ b/src/meson.build
|
||||
@@ -208,12 +208,6 @@ virt_daemon_units = []
|
||||
# * in_file - source init file (required)
|
||||
openrc_init_files = []
|
||||
|
||||
-# sysconf_files
|
||||
-# install libvirt daemon sysconf files
|
||||
-# * name - daemon name (required)
|
||||
-# * file - source sysconf file (required)
|
||||
-sysconf_files = []
|
||||
-
|
||||
# virt_install_dirs:
|
||||
# list of directories to create during installation
|
||||
virt_install_dirs = []
|
||||
@@ -868,16 +862,6 @@ if conf.has('WITH_LIBVIRTD')
|
||||
endif
|
||||
endif
|
||||
|
||||
-if init_script != 'none'
|
||||
- foreach sysconf : sysconf_files
|
||||
- install_data(
|
||||
- sysconf['file'],
|
||||
- install_dir: sysconfdir / 'sysconfig',
|
||||
- rename: [ sysconf['name'] ],
|
||||
- )
|
||||
- endforeach
|
||||
-endif
|
||||
-
|
||||
if conf.has('WITH_DTRACE_PROBES')
|
||||
custom_target(
|
||||
'libvirt_functions.stp',
|
||||
diff --git a/src/network/meson.build b/src/network/meson.build
|
||||
index d6fb624bb7..e7c43bc4c4 100644
|
||||
--- a/src/network/meson.build
|
||||
+++ b/src/network/meson.build
|
||||
@@ -72,11 +72,6 @@ if conf.has('WITH_NETWORK')
|
||||
'in_file': files('virtnetworkd.init.in'),
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtnetworkd',
|
||||
- 'file': files('virtnetworkd.sysconf'),
|
||||
- }
|
||||
-
|
||||
virt_install_dirs += [
|
||||
localstatedir / 'lib' / 'libvirt' / 'network',
|
||||
localstatedir / 'lib' / 'libvirt' / 'dnsmasq',
|
||||
diff --git a/src/network/virtnetworkd.service.in b/src/network/virtnetworkd.service.in
|
||||
index 4c39d2a5d7..3decfbbf1d 100644
|
||||
--- a/src/network/virtnetworkd.service.in
|
||||
+++ b/src/network/virtnetworkd.service.in
|
||||
@@ -16,6 +16,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTNETWORKD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtnetworkd
|
||||
ExecStart=@sbindir@/virtnetworkd $VIRTNETWORKD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/network/virtnetworkd.sysconf b/src/network/virtnetworkd.sysconf
|
||||
deleted file mode 100644
|
||||
index 93f3a7a327..0000000000
|
||||
--- a/src/network/virtnetworkd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtnetworkd.service systemd unit
|
||||
-
|
||||
-VIRTNETWORKD_ARGS="--timeout 120"
|
||||
diff --git a/src/node_device/meson.build b/src/node_device/meson.build
|
||||
index 15f9c3ad29..5013d825b3 100644
|
||||
--- a/src/node_device/meson.build
|
||||
+++ b/src/node_device/meson.build
|
||||
@@ -62,9 +62,4 @@ if conf.has('WITH_NODE_DEVICES')
|
||||
'name': 'virtnodedevd',
|
||||
'in_file': files('virtnodedevd.init.in'),
|
||||
}
|
||||
-
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtnodedevd',
|
||||
- 'file': files('virtnodedevd.sysconf'),
|
||||
- }
|
||||
endif
|
||||
diff --git a/src/node_device/virtnodedevd.service.in b/src/node_device/virtnodedevd.service.in
|
||||
index d2453dd620..688cf89822 100644
|
||||
--- a/src/node_device/virtnodedevd.service.in
|
||||
+++ b/src/node_device/virtnodedevd.service.in
|
||||
@@ -13,6 +13,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTNODEDEVD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtnodedevd
|
||||
ExecStart=@sbindir@/virtnodedevd $VIRTNODEDEVD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/node_device/virtnodedevd.sysconf b/src/node_device/virtnodedevd.sysconf
|
||||
deleted file mode 100644
|
||||
index fa7faa3a79..0000000000
|
||||
--- a/src/node_device/virtnodedevd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtnodedevd.service systemd unit
|
||||
-
|
||||
-VIRTNODEDEVD_ARGS="--timeout 120"
|
||||
diff --git a/src/nwfilter/meson.build b/src/nwfilter/meson.build
|
||||
index a21e575925..ebbe712906 100644
|
||||
--- a/src/nwfilter/meson.build
|
||||
+++ b/src/nwfilter/meson.build
|
||||
@@ -61,10 +61,5 @@ if conf.has('WITH_NWFILTER')
|
||||
'in_file': files('virtnwfilterd.init.in'),
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtnwfilterd',
|
||||
- 'file': files('virtnwfilterd.sysconf'),
|
||||
- }
|
||||
-
|
||||
subdir('xml')
|
||||
endif
|
||||
diff --git a/src/nwfilter/virtnwfilterd.service.in b/src/nwfilter/virtnwfilterd.service.in
|
||||
index dda7c01a3d..36d00b58f0 100644
|
||||
--- a/src/nwfilter/virtnwfilterd.service.in
|
||||
+++ b/src/nwfilter/virtnwfilterd.service.in
|
||||
@@ -13,6 +13,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTNWFILTERD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtnwfilterd
|
||||
ExecStart=@sbindir@/virtnwfilterd $VIRTNWFILTERD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/nwfilter/virtnwfilterd.sysconf b/src/nwfilter/virtnwfilterd.sysconf
|
||||
deleted file mode 100644
|
||||
index 80cc645ba5..0000000000
|
||||
--- a/src/nwfilter/virtnwfilterd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtnwfilterd.service systemd unit
|
||||
-
|
||||
-VIRTNWFILTERD_ARGS="--timeout 120"
|
||||
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
|
||||
index 66ef594006..5f82f687c1 100644
|
||||
--- a/src/qemu/meson.build
|
||||
+++ b/src/qemu/meson.build
|
||||
@@ -165,11 +165,6 @@ if conf.has('WITH_QEMU')
|
||||
'in_file': files('virtqemud.init.in'),
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtqemud',
|
||||
- 'file': files('virtqemud.sysconf'),
|
||||
- }
|
||||
-
|
||||
if conf.has('WITH_SYSCTL')
|
||||
install_data(
|
||||
'postcopy-migration.sysctl',
|
||||
diff --git a/src/qemu/virtqemud.service.in b/src/qemu/virtqemud.service.in
|
||||
index 20e1b43a6e..551eb4d405 100644
|
||||
--- a/src/qemu/virtqemud.service.in
|
||||
+++ b/src/qemu/virtqemud.service.in
|
||||
@@ -20,6 +20,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTQEMUD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtqemud
|
||||
ExecStart=@sbindir@/virtqemud $VIRTQEMUD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/qemu/virtqemud.sysconf b/src/qemu/virtqemud.sysconf
|
||||
deleted file mode 100644
|
||||
index 87b626e3ed..0000000000
|
||||
--- a/src/qemu/virtqemud.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,12 +0,0 @@
|
||||
-# Customizations for the virtqemud.service systemd unit
|
||||
-
|
||||
-VIRTQEMUD_ARGS="--timeout 120"
|
||||
-
|
||||
-# Override the QEMU/SDL default audio driver probing when
|
||||
-# starting virtual machines using SDL graphics
|
||||
-#
|
||||
-# NB these have no effect for VMs using VNC, unless vnc_allow_host_audio
|
||||
-# is enabled in /etc/libvirt/qemu.conf
|
||||
-#QEMU_AUDIO_DRV=sdl
|
||||
-#
|
||||
-#SDL_AUDIODRIVER=pulse
|
||||
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
|
||||
index cc0d4e3693..5d4d412fcc 100644
|
||||
--- a/src/remote/libvirtd.service.in
|
||||
+++ b/src/remote/libvirtd.service.in
|
||||
@@ -28,6 +28,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=LIBVIRTD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/libvirtd
|
||||
ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/remote/libvirtd.sysconf b/src/remote/libvirtd.sysconf
|
||||
deleted file mode 100644
|
||||
index 18aec1ba67..0000000000
|
||||
--- a/src/remote/libvirtd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,21 +0,0 @@
|
||||
-# Customizations for the libvirtd.service systemd unit
|
||||
-
|
||||
-# Default behaviour is for libvirtd.service to start on boot
|
||||
-# so that VM autostart can be performed. We then want it to
|
||||
-# shutdown again if nothing was started and rely on systemd
|
||||
-# socket activation to start it again when some client app
|
||||
-# connects.
|
||||
-LIBVIRTD_ARGS="--timeout 120"
|
||||
-
|
||||
-# If systemd socket activation is disabled, then the following
|
||||
-# can be used to listen on TCP/TLS sockets
|
||||
-#LIBVIRTD_ARGS="--listen"
|
||||
-
|
||||
-# Override the QEMU/SDL default audio driver probing when
|
||||
-# starting virtual machines using SDL graphics
|
||||
-#
|
||||
-# NB these have no effect for VMs using VNC, unless vnc_allow_host_audio
|
||||
-# is enabled in /etc/libvirt/qemu.conf
|
||||
-#QEMU_AUDIO_DRV=sdl
|
||||
-#
|
||||
-#SDL_AUDIODRIVER=pulse
|
||||
diff --git a/src/remote/meson.build b/src/remote/meson.build
|
||||
index 0a188268b5..fc98d0e5be 100644
|
||||
--- a/src/remote/meson.build
|
||||
+++ b/src/remote/meson.build
|
||||
@@ -204,11 +204,6 @@ if conf.has('WITH_REMOTE')
|
||||
'confd': files('libvirtd.confd'),
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'libvirtd',
|
||||
- 'file': files('libvirtd.sysconf'),
|
||||
- }
|
||||
-
|
||||
virt_daemons += {
|
||||
'name': 'virtproxyd',
|
||||
'c_args': [
|
||||
@@ -239,11 +234,6 @@ if conf.has('WITH_REMOTE')
|
||||
'confd': files('virtproxyd.confd'),
|
||||
}
|
||||
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtproxyd',
|
||||
- 'file': files('virtproxyd.sysconf'),
|
||||
- }
|
||||
-
|
||||
virt_install_dirs += [
|
||||
localstatedir / 'log' / 'libvirt',
|
||||
]
|
||||
diff --git a/src/remote/virtproxyd.service.in b/src/remote/virtproxyd.service.in
|
||||
index f43ce9ee6e..10e8cf7263 100644
|
||||
--- a/src/remote/virtproxyd.service.in
|
||||
+++ b/src/remote/virtproxyd.service.in
|
||||
@@ -13,6 +13,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTPROXYD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtproxyd
|
||||
ExecStart=@sbindir@/virtproxyd $VIRTPROXYD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/remote/virtproxyd.sysconf b/src/remote/virtproxyd.sysconf
|
||||
deleted file mode 100644
|
||||
index 0fc5c61096..0000000000
|
||||
--- a/src/remote/virtproxyd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtproxyd.service systemd unit
|
||||
-
|
||||
-VIRTPROXYD_ARGS="--timeout 120"
|
||||
diff --git a/src/secret/meson.build b/src/secret/meson.build
|
||||
index a487055cde..efc0ebb1e6 100644
|
||||
--- a/src/secret/meson.build
|
||||
+++ b/src/secret/meson.build
|
||||
@@ -43,9 +43,4 @@ if conf.has('WITH_SECRETS')
|
||||
'name': 'virtsecretd',
|
||||
'in_file': files('virtsecretd.init.in'),
|
||||
}
|
||||
-
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtsecretd',
|
||||
- 'file': files('virtsecretd.sysconf'),
|
||||
- }
|
||||
endif
|
||||
diff --git a/src/secret/virtsecretd.service.in b/src/secret/virtsecretd.service.in
|
||||
index 8444142a3a..cbd63fe0b2 100644
|
||||
--- a/src/secret/virtsecretd.service.in
|
||||
+++ b/src/secret/virtsecretd.service.in
|
||||
@@ -13,6 +13,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTSECRETD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtsecretd
|
||||
ExecStart=@sbindir@/virtsecretd $VIRTSECRETD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/secret/virtsecretd.sysconf b/src/secret/virtsecretd.sysconf
|
||||
deleted file mode 100644
|
||||
index 2247d05964..0000000000
|
||||
--- a/src/secret/virtsecretd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtsecretd.service systemd unit
|
||||
-
|
||||
-VIRTSECRETD_ARGS="--timeout 120"
|
||||
diff --git a/src/storage/meson.build b/src/storage/meson.build
|
||||
index d1aa66b147..c43707461d 100644
|
||||
--- a/src/storage/meson.build
|
||||
+++ b/src/storage/meson.build
|
||||
@@ -125,11 +125,6 @@ if conf.has('WITH_STORAGE')
|
||||
'name': 'virtstoraged',
|
||||
'in_file': files('virtstoraged.init.in'),
|
||||
}
|
||||
-
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtstoraged',
|
||||
- 'file': files('virtstoraged.sysconf'),
|
||||
- }
|
||||
endif
|
||||
|
||||
if conf.has('WITH_STORAGE_DISK')
|
||||
diff --git a/src/storage/virtstoraged.service.in b/src/storage/virtstoraged.service.in
|
||||
index fc3e9a1b69..f72f8426fd 100644
|
||||
--- a/src/storage/virtstoraged.service.in
|
||||
+++ b/src/storage/virtstoraged.service.in
|
||||
@@ -15,6 +15,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTSTORAGED_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtstoraged
|
||||
ExecStart=@sbindir@/virtstoraged $VIRTSTORAGED_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/storage/virtstoraged.sysconf b/src/storage/virtstoraged.sysconf
|
||||
deleted file mode 100644
|
||||
index 122373eb7c..0000000000
|
||||
--- a/src/storage/virtstoraged.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtstoraged.service systemd unit
|
||||
-
|
||||
-VIRTSTORAGED_ARGS="--timeout 120"
|
||||
diff --git a/src/vbox/meson.build b/src/vbox/meson.build
|
||||
index df0cfb40e8..240f2389a9 100644
|
||||
--- a/src/vbox/meson.build
|
||||
+++ b/src/vbox/meson.build
|
||||
@@ -68,9 +68,4 @@ if conf.has('WITH_VBOX')
|
||||
'name': 'virtvboxd',
|
||||
'in_file': files('virtvboxd.init.in'),
|
||||
}
|
||||
-
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtvboxd',
|
||||
- 'file': files('virtvboxd.sysconf'),
|
||||
- }
|
||||
endif
|
||||
diff --git a/src/vbox/virtvboxd.service.in b/src/vbox/virtvboxd.service.in
|
||||
index ebb31dde07..cfdafc39d2 100644
|
||||
--- a/src/vbox/virtvboxd.service.in
|
||||
+++ b/src/vbox/virtvboxd.service.in
|
||||
@@ -14,6 +14,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTVBOXD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtvboxd
|
||||
ExecStart=@sbindir@/virtvboxd $VIRTVBOXD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/vbox/virtvboxd.sysconf b/src/vbox/virtvboxd.sysconf
|
||||
deleted file mode 100644
|
||||
index 37ad353d54..0000000000
|
||||
--- a/src/vbox/virtvboxd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtvboxd.service systemd unit
|
||||
-
|
||||
-VIRTVBOXD_ARGS="--timeout 120"
|
||||
diff --git a/src/vz/meson.build b/src/vz/meson.build
|
||||
index 14f7280f66..d102696943 100644
|
||||
--- a/src/vz/meson.build
|
||||
+++ b/src/vz/meson.build
|
||||
@@ -58,9 +58,4 @@ if conf.has('WITH_VZ')
|
||||
'name': 'virtvzd',
|
||||
'in_file': files('virtvzd.init.in'),
|
||||
}
|
||||
-
|
||||
- sysconf_files += {
|
||||
- 'name': 'virtvzd',
|
||||
- 'file': files('virtvzd.sysconf'),
|
||||
- }
|
||||
endif
|
||||
diff --git a/src/vz/virtvzd.service.in b/src/vz/virtvzd.service.in
|
||||
index f551cb8fbf..7636bf2b9e 100644
|
||||
--- a/src/vz/virtvzd.service.in
|
||||
+++ b/src/vz/virtvzd.service.in
|
||||
@@ -14,6 +14,7 @@ Documentation=https://libvirt.org
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
+Environment=VIRTVZD_ARGS="--timeout 120"
|
||||
EnvironmentFile=-@sysconfdir@/sysconfig/virtvzd
|
||||
ExecStart=@sbindir@/virtvzd $VIRTVZD_ARGS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
diff --git a/src/vz/virtvzd.sysconf b/src/vz/virtvzd.sysconf
|
||||
deleted file mode 100644
|
||||
index a86b9dfb6c..0000000000
|
||||
--- a/src/vz/virtvzd.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-# Customizations for the virtvzd.service systemd unit
|
||||
-
|
||||
-VIRTVZD_ARGS="--timeout 120"
|
||||
diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
|
||||
deleted file mode 100644
|
||||
index 4f83edab90..0000000000
|
||||
--- a/tools/libvirt-guests.sysconf
|
||||
+++ /dev/null
|
||||
@@ -1,50 +0,0 @@
|
||||
-# Customizations for the libvirt-guests.service systemd unit
|
||||
-
|
||||
-# URIs to check for running guests
|
||||
-# example: URIS='default xen:///system vbox+tcp://host/system lxc:///system'
|
||||
-#URIS=default
|
||||
-
|
||||
-# action taken on host boot
|
||||
-# - start all guests which were running on shutdown are started on boot
|
||||
-# regardless on their autostart settings
|
||||
-# - ignore libvirt-guests init script won't start any guest on boot, however,
|
||||
-# guests marked as autostart will still be automatically started by
|
||||
-# libvirtd
|
||||
-#ON_BOOT=start
|
||||
-
|
||||
-# Number of seconds to wait between each guest start. Set to 0 to allow
|
||||
-# parallel startup.
|
||||
-#START_DELAY=0
|
||||
-
|
||||
-# action taken on host shutdown
|
||||
-# - suspend all running guests are suspended using virsh managedsave
|
||||
-# - shutdown all running guests are asked to shutdown. Please be careful with
|
||||
-# this settings since there is no way to distinguish between a
|
||||
-# guest which is stuck or ignores shutdown requests and a guest
|
||||
-# which just needs a long time to shutdown. When setting
|
||||
-# ON_SHUTDOWN=shutdown, you must also set SHUTDOWN_TIMEOUT to a
|
||||
-# value suitable for your guests.
|
||||
-#ON_SHUTDOWN=suspend
|
||||
-
|
||||
-# Number of guests will be shutdown concurrently, taking effect when
|
||||
-# "ON_SHUTDOWN" is set to "shutdown". If Set to 0, guests will be shutdown one
|
||||
-# after another. Number of guests on shutdown at any time will not exceed number
|
||||
-# set in this variable.
|
||||
-#PARALLEL_SHUTDOWN=0
|
||||
-
|
||||
-# Number of seconds we're willing to wait for a guest to shut down. If parallel
|
||||
-# shutdown is enabled, this timeout applies as a timeout for shutting down all
|
||||
-# guests on a single URI defined in the variable URIS. If this is 0, then there
|
||||
-# is no time out (use with caution, as guests might not respond to a shutdown
|
||||
-# request). The default value is 300 seconds (5 minutes).
|
||||
-#SHUTDOWN_TIMEOUT=300
|
||||
-
|
||||
-# If non-zero, try to bypass the file system cache when saving and
|
||||
-# restoring guests, even though this may give slower operation for
|
||||
-# some file systems.
|
||||
-#BYPASS_CACHE=0
|
||||
-
|
||||
-# If non-zero, try to sync guest time on domain resume. Be aware, that
|
||||
-# this requires guest agent with support for time synchronization
|
||||
-# running in the guest. By default, this functionality is turned off.
|
||||
-#SYNC_TIME=1
|
||||
diff --git a/tools/meson.build b/tools/meson.build
|
||||
index 2d0aecb90b..f4b4a16c29 100644
|
||||
--- a/tools/meson.build
|
||||
+++ b/tools/meson.build
|
||||
@@ -308,12 +308,6 @@ if conf.has('WITH_LIBVIRTD')
|
||||
)
|
||||
|
||||
if init_script == 'systemd'
|
||||
- install_data(
|
||||
- 'libvirt-guests.sysconf',
|
||||
- install_dir: sysconfdir / 'sysconfig',
|
||||
- rename: 'libvirt-guests',
|
||||
- )
|
||||
-
|
||||
configure_file(
|
||||
input: 'libvirt-guests.service.in',
|
||||
output: '@BASENAME@',
|
||||
--
|
||||
2.35.0
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
From 0f6009e5a8ca63388772597f3e42c71b50635a02 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0f6009e5a8ca63388772597f3e42c71b50635a02@dist-git>
|
||||
From: Peng Liang <liangpeng10@huawei.com>
|
||||
Date: Wed, 2 Mar 2022 17:22:05 +0800
|
||||
Subject: [PATCH] rpc: Fix memory leak of fds
|
||||
|
||||
In virSystemdActivationClaimFDs, the memory of ent->fds has been stolen
|
||||
and stored in fds, but fds is never freed, which causes a memory leak.
|
||||
Fix it by declaring fds as g_autofree.
|
||||
|
||||
Reported-by: Jie Tang <tangjie18@huawei.com>
|
||||
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 8a1915c4d6c33669dcb390d0708cb6e5d651770d)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2165428
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/rpc/virnetserver.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
|
||||
index ad581a36dd..d9430a2cfa 100644
|
||||
--- a/src/rpc/virnetserver.c
|
||||
+++ b/src/rpc/virnetserver.c
|
||||
@@ -655,7 +655,7 @@ virNetServerAddServiceActivation(virNetServer *srv,
|
||||
size_t max_queued_clients,
|
||||
size_t nrequests_client_max)
|
||||
{
|
||||
- int *fds;
|
||||
+ g_autofree int *fds = NULL;
|
||||
size_t nfds;
|
||||
|
||||
if (act == NULL)
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
From eb17cd2553366491b54c834b00fd953e94ef0bd2 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <eb17cd2553366491b54c834b00fd953e94ef0bd2@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:14 +0200
|
||||
Subject: [PATCH] schemas: refactor out nodedev ccw address schema
|
||||
|
||||
Refactor out nodedev ccw address schema for easy reuse later.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit e9ba2ced0b6bdcf6ed4c4b38d8f3fc63b6fa6d59)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
docs/schemas/nodedev.rng | 22 +++++++++-------------
|
||||
1 file changed, 9 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
|
||||
index e4733f0804..29515d2d7e 100644
|
||||
--- a/docs/schemas/nodedev.rng
|
||||
+++ b/docs/schemas/nodedev.rng
|
||||
@@ -653,10 +653,7 @@
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
- <define name="capccwdev">
|
||||
- <attribute name="type">
|
||||
- <value>ccw</value>
|
||||
- </attribute>
|
||||
+ <define name="capccwaddress">
|
||||
<element name="cssid">
|
||||
<ref name="ccwCssidRange"/>
|
||||
</element>
|
||||
@@ -668,19 +665,18 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
+ <define name="capccwdev">
|
||||
+ <attribute name="type">
|
||||
+ <value>ccw</value>
|
||||
+ </attribute>
|
||||
+ <ref name="capccwaddress"/>
|
||||
+ </define>
|
||||
+
|
||||
<define name="capcssdev">
|
||||
<attribute name="type">
|
||||
<value>css</value>
|
||||
</attribute>
|
||||
- <element name="cssid">
|
||||
- <ref name="ccwCssidRange"/>
|
||||
- </element>
|
||||
- <element name="ssid">
|
||||
- <ref name="ccwSsidRange"/>
|
||||
- </element>
|
||||
- <element name="devno">
|
||||
- <ref name="ccwDevnoRange"/>
|
||||
- </element>
|
||||
+ <ref name="capccwaddress"/>
|
||||
<optional>
|
||||
<ref name="mdev_types"/>
|
||||
</optional>
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
From 07fb786e0d17bd395333d276ebbaad42c72ee358 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <07fb786e0d17bd395333d276ebbaad42c72ee358@dist-git>
|
||||
From: David Michael <david@bigbadwolfsecurity.com>
|
||||
Date: Tue, 28 Jun 2022 08:33:41 -0400
|
||||
Subject: [PATCH] security_selinux.c: Relabel existing mode="bind" UNIX sockets
|
||||
|
||||
This supports sockets created by libvirt and passed by FD using the
|
||||
same method as in security_dac.c.
|
||||
|
||||
Signed-off-by: David Michael <david@bigbadwolfsecurity.com>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 9f13f54a6348b54170f7de3595039c99b9da72c7)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2101575
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/security/security_selinux.c | 9 +++++++--
|
||||
tests/securityselinuxlabeldata/chardev.txt | 2 +-
|
||||
2 files changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
|
||||
index 0952431064..b90e819fd2 100644
|
||||
--- a/src/security/security_selinux.c
|
||||
+++ b/src/security/security_selinux.c
|
||||
@@ -2545,7 +2545,12 @@ virSecuritySELinuxSetChardevLabel(virSecurityManager *mgr,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CHR_TYPE_UNIX:
|
||||
- if (!dev_source->data.nix.listen) {
|
||||
+ if (!dev_source->data.nix.listen ||
|
||||
+ (dev_source->data.nix.path &&
|
||||
+ virFileExists(dev_source->data.nix.path))) {
|
||||
+ /* Also label mode='bind' sockets if they exist,
|
||||
+ * e.g. because they were created by libvirt
|
||||
+ * and passed via FD */
|
||||
if (virSecuritySELinuxSetFilecon(mgr,
|
||||
dev_source->data.nix.path,
|
||||
imagelabel,
|
||||
@@ -2622,7 +2627,7 @@ virSecuritySELinuxRestoreChardevLabel(virSecurityManager *mgr,
|
||||
case VIR_DOMAIN_CHR_TYPE_UNIX:
|
||||
if (!dev_source->data.nix.listen) {
|
||||
if (virSecuritySELinuxRestoreFileLabel(mgr,
|
||||
- dev_source->data.file.path,
|
||||
+ dev_source->data.nix.path,
|
||||
true) < 0)
|
||||
goto done;
|
||||
}
|
||||
diff --git a/tests/securityselinuxlabeldata/chardev.txt b/tests/securityselinuxlabeldata/chardev.txt
|
||||
index 3f4b6302b9..bdb367f7a5 100644
|
||||
--- a/tests/securityselinuxlabeldata/chardev.txt
|
||||
+++ b/tests/securityselinuxlabeldata/chardev.txt
|
||||
@@ -2,6 +2,6 @@
|
||||
/plain.dev;system_u:object_r:svirt_image_t:s0:c41,c264
|
||||
/plain.fifo;system_u:object_r:svirt_image_t:s0:c41,c264
|
||||
/nolabel.sock;
|
||||
-/plain.sock;
|
||||
+/plain.sock;system_u:object_r:svirt_image_t:s0:c41,c264
|
||||
/yeslabel.sock;system_u:object_r:svirt_image_t:s0:c41,c264
|
||||
/altlabel.sock;system_u:object_r:svirt_image_custom_t:s0:c41,c264
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
From 48f4d21cf73e15e145258bf1d590ca279838168c Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <48f4d21cf73e15e145258bf1d590ca279838168c@dist-git>
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Thu, 8 Dec 2022 08:39:24 +0100
|
||||
Subject: [PATCH] tools: Fix install_mode for some scripts
|
||||
|
||||
Scripts from the following list were installed with group write
|
||||
bit set: virt-xml-validate, virt-pki-validate,
|
||||
virt-sanlock-cleanup, libvirt-guests.sh. This is very unusual and
|
||||
in contrast with the way other scripts/binaries are installed.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151202
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit e771e32f15ff2b263ca70306d93080541a96792b)
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2153688
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
tools/meson.build | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/meson.build b/tools/meson.build
|
||||
index 2d0aecb90b..7c6e527939 100644
|
||||
--- a/tools/meson.build
|
||||
+++ b/tools/meson.build
|
||||
@@ -247,7 +247,7 @@ configure_file(
|
||||
configuration: tools_conf,
|
||||
install: true,
|
||||
install_dir: bindir,
|
||||
- install_mode: 'rwxrwxr-x',
|
||||
+ install_mode: 'rwxr-xr-x',
|
||||
)
|
||||
|
||||
configure_file(
|
||||
@@ -256,7 +256,7 @@ configure_file(
|
||||
configuration: tools_conf,
|
||||
install: true,
|
||||
install_dir: bindir,
|
||||
- install_mode: 'rwxrwxr-x',
|
||||
+ install_mode: 'rwxr-xr-x',
|
||||
)
|
||||
|
||||
executable(
|
||||
@@ -293,7 +293,7 @@ if conf.has('WITH_SANLOCK')
|
||||
configuration: tools_conf,
|
||||
install: true,
|
||||
install_dir: sbindir,
|
||||
- install_mode: 'rwxrwxr-x',
|
||||
+ install_mode: 'rwxr-xr-x',
|
||||
)
|
||||
endif
|
||||
|
||||
@@ -304,7 +304,7 @@ if conf.has('WITH_LIBVIRTD')
|
||||
configuration: tools_conf,
|
||||
install: true,
|
||||
install_dir: libexecdir,
|
||||
- install_mode: 'rwxrwxr-x',
|
||||
+ install_mode: 'rwxr-xr-x',
|
||||
)
|
||||
|
||||
if init_script == 'systemd'
|
||||
--
|
||||
2.39.0
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
From f38b129e38b73cb20a2d858de7b593d09380e548 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f38b129e38b73cb20a2d858de7b593d09380e548@dist-git>
|
||||
From: Martin Kletzander <mkletzan@redhat.com>
|
||||
Date: Wed, 23 Feb 2022 10:45:28 +0100
|
||||
Subject: [PATCH] util: Fix machined servicename
|
||||
|
||||
Commit 4e42686adef8 wrongly assumed how g_variant_new_parsed() works and broke
|
||||
starting of domains on systems with systemd (machined).
|
||||
|
||||
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit a64e666a112d4d6299d1b73704d176283bc42b19)
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1868537
|
||||
|
||||
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
---
|
||||
src/util/virsystemd.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
|
||||
index f156c2f39a..a8af80c495 100644
|
||||
--- a/src/util/virsystemd.c
|
||||
+++ b/src/util/virsystemd.c
|
||||
@@ -360,6 +360,7 @@ int virSystemdCreateMachine(const char *name,
|
||||
g_autofree char *creatorname = NULL;
|
||||
g_autofree char *slicename = NULL;
|
||||
g_autofree char *scopename = NULL;
|
||||
+ g_autofree char *servicename = NULL;
|
||||
static int hasCreateWithNetwork = 1;
|
||||
|
||||
if ((rc = virSystemdHasMachined()) < 0)
|
||||
@@ -369,6 +370,7 @@ int virSystemdCreateMachine(const char *name,
|
||||
return -1;
|
||||
|
||||
creatorname = g_strdup_printf("libvirt-%s", drivername);
|
||||
+ servicename = g_strdup_printf("virt%sd.service", drivername);
|
||||
|
||||
if (partition) {
|
||||
if (!(slicename = virSystemdMakeSliceName(partition)))
|
||||
@@ -440,11 +442,10 @@ int virSystemdCreateMachine(const char *name,
|
||||
gnicindexes = g_variant_new_fixed_array(G_VARIANT_TYPE("i"),
|
||||
nicindexes, nnicindexes, sizeof(int));
|
||||
gprops = g_variant_new_parsed("[('Slice', <%s>),"
|
||||
- " ('After', <['libvirtd.service']>),"
|
||||
- " ('After', <['virt%sd.service']>),"
|
||||
+ " ('After', <['libvirtd.service', %s]>),"
|
||||
" ('Before', <['virt-guest-shutdown.target']>)]",
|
||||
slicename,
|
||||
- drivername);
|
||||
+ servicename);
|
||||
message = g_variant_new("(s@ayssus@ai@a(sv))",
|
||||
name,
|
||||
guuid,
|
||||
@@ -490,11 +491,10 @@ int virSystemdCreateMachine(const char *name,
|
||||
guuid = g_variant_new_fixed_array(G_VARIANT_TYPE("y"),
|
||||
uuid, 16, sizeof(unsigned char));
|
||||
gprops = g_variant_new_parsed("[('Slice', <%s>),"
|
||||
- " ('After', <['libvirtd.service']>),"
|
||||
- " ('After', <['virt%sd.service']>),"
|
||||
+ " ('After', <['libvirtd.service', %s]>),"
|
||||
" ('Before', <['virt-guest-shutdown.target']>)]",
|
||||
slicename,
|
||||
- drivername);
|
||||
+ servicename);
|
||||
message = g_variant_new("(s@ayssus@a(sv))",
|
||||
name,
|
||||
guuid,
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
From 6d9fc3310cedf321f54530c0652998b67979e613 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6d9fc3310cedf321f54530c0652998b67979e613@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:09 +0200
|
||||
Subject: [PATCH] util: add ccw device address parsing into virccw
|
||||
|
||||
Add virCCWDeviceAddressParseFromString and use it in nodedev udev.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 8d52f99f0b55ddfee4e0c00e756ca6c01250107d)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/node_device/node_device_udev.c | 8 +++++---
|
||||
src/util/virccw.c | 18 ++++++++++++++++++
|
||||
src/util/virccw.h | 5 +++++
|
||||
4 files changed, 29 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 44b551fb60..6f1292e0c4 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -1904,6 +1904,7 @@ virCCWDeviceAddressAsString;
|
||||
virCCWDeviceAddressEqual;
|
||||
virCCWDeviceAddressIncrement;
|
||||
virCCWDeviceAddressIsValid;
|
||||
+virCCWDeviceAddressParseFromString;
|
||||
|
||||
|
||||
# util/vircgroup.h
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index a9e8bf10da..ffcb3e8640 100644
|
||||
--- a/src/node_device/node_device_udev.c
|
||||
+++ b/src/node_device/node_device_udev.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "viruuid.h"
|
||||
#include "virbuffer.h"
|
||||
#include "virfile.h"
|
||||
+#include "virccw.h"
|
||||
#include "virpci.h"
|
||||
#include "virpidfile.h"
|
||||
#include "virstring.h"
|
||||
@@ -1090,9 +1091,10 @@ udevGetCCWAddress(const char *sysfs_path,
|
||||
char *p;
|
||||
|
||||
if ((p = strrchr(sysfs_path, '/')) == NULL ||
|
||||
- virStrToLong_ui(p + 1, &p, 16, &data->ccw_dev.cssid) < 0 || p == NULL ||
|
||||
- virStrToLong_ui(p + 1, &p, 16, &data->ccw_dev.ssid) < 0 || p == NULL ||
|
||||
- virStrToLong_ui(p + 1, &p, 16, &data->ccw_dev.devno) < 0) {
|
||||
+ virCCWDeviceAddressParseFromString(p + 1,
|
||||
+ &data->ccw_dev.cssid,
|
||||
+ &data->ccw_dev.ssid,
|
||||
+ &data->ccw_dev.devno) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to parse the CCW address from sysfs path: '%s'"),
|
||||
sysfs_path);
|
||||
diff --git a/src/util/virccw.c b/src/util/virccw.c
|
||||
index e2785bd9ab..33df1c2428 100644
|
||||
--- a/src/util/virccw.c
|
||||
+++ b/src/util/virccw.c
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "virccw.h"
|
||||
+#include "virstring.h"
|
||||
|
||||
|
||||
bool
|
||||
@@ -60,3 +61,20 @@ virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr)
|
||||
*addr = ccwaddr;
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int
|
||||
+virCCWDeviceAddressParseFromString(const char *address,
|
||||
+ unsigned int *cssid,
|
||||
+ unsigned int *ssid,
|
||||
+ unsigned int *devno)
|
||||
+{
|
||||
+ char *p;
|
||||
+
|
||||
+ if (address == NULL || virStrToLong_ui(address, &p, 16, cssid) < 0 ||
|
||||
+ p == NULL || virStrToLong_ui(p + 1, &p, 16, ssid) < 0 ||
|
||||
+ p == NULL || virStrToLong_ui(p + 1, &p, 16, devno) < 0) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
index aebbd4ab6d..df0273bcac 100644
|
||||
--- a/src/util/virccw.h
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -42,3 +42,8 @@ bool virCCWDeviceAddressEqual(virCCWDeviceAddress *addr1,
|
||||
char* virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
int virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr);
|
||||
+
|
||||
+int virCCWDeviceAddressParseFromString(const char *address,
|
||||
+ unsigned int *cssid,
|
||||
+ unsigned int *ssid,
|
||||
+ unsigned int *devno);
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
From e5e849999b1d615c6a371839aeead37275599cf0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <e5e849999b1d615c6a371839aeead37275599cf0@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:10 +0200
|
||||
Subject: [PATCH] util: add virCCWDeviceAddressFromString to virccw
|
||||
|
||||
Add a method to parse a ccw device address from a string.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 9453eb458a5c3ed6687188233d7e389c3e20c266)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Conflicts:
|
||||
po/POTFILES (file is called POTFILES.in in downstream)
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
po/POTFILES.in | 1 +
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/util/virccw.c | 23 +++++++++++++++++++++++
|
||||
src/util/virccw.h | 3 +++
|
||||
4 files changed, 28 insertions(+)
|
||||
|
||||
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
||||
index bf0a3b3529..327e20ec11 100644
|
||||
--- a/po/POTFILES.in
|
||||
+++ b/po/POTFILES.in
|
||||
@@ -246,6 +246,7 @@
|
||||
@SRCDIR@src/util/virauth.c
|
||||
@SRCDIR@src/util/virauthconfig.c
|
||||
@SRCDIR@src/util/virbitmap.c
|
||||
+@SRCDIR@src/util/virccw.c
|
||||
@SRCDIR@src/util/vircgroup.c
|
||||
@SRCDIR@src/util/vircgroupbackend.c
|
||||
@SRCDIR@src/util/vircgroupbackend.h
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 6f1292e0c4..7c558ad364 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -1902,6 +1902,7 @@ virBufferVasprintf;
|
||||
# util/virccw.h
|
||||
virCCWDeviceAddressAsString;
|
||||
virCCWDeviceAddressEqual;
|
||||
+virCCWDeviceAddressFromString;
|
||||
virCCWDeviceAddressIncrement;
|
||||
virCCWDeviceAddressIsValid;
|
||||
virCCWDeviceAddressParseFromString;
|
||||
diff --git a/src/util/virccw.c b/src/util/virccw.c
|
||||
index 33df1c2428..d741743050 100644
|
||||
--- a/src/util/virccw.c
|
||||
+++ b/src/util/virccw.c
|
||||
@@ -20,8 +20,11 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "virccw.h"
|
||||
+#include "virerror.h"
|
||||
#include "virstring.h"
|
||||
|
||||
+#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
+
|
||||
|
||||
bool
|
||||
virCCWDeviceAddressIsValid(virCCWDeviceAddress *addr)
|
||||
@@ -49,6 +52,26 @@ virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
return g_strdup_printf(VIR_CCW_DEVICE_ADDRESS_FMT, addr->cssid, addr->ssid, addr->devno);
|
||||
}
|
||||
|
||||
+virCCWDeviceAddress *
|
||||
+virCCWDeviceAddressFromString(const char *address)
|
||||
+{
|
||||
+ g_autofree virCCWDeviceAddress *ccw = NULL;
|
||||
+
|
||||
+ ccw = g_new0(virCCWDeviceAddress, 1);
|
||||
+
|
||||
+ if (virCCWDeviceAddressParseFromString(address,
|
||||
+ &ccw->cssid,
|
||||
+ &ccw->ssid,
|
||||
+ &ccw->devno) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Failed to parse CCW address '%s'"),
|
||||
+ address);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return g_steal_pointer(&ccw);
|
||||
+}
|
||||
+
|
||||
int
|
||||
virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr)
|
||||
{
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
index df0273bcac..80cc716811 100644
|
||||
--- a/src/util/virccw.h
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -41,6 +41,9 @@ bool virCCWDeviceAddressEqual(virCCWDeviceAddress *addr1,
|
||||
|
||||
char* virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
+virCCWDeviceAddress *virCCWDeviceAddressFromString(const char *address)
|
||||
+ ATTRIBUTE_NONNULL(1);
|
||||
+
|
||||
int virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr);
|
||||
|
||||
int virCCWDeviceAddressParseFromString(const char *address,
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
From b7d9527c9d9cc782933a5b852869cbd10e370a3a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <b7d9527c9d9cc782933a5b852869cbd10e370a3a@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Thu, 1 Dec 2022 13:32:07 +0100
|
||||
Subject: [PATCH] util: json: Split out array->strinlist conversion from
|
||||
virJSONValueObjectGetStringArray
|
||||
|
||||
Introduce virJSONValueArrayToStringList which does only the conversion
|
||||
from an array to a stringlist.
|
||||
|
||||
This will allow refactoring the callers to be more careful in case when
|
||||
they want to handle the existance of the member in the parent object
|
||||
differently.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 6765bdeaf7e9cbdb4c39d47f3b77fb28a498408a)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2149752
|
||||
---
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/util/virjson.c | 43 ++++++++++++++++++++++------------------
|
||||
src/util/virjson.h | 2 ++
|
||||
3 files changed, 27 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 5b7a056151..fa734dfd33 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -2513,6 +2513,7 @@ virJSONValueArrayForeachSteal;
|
||||
virJSONValueArrayGet;
|
||||
virJSONValueArraySize;
|
||||
virJSONValueArraySteal;
|
||||
+virJSONValueArrayToStringList;
|
||||
virJSONValueCopy;
|
||||
virJSONValueFree;
|
||||
virJSONValueFromString;
|
||||
diff --git a/src/util/virjson.c b/src/util/virjson.c
|
||||
index 6e13e97e15..5f1565107d 100644
|
||||
--- a/src/util/virjson.c
|
||||
+++ b/src/util/virjson.c
|
||||
@@ -1312,10 +1312,7 @@ virJSONValueObjectStealObject(virJSONValue *object,
|
||||
char **
|
||||
virJSONValueObjectGetStringArray(virJSONValue *object, const char *key)
|
||||
{
|
||||
- g_auto(GStrv) ret = NULL;
|
||||
virJSONValue *data;
|
||||
- size_t n;
|
||||
- size_t i;
|
||||
|
||||
data = virJSONValueObjectGetArray(object, key);
|
||||
if (!data) {
|
||||
@@ -1325,32 +1322,40 @@ virJSONValueObjectGetStringArray(virJSONValue *object, const char *key)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- n = virJSONValueArraySize(data);
|
||||
- ret = g_new0(char *, n + 1);
|
||||
+ return virJSONValueArrayToStringList(data);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * virJSONValueArrayToStringList:
|
||||
+ * @data: a JSON array containing strings to convert
|
||||
+ *
|
||||
+ * Converts @data a JSON array containing strings to a NULL-terminated string
|
||||
+ * list. @data must be a JSON array. In case @data is doesn't contain only
|
||||
+ * strings an error is reported.
|
||||
+ */
|
||||
+char **
|
||||
+virJSONValueArrayToStringList(virJSONValue *data)
|
||||
+{
|
||||
+ size_t n = virJSONValueArraySize(data);
|
||||
+ g_auto(GStrv) ret = g_new0(char *, n + 1);
|
||||
+ size_t i;
|
||||
+
|
||||
for (i = 0; i < n; i++) {
|
||||
virJSONValue *child = virJSONValueArrayGet(data, i);
|
||||
- const char *tmp;
|
||||
|
||||
- if (!child) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("%s array element is missing item %zu"),
|
||||
- key, i);
|
||||
+ if (!child ||
|
||||
+ !(ret[i] = g_strdup(virJSONValueGetString(child)))) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("JSON string array contains non-string element"));
|
||||
return NULL;
|
||||
}
|
||||
-
|
||||
- if (!(tmp = virJSONValueGetString(child))) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("%s array element does not contain a string"),
|
||||
- key);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- ret[i] = g_strdup(tmp);
|
||||
}
|
||||
|
||||
return g_steal_pointer(&ret);
|
||||
}
|
||||
|
||||
+
|
||||
/**
|
||||
* virJSONValueObjectForeachKeyValue:
|
||||
* @object: JSON object to iterate
|
||||
diff --git a/src/util/virjson.h b/src/util/virjson.h
|
||||
index aced48a538..c9f83ab2bc 100644
|
||||
--- a/src/util/virjson.h
|
||||
+++ b/src/util/virjson.h
|
||||
@@ -172,6 +172,8 @@ virJSONValueObjectGetString(virJSONValue *object,
|
||||
char **
|
||||
virJSONValueObjectGetStringArray(virJSONValue *object,
|
||||
const char *key);
|
||||
+char **
|
||||
+virJSONValueArrayToStringList(virJSONValue *data);
|
||||
const char *
|
||||
virJSONValueObjectGetStringOrNumber(virJSONValue *object,
|
||||
const char *key);
|
||||
--
|
||||
2.39.0
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
From 94a416e1b67c72c69c19944937acc619503484b3 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <94a416e1b67c72c69c19944937acc619503484b3@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:03 +0200
|
||||
Subject: [PATCH] util: make reuse of ccw device address format constant
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit b41163005c0874b1d4809523227cd1921f4852d2)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/device_conf.h | 1 -
|
||||
src/qemu/qemu_command.c | 2 +-
|
||||
src/util/virccw.c | 2 +-
|
||||
src/util/virccw.h | 2 ++
|
||||
4 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
||||
index 60d90bbf19..950d333e2e 100644
|
||||
--- a/src/conf/device_conf.h
|
||||
+++ b/src/conf/device_conf.h
|
||||
@@ -202,7 +202,6 @@ int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
virCCWDeviceAddress *addr);
|
||||
bool virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
|
||||
virCCWDeviceAddress *addr2);
|
||||
-#define VIR_CCW_DEVICE_ADDRESS_FMT "%x.%x.%04x"
|
||||
|
||||
int virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
|
||||
virDomainDeviceDriveAddress *addr);
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index d23af97e0c..a7855d3370 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -613,7 +613,7 @@ qemuBuildDeviceAddressProps(virJSONValue *props,
|
||||
return 0;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW: {
|
||||
- g_autofree char *devno = g_strdup_printf("%x.%x.%04x",
|
||||
+ g_autofree char *devno = g_strdup_printf(VIR_CCW_DEVICE_ADDRESS_FMT,
|
||||
info->addr.ccw.cssid,
|
||||
info->addr.ccw.ssid,
|
||||
info->addr.ccw.devno);
|
||||
diff --git a/src/util/virccw.c b/src/util/virccw.c
|
||||
index 409287b380..5a19d3a112 100644
|
||||
--- a/src/util/virccw.c
|
||||
+++ b/src/util/virccw.c
|
||||
@@ -25,5 +25,5 @@
|
||||
char*
|
||||
virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
{
|
||||
- return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno);
|
||||
+ return g_strdup_printf(VIR_CCW_DEVICE_ADDRESS_FMT, addr->cssid, addr->ssid, addr->devno);
|
||||
}
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
index 21a03406fa..127359c299 100644
|
||||
--- a/src/util/virccw.h
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
+#define VIR_CCW_DEVICE_ADDRESS_FMT "%x.%x.%04x"
|
||||
+
|
||||
typedef struct _virCCWDeviceAddress virCCWDeviceAddress;
|
||||
struct _virCCWDeviceAddress {
|
||||
unsigned int cssid;
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
From 58d2890501a5a58eefa0500e1340112bc2264a70 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <58d2890501a5a58eefa0500e1340112bc2264a70@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:04 +0200
|
||||
Subject: [PATCH] util: refactor ccw address constants into virccw
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 5fe90d471a312a5c94668f8ed4bb397fdc894c58)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/device_conf.c | 6 +++---
|
||||
src/conf/device_conf.h | 4 ----
|
||||
src/conf/domain_addr.c | 2 +-
|
||||
src/util/virccw.h | 3 +++
|
||||
4 files changed, 7 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
||||
index 92b908b2e6..bdc9219f84 100644
|
||||
--- a/src/conf/device_conf.c
|
||||
+++ b/src/conf/device_conf.c
|
||||
@@ -261,9 +261,9 @@ virPCIDeviceAddressFormat(virBuffer *buf,
|
||||
bool
|
||||
virDomainDeviceCCWAddressIsValid(virCCWDeviceAddress *addr)
|
||||
{
|
||||
- return addr->cssid <= VIR_DOMAIN_DEVICE_CCW_MAX_CSSID &&
|
||||
- addr->ssid <= VIR_DOMAIN_DEVICE_CCW_MAX_SSID &&
|
||||
- addr->devno <= VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO;
|
||||
+ return addr->cssid <= VIR_CCW_DEVICE_MAX_CSSID &&
|
||||
+ addr->ssid <= VIR_CCW_DEVICE_MAX_SSID &&
|
||||
+ addr->devno <= VIR_CCW_DEVICE_MAX_DEVNO;
|
||||
}
|
||||
|
||||
int
|
||||
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
||||
index 950d333e2e..5c4b7b2f8e 100644
|
||||
--- a/src/conf/device_conf.h
|
||||
+++ b/src/conf/device_conf.h
|
||||
@@ -70,10 +70,6 @@ struct _virDomainDeviceVirtioSerialAddress {
|
||||
unsigned int port;
|
||||
};
|
||||
|
||||
-#define VIR_DOMAIN_DEVICE_CCW_MAX_CSSID 254
|
||||
-#define VIR_DOMAIN_DEVICE_CCW_MAX_SSID 3
|
||||
-#define VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO 65535
|
||||
-
|
||||
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
|
||||
struct _virDomainDeviceCcidAddress {
|
||||
unsigned int controller;
|
||||
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
||||
index bf51ef5e5a..655f3cc09e 100644
|
||||
--- a/src/conf/domain_addr.c
|
||||
+++ b/src/conf/domain_addr.c
|
||||
@@ -1292,7 +1292,7 @@ virDomainCCWAddressIncrement(virCCWDeviceAddress *addr)
|
||||
virCCWDeviceAddress ccwaddr = *addr;
|
||||
|
||||
/* We are not touching subchannel sets and channel subsystems */
|
||||
- if (++ccwaddr.devno > VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO)
|
||||
+ if (++ccwaddr.devno > VIR_CCW_DEVICE_MAX_DEVNO)
|
||||
return -1;
|
||||
|
||||
*addr = ccwaddr;
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
index 127359c299..c3a47127f1 100644
|
||||
--- a/src/util/virccw.h
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
+#define VIR_CCW_DEVICE_MAX_CSSID 254
|
||||
+#define VIR_CCW_DEVICE_MAX_SSID 3
|
||||
+#define VIR_CCW_DEVICE_MAX_DEVNO 65535
|
||||
#define VIR_CCW_DEVICE_ADDRESS_FMT "%x.%x.%04x"
|
||||
|
||||
typedef struct _virCCWDeviceAddress virCCWDeviceAddress;
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
From 531244b8147f8972e56b6ba2c7ecf04c072f296a Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <531244b8147f8972e56b6ba2c7ecf04c072f296a@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:02 +0200
|
||||
Subject: [PATCH] util: refactor virDomainCCWAddressAsString into virccw
|
||||
|
||||
Move virDomainCCWAddressAsString into virccw and rename method as
|
||||
virCCWDeviceAddressAsString.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 1df0a1986978dcb7d1fc139f14adbc4f85b1851f)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/domain_addr.c | 12 +++---------
|
||||
src/conf/domain_addr.h | 3 ---
|
||||
src/conf/domain_conf.c | 2 +-
|
||||
src/libvirt_private.syms | 5 ++++-
|
||||
src/node_device/node_device_driver.c | 2 +-
|
||||
src/util/meson.build | 1 +
|
||||
src/util/virccw.c | 29 ++++++++++++++++++++++++++++
|
||||
src/util/virccw.h | 3 +++
|
||||
8 files changed, 42 insertions(+), 15 deletions(-)
|
||||
create mode 100644 src/util/virccw.c
|
||||
|
||||
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
||||
index d584d3b8a8..bf51ef5e5a 100644
|
||||
--- a/src/conf/domain_addr.c
|
||||
+++ b/src/conf/domain_addr.c
|
||||
@@ -1286,12 +1286,6 @@ virDomainPCIAddressSetAllMulti(virDomainDef *def)
|
||||
}
|
||||
|
||||
|
||||
-char*
|
||||
-virDomainCCWAddressAsString(virCCWDeviceAddress *addr)
|
||||
-{
|
||||
- return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno);
|
||||
-}
|
||||
-
|
||||
static int
|
||||
virDomainCCWAddressIncrement(virCCWDeviceAddress *addr)
|
||||
{
|
||||
@@ -1317,7 +1311,7 @@ virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
|
||||
return 0;
|
||||
|
||||
if (!autoassign && dev->addr.ccw.assigned) {
|
||||
- if (!(addr = virDomainCCWAddressAsString(&dev->addr.ccw)))
|
||||
+ if (!(addr = virCCWDeviceAddressAsString(&dev->addr.ccw)))
|
||||
return -1;
|
||||
|
||||
if (virHashLookup(addrs->defined, addr)) {
|
||||
@@ -1327,7 +1321,7 @@ virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
|
||||
return -1;
|
||||
}
|
||||
} else if (autoassign && !dev->addr.ccw.assigned) {
|
||||
- if (!(addr = virDomainCCWAddressAsString(&addrs->next)))
|
||||
+ if (!(addr = virCCWDeviceAddressAsString(&addrs->next)))
|
||||
return -1;
|
||||
|
||||
while (virHashLookup(addrs->defined, addr)) {
|
||||
@@ -1337,7 +1331,7 @@ virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(addr);
|
||||
- if (!(addr = virDomainCCWAddressAsString(&addrs->next)))
|
||||
+ if (!(addr = virCCWDeviceAddressAsString(&addrs->next)))
|
||||
return -1;
|
||||
}
|
||||
dev->addr.ccw = addrs->next;
|
||||
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
|
||||
index c8d069e07e..a67851c327 100644
|
||||
--- a/src/conf/domain_addr.h
|
||||
+++ b/src/conf/domain_addr.h
|
||||
@@ -205,9 +205,6 @@ int virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
void virDomainCCWAddressSetFree(virDomainCCWAddressSet *addrs);
|
||||
|
||||
-char* virDomainCCWAddressAsString(virCCWDeviceAddress *addr)
|
||||
- ATTRIBUTE_NONNULL(1);
|
||||
-
|
||||
virDomainCCWAddressSet *
|
||||
virDomainCCWAddressSetCreateFromDomain(virDomainDef *def)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index ad3bd56da0..17383fc878 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -15793,7 +15793,7 @@ virDomainNetFindIdx(virDomainDef *def, virDomainNetDef *net)
|
||||
alias = net->info.alias;
|
||||
|
||||
if (CCWAddrSpecified)
|
||||
- addr = virDomainCCWAddressAsString(&net->info.addr.ccw);
|
||||
+ addr = virCCWDeviceAddressAsString(&net->info.addr.ccw);
|
||||
else if (PCIAddrSpecified)
|
||||
addr = virPCIDeviceAddressAsString(&net->info.addr.pci);
|
||||
else
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 568b0f34a1..e8d3edb0fe 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -147,7 +147,6 @@ virPCIDeviceAddressParseXML;
|
||||
|
||||
# conf/domain_addr.h
|
||||
virDomainCCWAddressAssign;
|
||||
-virDomainCCWAddressAsString;
|
||||
virDomainCCWAddressSetCreateFromDomain;
|
||||
virDomainCCWAddressSetFree;
|
||||
virDomainPCIAddressBusIsFullyReserved;
|
||||
@@ -1902,6 +1901,10 @@ virBufferUse;
|
||||
virBufferVasprintf;
|
||||
|
||||
|
||||
+# util/virccw.h
|
||||
+virCCWDeviceAddressAsString;
|
||||
+
|
||||
+
|
||||
# util/vircgroup.h
|
||||
virCgroupAddMachineProcess;
|
||||
virCgroupAddProcess;
|
||||
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
|
||||
index b0abf59618..e6ab4bb94c 100644
|
||||
--- a/src/node_device/node_device_driver.c
|
||||
+++ b/src/node_device/node_device_driver.c
|
||||
@@ -682,7 +682,7 @@ nodeDeviceObjFormatAddress(virNodeDeviceObj *obj)
|
||||
.devno = caps->data.ccw_dev.devno
|
||||
};
|
||||
|
||||
- addr = virDomainCCWAddressAsString(&ccw_addr);
|
||||
+ addr = virCCWDeviceAddressAsString(&ccw_addr);
|
||||
break;
|
||||
}
|
||||
|
||||
diff --git a/src/util/meson.build b/src/util/meson.build
|
||||
index 24350a3e67..13ed105798 100644
|
||||
--- a/src/util/meson.build
|
||||
+++ b/src/util/meson.build
|
||||
@@ -9,6 +9,7 @@ util_sources = [
|
||||
'virbitmap.c',
|
||||
'virbpf.c',
|
||||
'virbuffer.c',
|
||||
+ 'virccw.c',
|
||||
'vircgroup.c',
|
||||
'vircgroupbackend.c',
|
||||
'vircgroupv1.c',
|
||||
diff --git a/src/util/virccw.c b/src/util/virccw.c
|
||||
new file mode 100644
|
||||
index 0000000000..409287b380
|
||||
--- /dev/null
|
||||
+++ b/src/util/virccw.c
|
||||
@@ -0,0 +1,29 @@
|
||||
+/*
|
||||
+ * virccw.c: helper APIs for managing host CCW devices
|
||||
+ *
|
||||
+ * Copyright (C) 2022 IBM Corporation
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library. If not, see
|
||||
+ * <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <config.h>
|
||||
+#include "virccw.h"
|
||||
+
|
||||
+
|
||||
+char*
|
||||
+virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
+{
|
||||
+ return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno);
|
||||
+}
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
index 701e13284b..21a03406fa 100644
|
||||
--- a/src/util/virccw.h
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -29,3 +29,6 @@ struct _virCCWDeviceAddress {
|
||||
unsigned int devno;
|
||||
bool assigned;
|
||||
};
|
||||
+
|
||||
+char* virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
+ ATTRIBUTE_NONNULL(1);
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
From fcb45d357cc3b6e9ee413014e21de1ab2d20273f Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <fcb45d357cc3b6e9ee413014e21de1ab2d20273f@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:05 +0200
|
||||
Subject: [PATCH] util: refactor virDomainCCWAddressIncrement into virccw
|
||||
|
||||
Refactor virDomainCCWAddressIncrement into virccw and rename method as
|
||||
virCCWDeviceAddressIncrement.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit be1e16ed1161173b07f2e8f20f2ca3294ac49406)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/domain_addr.c | 16 +---------------
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/util/virccw.c | 13 +++++++++++++
|
||||
src/util/virccw.h | 1 +
|
||||
4 files changed, 16 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
||||
index 655f3cc09e..b04ab0628b 100644
|
||||
--- a/src/conf/domain_addr.c
|
||||
+++ b/src/conf/domain_addr.c
|
||||
@@ -1286,20 +1286,6 @@ virDomainPCIAddressSetAllMulti(virDomainDef *def)
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
-virDomainCCWAddressIncrement(virCCWDeviceAddress *addr)
|
||||
-{
|
||||
- virCCWDeviceAddress ccwaddr = *addr;
|
||||
-
|
||||
- /* We are not touching subchannel sets and channel subsystems */
|
||||
- if (++ccwaddr.devno > VIR_CCW_DEVICE_MAX_DEVNO)
|
||||
- return -1;
|
||||
-
|
||||
- *addr = ccwaddr;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
int
|
||||
virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
|
||||
virDomainCCWAddressSet *addrs,
|
||||
@@ -1325,7 +1311,7 @@ virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
|
||||
return -1;
|
||||
|
||||
while (virHashLookup(addrs->defined, addr)) {
|
||||
- if (virDomainCCWAddressIncrement(&addrs->next) < 0) {
|
||||
+ if (virCCWDeviceAddressIncrement(&addrs->next) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("There are no more free CCW devnos."));
|
||||
return -1;
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index e8d3edb0fe..eb56292b34 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -1903,6 +1903,7 @@ virBufferVasprintf;
|
||||
|
||||
# util/virccw.h
|
||||
virCCWDeviceAddressAsString;
|
||||
+virCCWDeviceAddressIncrement;
|
||||
|
||||
|
||||
# util/vircgroup.h
|
||||
diff --git a/src/util/virccw.c b/src/util/virccw.c
|
||||
index 5a19d3a112..d14d432414 100644
|
||||
--- a/src/util/virccw.c
|
||||
+++ b/src/util/virccw.c
|
||||
@@ -27,3 +27,16 @@ virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
{
|
||||
return g_strdup_printf(VIR_CCW_DEVICE_ADDRESS_FMT, addr->cssid, addr->ssid, addr->devno);
|
||||
}
|
||||
+
|
||||
+int
|
||||
+virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr)
|
||||
+{
|
||||
+ virCCWDeviceAddress ccwaddr = *addr;
|
||||
+
|
||||
+ /* We are not touching subchannel sets and channel subsystems */
|
||||
+ if (++ccwaddr.devno > VIR_CCW_DEVICE_MAX_DEVNO)
|
||||
+ return -1;
|
||||
+
|
||||
+ *addr = ccwaddr;
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
index c3a47127f1..4c48c9605e 100644
|
||||
--- a/src/util/virccw.h
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -37,3 +37,4 @@ struct _virCCWDeviceAddress {
|
||||
|
||||
char* virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
+int virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr);
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
From a259f2fc77dac6fa2fd7910d4c96d231b0ea3182 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a259f2fc77dac6fa2fd7910d4c96d231b0ea3182@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:01 +0200
|
||||
Subject: [PATCH] util: refactor virDomainDeviceCCWAddress into virccw.h
|
||||
|
||||
Refactor ccw data structure virDomainDeviceCCWAddress into util virccw.h
|
||||
and rename it as virCCWDeviceAddress.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 45a8e3988f7b087b3b721e74ce5e6b5658b2b424)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/device_conf.c | 8 +++----
|
||||
src/conf/device_conf.h | 19 ++++++-----------
|
||||
src/conf/domain_addr.c | 6 +++---
|
||||
src/conf/domain_addr.h | 4 ++--
|
||||
src/conf/domain_conf.c | 6 +++---
|
||||
src/conf/domain_conf.h | 6 +++---
|
||||
src/node_device/node_device_driver.c | 2 +-
|
||||
src/qemu/qemu_agent.c | 4 ++--
|
||||
src/qemu/qemu_agent.h | 2 +-
|
||||
src/util/virccw.h | 31 ++++++++++++++++++++++++++++
|
||||
10 files changed, 56 insertions(+), 32 deletions(-)
|
||||
create mode 100644 src/util/virccw.h
|
||||
|
||||
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
||||
index cb523d3a0d..92b908b2e6 100644
|
||||
--- a/src/conf/device_conf.c
|
||||
+++ b/src/conf/device_conf.c
|
||||
@@ -259,7 +259,7 @@ virPCIDeviceAddressFormat(virBuffer *buf,
|
||||
}
|
||||
|
||||
bool
|
||||
-virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddress *addr)
|
||||
+virDomainDeviceCCWAddressIsValid(virCCWDeviceAddress *addr)
|
||||
{
|
||||
return addr->cssid <= VIR_DOMAIN_DEVICE_CCW_MAX_CSSID &&
|
||||
addr->ssid <= VIR_DOMAIN_DEVICE_CCW_MAX_SSID &&
|
||||
@@ -268,7 +268,7 @@ virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddress *addr)
|
||||
|
||||
int
|
||||
virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
- virDomainDeviceCCWAddress *addr)
|
||||
+ virCCWDeviceAddress *addr)
|
||||
{
|
||||
int cssid;
|
||||
int ssid;
|
||||
@@ -307,8 +307,8 @@ virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
}
|
||||
|
||||
bool
|
||||
-virDomainDeviceCCWAddressEqual(virDomainDeviceCCWAddress *addr1,
|
||||
- virDomainDeviceCCWAddress *addr2)
|
||||
+virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
|
||||
+ virCCWDeviceAddress *addr2)
|
||||
{
|
||||
if (addr1->cssid == addr2->cssid &&
|
||||
addr1->ssid == addr2->ssid &&
|
||||
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
||||
index b6b710d313..60d90bbf19 100644
|
||||
--- a/src/conf/device_conf.h
|
||||
+++ b/src/conf/device_conf.h
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "internal.h"
|
||||
#include "virthread.h"
|
||||
#include "virbuffer.h"
|
||||
+#include "virccw.h"
|
||||
#include "virpci.h"
|
||||
#include "virnetdev.h"
|
||||
#include "virenum.h"
|
||||
@@ -73,14 +74,6 @@ struct _virDomainDeviceVirtioSerialAddress {
|
||||
#define VIR_DOMAIN_DEVICE_CCW_MAX_SSID 3
|
||||
#define VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO 65535
|
||||
|
||||
-typedef struct _virDomainDeviceCCWAddress virDomainDeviceCCWAddress;
|
||||
-struct _virDomainDeviceCCWAddress {
|
||||
- unsigned int cssid;
|
||||
- unsigned int ssid;
|
||||
- unsigned int devno;
|
||||
- bool assigned;
|
||||
-};
|
||||
-
|
||||
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
|
||||
struct _virDomainDeviceCcidAddress {
|
||||
unsigned int controller;
|
||||
@@ -136,7 +129,7 @@ struct _virDomainDeviceInfo {
|
||||
virDomainDeviceCcidAddress ccid;
|
||||
virDomainDeviceUSBAddress usb;
|
||||
virDomainDeviceSpaprVioAddress spaprvio;
|
||||
- virDomainDeviceCCWAddress ccw;
|
||||
+ virCCWDeviceAddress ccw;
|
||||
virDomainDeviceISAAddress isa;
|
||||
virDomainDeviceDimmAddress dimm;
|
||||
} addr;
|
||||
@@ -204,11 +197,11 @@ void virPCIDeviceAddressFormat(virBuffer *buf,
|
||||
virPCIDeviceAddress addr,
|
||||
bool includeTypeInAddr);
|
||||
|
||||
-bool virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddress *addr);
|
||||
+bool virDomainDeviceCCWAddressIsValid(virCCWDeviceAddress *addr);
|
||||
int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
- virDomainDeviceCCWAddress *addr);
|
||||
-bool virDomainDeviceCCWAddressEqual(virDomainDeviceCCWAddress *addr1,
|
||||
- virDomainDeviceCCWAddress *addr2);
|
||||
+ virCCWDeviceAddress *addr);
|
||||
+bool virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
|
||||
+ virCCWDeviceAddress *addr2);
|
||||
#define VIR_CCW_DEVICE_ADDRESS_FMT "%x.%x.%04x"
|
||||
|
||||
int virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
|
||||
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
||||
index 49745ba881..d584d3b8a8 100644
|
||||
--- a/src/conf/domain_addr.c
|
||||
+++ b/src/conf/domain_addr.c
|
||||
@@ -1287,15 +1287,15 @@ virDomainPCIAddressSetAllMulti(virDomainDef *def)
|
||||
|
||||
|
||||
char*
|
||||
-virDomainCCWAddressAsString(virDomainDeviceCCWAddress *addr)
|
||||
+virDomainCCWAddressAsString(virCCWDeviceAddress *addr)
|
||||
{
|
||||
return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno);
|
||||
}
|
||||
|
||||
static int
|
||||
-virDomainCCWAddressIncrement(virDomainDeviceCCWAddress *addr)
|
||||
+virDomainCCWAddressIncrement(virCCWDeviceAddress *addr)
|
||||
{
|
||||
- virDomainDeviceCCWAddress ccwaddr = *addr;
|
||||
+ virCCWDeviceAddress ccwaddr = *addr;
|
||||
|
||||
/* We are not touching subchannel sets and channel subsystems */
|
||||
if (++ccwaddr.devno > VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO)
|
||||
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
|
||||
index 814b556024..c8d069e07e 100644
|
||||
--- a/src/conf/domain_addr.h
|
||||
+++ b/src/conf/domain_addr.h
|
||||
@@ -195,7 +195,7 @@ void virDomainPCIAddressSetAllMulti(virDomainDef *def)
|
||||
|
||||
struct _virDomainCCWAddressSet {
|
||||
GHashTable *defined;
|
||||
- virDomainDeviceCCWAddress next;
|
||||
+ virCCWDeviceAddress next;
|
||||
};
|
||||
typedef struct _virDomainCCWAddressSet virDomainCCWAddressSet;
|
||||
|
||||
@@ -205,7 +205,7 @@ int virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
void virDomainCCWAddressSetFree(virDomainCCWAddressSet *addrs);
|
||||
|
||||
-char* virDomainCCWAddressAsString(virDomainDeviceCCWAddress *addr)
|
||||
+char* virDomainCCWAddressAsString(virCCWDeviceAddress *addr)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
virDomainCCWAddressSet *
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 95afd9226e..ad3bd56da0 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -15541,7 +15541,7 @@ virDomainDiskControllerMatch(int controller_type, int disk_bus)
|
||||
int
|
||||
virDomainDiskIndexByAddress(virDomainDef *def,
|
||||
virPCIDeviceAddress *pci_address,
|
||||
- virDomainDeviceCCWAddress *ccw_addr,
|
||||
+ virCCWDeviceAddress *ccw_addr,
|
||||
unsigned int bus, unsigned int target,
|
||||
unsigned int unit)
|
||||
{
|
||||
@@ -15585,7 +15585,7 @@ virDomainDiskIndexByAddress(virDomainDef *def,
|
||||
virDomainDiskDef *
|
||||
virDomainDiskByAddress(virDomainDef *def,
|
||||
virPCIDeviceAddress *pci_address,
|
||||
- virDomainDeviceCCWAddress *ccw_addr,
|
||||
+ virCCWDeviceAddress *ccw_addr,
|
||||
unsigned int bus,
|
||||
unsigned int target,
|
||||
unsigned int unit)
|
||||
@@ -16184,7 +16184,7 @@ virDomainControllerFindByType(virDomainDef *def,
|
||||
|
||||
int
|
||||
virDomainControllerFindByCCWAddress(virDomainDef *def,
|
||||
- virDomainDeviceCCWAddress *addr)
|
||||
+ virCCWDeviceAddress *addr)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 45976beb2b..930af36868 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -3622,12 +3622,12 @@ void virDomainRNGDefFree(virDomainRNGDef *def);
|
||||
|
||||
int virDomainDiskIndexByAddress(virDomainDef *def,
|
||||
virPCIDeviceAddress *pci_controller,
|
||||
- virDomainDeviceCCWAddress *ccw_addr,
|
||||
+ virCCWDeviceAddress *ccw_addr,
|
||||
unsigned int bus, unsigned int target,
|
||||
unsigned int unit);
|
||||
virDomainDiskDef *virDomainDiskByAddress(virDomainDef *def,
|
||||
virPCIDeviceAddress *pci_controller,
|
||||
- virDomainDeviceCCWAddress *ccw_addr,
|
||||
+ virCCWDeviceAddress *ccw_addr,
|
||||
unsigned int bus,
|
||||
unsigned int target,
|
||||
unsigned int unit);
|
||||
@@ -3712,7 +3712,7 @@ void virDomainControllerInsertPreAlloced(virDomainDef *def,
|
||||
int virDomainControllerFind(const virDomainDef *def, int type, int idx);
|
||||
int virDomainControllerFindByType(virDomainDef *def, int type);
|
||||
int virDomainControllerFindByCCWAddress(virDomainDef *def,
|
||||
- virDomainDeviceCCWAddress *addr);
|
||||
+ virCCWDeviceAddress *addr);
|
||||
int virDomainControllerFindByPCIAddress(virDomainDef *def,
|
||||
virPCIDeviceAddress *addr);
|
||||
int virDomainControllerFindUnusedIndex(virDomainDef const *def, int type);
|
||||
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
|
||||
index d19ed7d948..b0abf59618 100644
|
||||
--- a/src/node_device/node_device_driver.c
|
||||
+++ b/src/node_device/node_device_driver.c
|
||||
@@ -676,7 +676,7 @@ nodeDeviceObjFormatAddress(virNodeDeviceObj *obj)
|
||||
}
|
||||
|
||||
case VIR_NODE_DEV_CAP_CSS_DEV: {
|
||||
- virDomainDeviceCCWAddress ccw_addr = {
|
||||
+ virCCWDeviceAddress ccw_addr = {
|
||||
.cssid = caps->data.ccw_dev.cssid,
|
||||
.ssid = caps->data.ccw_dev.ssid,
|
||||
.devno = caps->data.ccw_dev.devno
|
||||
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
|
||||
index 8a55044c9e..db844148a6 100644
|
||||
--- a/src/qemu/qemu_agent.c
|
||||
+++ b/src/qemu/qemu_agent.c
|
||||
@@ -1769,9 +1769,9 @@ qemuAgentGetDiskAddress(virJSONValue *json)
|
||||
GET_DISK_ADDR(pci, &addr->pci_controller.function, "function");
|
||||
|
||||
if ((ccw = virJSONValueObjectGet(json, "ccw-address"))) {
|
||||
- g_autofree virDomainDeviceCCWAddress *ccw_addr = NULL;
|
||||
+ g_autofree virCCWDeviceAddress *ccw_addr = NULL;
|
||||
|
||||
- ccw_addr = g_new0(virDomainDeviceCCWAddress, 1);
|
||||
+ ccw_addr = g_new0(virCCWDeviceAddress, 1);
|
||||
|
||||
GET_DISK_ADDR(ccw, &ccw_addr->cssid, "cssid");
|
||||
if (ccw_addr->cssid == 0) /* Guest CSSID 0 is 0xfe on host */
|
||||
diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h
|
||||
index 862f6b0a95..c07d8507ba 100644
|
||||
--- a/src/qemu/qemu_agent.h
|
||||
+++ b/src/qemu/qemu_agent.h
|
||||
@@ -72,7 +72,7 @@ struct _qemuAgentDiskAddress {
|
||||
unsigned int target;
|
||||
unsigned int unit;
|
||||
char *devnode;
|
||||
- virDomainDeviceCCWAddress *ccw_addr;
|
||||
+ virCCWDeviceAddress *ccw_addr;
|
||||
};
|
||||
void qemuAgentDiskAddressFree(qemuAgentDiskAddress *addr);
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuAgentDiskAddress, qemuAgentDiskAddressFree);
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
new file mode 100644
|
||||
index 0000000000..701e13284b
|
||||
--- /dev/null
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -0,0 +1,31 @@
|
||||
+/*
|
||||
+ * virccw.h: helper APIs for managing host CCW devices
|
||||
+ *
|
||||
+ * Copyright (C) 2022 IBM Corporation
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library. If not, see
|
||||
+ * <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include "internal.h"
|
||||
+
|
||||
+typedef struct _virCCWDeviceAddress virCCWDeviceAddress;
|
||||
+struct _virCCWDeviceAddress {
|
||||
+ unsigned int cssid;
|
||||
+ unsigned int ssid;
|
||||
+ unsigned int devno;
|
||||
+ bool assigned;
|
||||
+};
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
From 71f605aed8cb1f27eef21953005b3251e41e1925 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <71f605aed8cb1f27eef21953005b3251e41e1925@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:07 +0200
|
||||
Subject: [PATCH] util: refactor virDomainDeviceCCWAddressEqual into virccw
|
||||
|
||||
Refactor virDomainDeviceCCWAddressEqual into virccw and rename method as
|
||||
virCCWDeviceAddressEqual.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 784b87603517bd920910ccfb69daae8980a21d8d)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/device_conf.c | 12 ------------
|
||||
src/conf/device_conf.h | 2 --
|
||||
src/conf/domain_conf.c | 8 ++++----
|
||||
src/libvirt_private.syms | 2 +-
|
||||
src/util/virccw.c | 12 ++++++++++++
|
||||
src/util/virccw.h | 2 ++
|
||||
6 files changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
||||
index 2385e81994..958e2f43cc 100644
|
||||
--- a/src/conf/device_conf.c
|
||||
+++ b/src/conf/device_conf.c
|
||||
@@ -298,18 +298,6 @@ virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-bool
|
||||
-virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
|
||||
- virCCWDeviceAddress *addr2)
|
||||
-{
|
||||
- if (addr1->cssid == addr2->cssid &&
|
||||
- addr1->ssid == addr2->ssid &&
|
||||
- addr1->devno == addr2->devno) {
|
||||
- return true;
|
||||
- }
|
||||
- return false;
|
||||
-}
|
||||
-
|
||||
int
|
||||
virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
|
||||
virDomainDeviceDriveAddress *addr)
|
||||
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
||||
index 0ed6991c23..01e2edccc9 100644
|
||||
--- a/src/conf/device_conf.h
|
||||
+++ b/src/conf/device_conf.h
|
||||
@@ -195,8 +195,6 @@ void virPCIDeviceAddressFormat(virBuffer *buf,
|
||||
|
||||
int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
virCCWDeviceAddress *addr);
|
||||
-bool virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
|
||||
- virCCWDeviceAddress *addr2);
|
||||
|
||||
int virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
|
||||
virDomainDeviceDriveAddress *addr);
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 17383fc878..1e1c7f01b1 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -15566,7 +15566,7 @@ virDomainDiskIndexByAddress(virDomainDef *def,
|
||||
return i;
|
||||
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
||||
ccw_addr &&
|
||||
- virDomainDeviceCCWAddressEqual(&vdisk->info.addr.ccw, ccw_addr)) {
|
||||
+ virCCWDeviceAddressEqual(&vdisk->info.addr.ccw, ccw_addr)) {
|
||||
return i;
|
||||
}
|
||||
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
||||
@@ -15755,8 +15755,8 @@ virDomainNetFindIdx(virDomainDef *def, virDomainNetDef *net)
|
||||
continue;
|
||||
|
||||
if (CCWAddrSpecified &&
|
||||
- !virDomainDeviceCCWAddressEqual(&def->nets[i]->info.addr.ccw,
|
||||
- &net->info.addr.ccw))
|
||||
+ !virCCWDeviceAddressEqual(&def->nets[i]->info.addr.ccw,
|
||||
+ &net->info.addr.ccw))
|
||||
continue;
|
||||
|
||||
if (net->info.alias && def->nets[i]->info.alias &&
|
||||
@@ -16192,7 +16192,7 @@ virDomainControllerFindByCCWAddress(virDomainDef *def,
|
||||
virDomainDeviceInfo *info = &def->controllers[i]->info;
|
||||
|
||||
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
||||
- virDomainDeviceCCWAddressEqual(&info->addr.ccw, addr))
|
||||
+ virCCWDeviceAddressEqual(&info->addr.ccw, addr))
|
||||
return i;
|
||||
}
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 9ed367d427..0d3ee4c20a 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -131,7 +131,6 @@ virDeviceInfoPCIAddressIsWanted;
|
||||
virDomainDeviceAddressIsValid;
|
||||
virDomainDeviceAddressTypeToString;
|
||||
virDomainDeviceCcidAddressParseXML;
|
||||
-virDomainDeviceCCWAddressEqual;
|
||||
virDomainDeviceCCWAddressParseXML;
|
||||
virDomainDeviceDriveAddressParseXML;
|
||||
virDomainDeviceInfoAddressIsEqual;
|
||||
@@ -1902,6 +1901,7 @@ virBufferVasprintf;
|
||||
|
||||
# util/virccw.h
|
||||
virCCWDeviceAddressAsString;
|
||||
+virCCWDeviceAddressEqual;
|
||||
virCCWDeviceAddressIncrement;
|
||||
virCCWDeviceAddressIsValid;
|
||||
|
||||
diff --git a/src/util/virccw.c b/src/util/virccw.c
|
||||
index c3dfda2613..e2785bd9ab 100644
|
||||
--- a/src/util/virccw.c
|
||||
+++ b/src/util/virccw.c
|
||||
@@ -30,6 +30,18 @@ virCCWDeviceAddressIsValid(virCCWDeviceAddress *addr)
|
||||
addr->devno <= VIR_CCW_DEVICE_MAX_DEVNO;
|
||||
}
|
||||
|
||||
+bool
|
||||
+virCCWDeviceAddressEqual(virCCWDeviceAddress *addr1,
|
||||
+ virCCWDeviceAddress *addr2)
|
||||
+{
|
||||
+ if (addr1->cssid == addr2->cssid &&
|
||||
+ addr1->ssid == addr2->ssid &&
|
||||
+ addr1->devno == addr2->devno) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
char*
|
||||
virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
{
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
index c4daaff7b3..aebbd4ab6d 100644
|
||||
--- a/src/util/virccw.h
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -36,6 +36,8 @@ struct _virCCWDeviceAddress {
|
||||
};
|
||||
|
||||
bool virCCWDeviceAddressIsValid(virCCWDeviceAddress *addr);
|
||||
+bool virCCWDeviceAddressEqual(virCCWDeviceAddress *addr1,
|
||||
+ virCCWDeviceAddress *addr2);
|
||||
|
||||
char* virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
From 3de657416726803a56fb5b025396bccdd8bfa955 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <3de657416726803a56fb5b025396bccdd8bfa955@dist-git>
|
||||
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Date: Fri, 13 May 2022 12:31:06 +0200
|
||||
Subject: [PATCH] util: refactor virDomainDeviceCCWAddressIsValid into virccw
|
||||
|
||||
Refactor virDomainDeviceCCWAddressIsValid into virccw and rename method
|
||||
as virCCWDeviceAddressIsValid.
|
||||
|
||||
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 38756ce5ba17d31597a3470d07708a21bf460c9b)
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/conf/device_conf.c | 12 ++----------
|
||||
src/conf/device_conf.h | 1 -
|
||||
src/libvirt_private.syms | 2 +-
|
||||
src/util/virccw.c | 8 ++++++++
|
||||
src/util/virccw.h | 2 ++
|
||||
5 files changed, 13 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
|
||||
index bdc9219f84..2385e81994 100644
|
||||
--- a/src/conf/device_conf.c
|
||||
+++ b/src/conf/device_conf.c
|
||||
@@ -258,14 +258,6 @@ virPCIDeviceAddressFormat(virBuffer *buf,
|
||||
addr.function);
|
||||
}
|
||||
|
||||
-bool
|
||||
-virDomainDeviceCCWAddressIsValid(virCCWDeviceAddress *addr)
|
||||
-{
|
||||
- return addr->cssid <= VIR_CCW_DEVICE_MAX_CSSID &&
|
||||
- addr->ssid <= VIR_CCW_DEVICE_MAX_SSID &&
|
||||
- addr->devno <= VIR_CCW_DEVICE_MAX_DEVNO;
|
||||
-}
|
||||
-
|
||||
int
|
||||
virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
virCCWDeviceAddress *addr)
|
||||
@@ -288,7 +280,7 @@ virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
&addr->devno)) < 0)
|
||||
return -1;
|
||||
|
||||
- if (!virDomainDeviceCCWAddressIsValid(addr)) {
|
||||
+ if (!virCCWDeviceAddressIsValid(addr)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid specification for virtio ccw address: cssid='0x%x' ssid='0x%x' devno='0x%04x'"),
|
||||
addr->cssid, addr->ssid, addr->devno);
|
||||
@@ -453,7 +445,7 @@ virDomainDeviceAddressIsValid(virDomainDeviceInfo *info,
|
||||
return true;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
|
||||
- return virDomainDeviceCCWAddressIsValid(&info->addr.ccw);
|
||||
+ return virCCWDeviceAddressIsValid(&info->addr.ccw);
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB:
|
||||
return true;
|
||||
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
|
||||
index 5c4b7b2f8e..0ed6991c23 100644
|
||||
--- a/src/conf/device_conf.h
|
||||
+++ b/src/conf/device_conf.h
|
||||
@@ -193,7 +193,6 @@ void virPCIDeviceAddressFormat(virBuffer *buf,
|
||||
virPCIDeviceAddress addr,
|
||||
bool includeTypeInAddr);
|
||||
|
||||
-bool virDomainDeviceCCWAddressIsValid(virCCWDeviceAddress *addr);
|
||||
int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
|
||||
virCCWDeviceAddress *addr);
|
||||
bool virDomainDeviceCCWAddressEqual(virCCWDeviceAddress *addr1,
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index eb56292b34..9ed367d427 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -132,7 +132,6 @@ virDomainDeviceAddressIsValid;
|
||||
virDomainDeviceAddressTypeToString;
|
||||
virDomainDeviceCcidAddressParseXML;
|
||||
virDomainDeviceCCWAddressEqual;
|
||||
-virDomainDeviceCCWAddressIsValid;
|
||||
virDomainDeviceCCWAddressParseXML;
|
||||
virDomainDeviceDriveAddressParseXML;
|
||||
virDomainDeviceInfoAddressIsEqual;
|
||||
@@ -1904,6 +1903,7 @@ virBufferVasprintf;
|
||||
# util/virccw.h
|
||||
virCCWDeviceAddressAsString;
|
||||
virCCWDeviceAddressIncrement;
|
||||
+virCCWDeviceAddressIsValid;
|
||||
|
||||
|
||||
# util/vircgroup.h
|
||||
diff --git a/src/util/virccw.c b/src/util/virccw.c
|
||||
index d14d432414..c3dfda2613 100644
|
||||
--- a/src/util/virccw.c
|
||||
+++ b/src/util/virccw.c
|
||||
@@ -22,6 +22,14 @@
|
||||
#include "virccw.h"
|
||||
|
||||
|
||||
+bool
|
||||
+virCCWDeviceAddressIsValid(virCCWDeviceAddress *addr)
|
||||
+{
|
||||
+ return addr->cssid <= VIR_CCW_DEVICE_MAX_CSSID &&
|
||||
+ addr->ssid <= VIR_CCW_DEVICE_MAX_SSID &&
|
||||
+ addr->devno <= VIR_CCW_DEVICE_MAX_DEVNO;
|
||||
+}
|
||||
+
|
||||
char*
|
||||
virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
{
|
||||
diff --git a/src/util/virccw.h b/src/util/virccw.h
|
||||
index 4c48c9605e..c4daaff7b3 100644
|
||||
--- a/src/util/virccw.h
|
||||
+++ b/src/util/virccw.h
|
||||
@@ -35,6 +35,8 @@ struct _virCCWDeviceAddress {
|
||||
bool assigned;
|
||||
};
|
||||
|
||||
+bool virCCWDeviceAddressIsValid(virCCWDeviceAddress *addr);
|
||||
+
|
||||
char* virCCWDeviceAddressAsString(virCCWDeviceAddress *addr)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
int virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr);
|
||||
--
|
||||
2.39.1
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
From 41247c87fd47f2e55825d62c697da810ba5062f5 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <41247c87fd47f2e55825d62c697da810ba5062f5@dist-git>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Tue, 14 Jun 2022 13:13:48 +0200
|
||||
Subject: [PATCH] virDomainDiskDefValidate: Improve error messages for
|
||||
'startupPolicy' checks
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Remove linebreak and mention the attribute name. Also prepare the error
|
||||
messages for future by substituting the type of offending access.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 9a480737c8adf92c332aa850c5269191ceb04eb9)
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2095758
|
||||
---
|
||||
src/conf/domain_validate.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
|
||||
index a4271f1247..452742e67c 100644
|
||||
--- a/src/conf/domain_validate.c
|
||||
+++ b/src/conf/domain_validate.c
|
||||
@@ -778,9 +778,9 @@ virDomainDiskDefValidate(const virDomainDef *def,
|
||||
if (disk->startupPolicy != VIR_DOMAIN_STARTUP_POLICY_DEFAULT) {
|
||||
if (disk->src->type == VIR_STORAGE_TYPE_NETWORK) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
- _("Setting disk %s is not allowed for "
|
||||
- "disk of network type"),
|
||||
- virDomainStartupPolicyTypeToString(disk->startupPolicy));
|
||||
+ _("disk startupPolicy '%s' is not allowed for disk of '%s' type"),
|
||||
+ virDomainStartupPolicyTypeToString(disk->startupPolicy),
|
||||
+ virStorageTypeToString(disk->src->type));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -788,8 +788,7 @@ virDomainDiskDefValidate(const virDomainDef *def,
|
||||
disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
|
||||
disk->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_REQUISITE) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
- _("Setting disk 'requisite' is allowed only for "
|
||||
- "cdrom or floppy"));
|
||||
+ _("disk startupPolicy 'requisite' is allowed only for cdrom or floppy"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue