diff --git a/libvirt-build-Only-install-libvirt-guests-when-building-libvirtd.patch b/libvirt-build-Only-install-libvirt-guests-when-building-libvirtd.patch new file mode 100644 index 0000000000000000000000000000000000000000..90206d34add13956bd6438ea954aabc97d29b28c --- /dev/null +++ b/libvirt-build-Only-install-libvirt-guests-when-building-libvirtd.patch @@ -0,0 +1,75 @@ +From a4fc108994dd64e0880be10b93b48830f32907de Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jim Fehlig +Date: Mon, 10 Jan 2022 11:42:58 -0700 +Subject: [PATCH] build: Only install libvirt-guests when building libvirtd + +libvirt-guests was already moved to the libvirt daemon package in commit +d800c50349. It only needs to be installed when building libvirtd. + +Signed-off-by: Jim Fehlig +Reviewed-by: Andrea Bolognani +(cherry picked from commit 3be5ba11a2c6fcb2dfdffa03ab4f847113f36b85) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2157091 +Signed-off-by: Michal Privoznik +--- + tools/meson.build | 38 ++++++++++++++++++++------------------ + 1 file changed, 20 insertions(+), 18 deletions(-) + +diff --git a/tools/meson.build b/tools/meson.build +index 22fa3604ba..2d0aecb90b 100644 +--- a/tools/meson.build ++++ b/tools/meson.build +@@ -297,29 +297,31 @@ if conf.has('WITH_SANLOCK') + ) + endif + +-configure_file( +- input: 'libvirt-guests.sh.in', +- output: '@BASENAME@', +- configuration: tools_conf, +- install: true, +- install_dir: libexecdir, +- install_mode: 'rwxrwxr-x', +-) +- +-if init_script == 'systemd' +- install_data( +- 'libvirt-guests.sysconf', +- install_dir: sysconfdir / 'sysconfig', +- rename: 'libvirt-guests', +- ) +- ++if conf.has('WITH_LIBVIRTD') + configure_file( +- input: 'libvirt-guests.service.in', ++ input: 'libvirt-guests.sh.in', + output: '@BASENAME@', + configuration: tools_conf, + install: true, +- install_dir: prefix / 'lib' / 'systemd' / 'system', ++ install_dir: libexecdir, ++ install_mode: 'rwxrwxr-x', + ) ++ ++ 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@', ++ configuration: tools_conf, ++ install: true, ++ install_dir: prefix / 'lib' / 'systemd' / 'system', ++ ) ++ endif + endif + + if bash_completion_dep.found() +-- +2.39.0 + diff --git a/libvirt-conf-Make-VIR_DOMAIN_NET_TYPE_ETHERNET-not-share-host-view.patch b/libvirt-conf-Make-VIR_DOMAIN_NET_TYPE_ETHERNET-not-share-host-view.patch new file mode 100644 index 0000000000000000000000000000000000000000..1c7bab7472ff06b0a904cd929f062eedd04891c4 --- /dev/null +++ b/libvirt-conf-Make-VIR_DOMAIN_NET_TYPE_ETHERNET-not-share-host-view.patch @@ -0,0 +1,46 @@ +From facb1f67ffca12cbe87abb50f1900956624c9774 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +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 , 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 -s: +one type of network, the other of type ethernet and configure the +same for both. Reversed setting can then be observed +(e.g. via tc). + +Reported-by: Oleg Vasilev +Signed-off-by: Michal Privoznik +Reviewed-by: Jiri Denemark +(cherry picked from commit 0862cb3ce46253a58ca02d36b2b6a6397a60bfc7) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2173976 +Signed-off-by: Michal Privoznik +--- + 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 95afd9226e..b3bc027fd9 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -30473,9 +30473,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 + diff --git a/libvirt-qemuAgentGetDisks-Don-t-use-virJSONValueObjectGetStringArray-for-optional-data.patch b/libvirt-qemuAgentGetDisks-Don-t-use-virJSONValueObjectGetStringArray-for-optional-data.patch new file mode 100644 index 0000000000000000000000000000000000000000..92450afba9e6b612e50e44ab769c559033fb086b --- /dev/null +++ b/libvirt-qemuAgentGetDisks-Don-t-use-virJSONValueObjectGetStringArray-for-optional-data.patch @@ -0,0 +1,58 @@ +From 6725459d1b7d326b65ce4f19640a49851b54ae9b Mon Sep 17 00:00:00 2001 +Message-Id: <6725459d1b7d326b65ce4f19640a49851b54ae9b@dist-git> +From: Peter Krempa +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 +Reviewed-by: Michal Privoznik +(cherry picked from commit 3b576601dfb924bb518870a01de5d1a421cbb467) +https://bugzilla.redhat.com/show_bug.cgi?id=2152079 +--- + 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 + diff --git a/libvirt-qemuProcessReconnect-Don-t-build-memory-paths.patch b/libvirt-qemuProcessReconnect-Don-t-build-memory-paths.patch new file mode 100644 index 0000000000000000000000000000000000000000..60b9b5f3cc4134a599f72c3f61e43e5a55f06f58 --- /dev/null +++ b/libvirt-qemuProcessReconnect-Don-t-build-memory-paths.patch @@ -0,0 +1,57 @@ +From 10d13b42fdec802e07b00825058d3e33ee843f50 Mon Sep 17 00:00:00 2001 +Message-Id: <10d13b42fdec802e07b00825058d3e33ee843f50@dist-git> +From: Michal Privoznik +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 +Reviewed-by: Ján Tomko +(cherry picked from commit 3478cca80ea7382cfdbff836d5d0b92aa014297b) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2132176 +Signed-off-by: Michal Privoznik +--- + 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.1 + diff --git a/libvirt-qemu_namespace-Fix-a-corner-case-in-qemuDomainGetPreservedMounts.patch b/libvirt-qemu_namespace-Fix-a-corner-case-in-qemuDomainGetPreservedMounts.patch new file mode 100644 index 0000000000000000000000000000000000000000..c82b2d5e5bebcfc7ca14779f40f3f1e899d01e7c --- /dev/null +++ b/libvirt-qemu_namespace-Fix-a-corner-case-in-qemuDomainGetPreservedMounts.patch @@ -0,0 +1,80 @@ +From 8283452dfdc2d33b717b81f9a011dc95aa9017e3 Mon Sep 17 00:00:00 2001 +Message-Id: <8283452dfdc2d33b717b81f9a011dc95aa9017e3@dist-git> +From: Michal Privoznik +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 +Reviewed-by: Martin Kletzander +(cherry picked from commit 46b03819ae8d833b11c2aaccb2c2a0361727f51b) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2132176 +Signed-off-by: Michal Privoznik +--- + 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.1 + diff --git a/libvirt-qemu_namespace-Introduce-qemuDomainNamespaceSetupPath.patch b/libvirt-qemu_namespace-Introduce-qemuDomainNamespaceSetupPath.patch new file mode 100644 index 0000000000000000000000000000000000000000..7fc45c2cccfbe156db03e2a38899da93423bc63a --- /dev/null +++ b/libvirt-qemu_namespace-Introduce-qemuDomainNamespaceSetupPath.patch @@ -0,0 +1,68 @@ +From 1772cf15e26cc620f71513689f2ac2409a22df93 Mon Sep 17 00:00:00 2001 +Message-Id: <1772cf15e26cc620f71513689f2ac2409a22df93@dist-git> +From: Michal Privoznik +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 +Reviewed-by: Martin Kletzander +(cherry picked from commit 5853d707189005a4ea5b2215e80853867b822fd9) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2132176 +Signed-off-by: Michal Privoznik +--- + 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.1 + diff --git a/libvirt-qemu_namespace-Tolerate-missing-ACLs-when-creating-a-path-in-namespace.patch b/libvirt-qemu_namespace-Tolerate-missing-ACLs-when-creating-a-path-in-namespace.patch new file mode 100644 index 0000000000000000000000000000000000000000..6796a0ae9aa7d29a4cf2e3406cb27e3f9f079b86 --- /dev/null +++ b/libvirt-qemu_namespace-Tolerate-missing-ACLs-when-creating-a-path-in-namespace.patch @@ -0,0 +1,45 @@ +From a3fac9a9faf966abd77d63d064eef9d29337fd20 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +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 +Reviewed-by: Martin Kletzander +(cherry picked from commit 687374959e160dc566bd4b6d43c7bf1beb470c59) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2132176 +Signed-off-by: Michal Privoznik +--- + 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.1 + diff --git a/libvirt-qemu_process-Don-t-require-a-hugetlbfs-mount-for-memfd.patch b/libvirt-qemu_process-Don-t-require-a-hugetlbfs-mount-for-memfd.patch new file mode 100644 index 0000000000000000000000000000000000000000..05516dce34fbce507b5e11c2037e59691dcd696a --- /dev/null +++ b/libvirt-qemu_process-Don-t-require-a-hugetlbfs-mount-for-memfd.patch @@ -0,0 +1,50 @@ +From 51034fde2272e6d7855433ac8ef79ffa59ac14a7 Mon Sep 17 00:00:00 2001 +Message-Id: <51034fde2272e6d7855433ac8ef79ffa59ac14a7@dist-git> +From: Michal Privoznik +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 +Reviewed-by: Martin Kletzander +(cherry picked from commit f14f8dff9330ed51d817f190a2ee9ac76dfac00b) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2132176 +Signed-off-by: Michal Privoznik +--- + 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.1 + diff --git a/libvirt-qemu_process.c-Propagate-hugetlbfs-mounts-on-reconnect.patch b/libvirt-qemu_process.c-Propagate-hugetlbfs-mounts-on-reconnect.patch new file mode 100644 index 0000000000000000000000000000000000000000..f42e6d8b8c7a03aff4fb660abb277db093c23e84 --- /dev/null +++ b/libvirt-qemu_process.c-Propagate-hugetlbfs-mounts-on-reconnect.patch @@ -0,0 +1,65 @@ +From 39c959670a3aa3bfcd410c46d3af6a8eb2810cc4 Mon Sep 17 00:00:00 2001 +Message-Id: <39c959670a3aa3bfcd410c46d3af6a8eb2810cc4@dist-git> +From: Michal Privoznik +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 +Reviewed-by: Martin Kletzander +(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=2132176 +Signed-off-by: Michal Privoznik +--- + 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.1 + diff --git a/libvirt-tools-Fix-install_mode-for-some-scripts.patch b/libvirt-tools-Fix-install_mode-for-some-scripts.patch new file mode 100644 index 0000000000000000000000000000000000000000..5fe194aa584d2e3b085d965f9854d7e946fb0bf8 --- /dev/null +++ b/libvirt-tools-Fix-install_mode-for-some-scripts.patch @@ -0,0 +1,65 @@ +From 5f671e3950e5ac3da2989ebd62c5694c66e6cd68 Mon Sep 17 00:00:00 2001 +Message-Id: <5f671e3950e5ac3da2989ebd62c5694c66e6cd68@dist-git> +From: Michal Privoznik +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 +Reviewed-by: Peter Krempa +Reviewed-by: Jiri Denemark +(cherry picked from commit e771e32f15ff2b263ca70306d93080541a96792b) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2157091 +Signed-off-by: Michal Privoznik +--- + 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 + diff --git a/libvirt-util-json-Split-out-array-strinlist-conversion-from-virJSONValueObjectGetStringArray.patch b/libvirt-util-json-Split-out-array-strinlist-conversion-from-virJSONValueObjectGetStringArray.patch new file mode 100644 index 0000000000000000000000000000000000000000..fd230a1141e0f97c546513dcfcbe09cd00a69b89 --- /dev/null +++ b/libvirt-util-json-Split-out-array-strinlist-conversion-from-virJSONValueObjectGetStringArray.patch @@ -0,0 +1,124 @@ +From de2fa128a683f6a08b2d3fe95fc7857faed03cbf Mon Sep 17 00:00:00 2001 +Message-Id: +From: Peter Krempa +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 +Reviewed-by: Michal Privoznik +(cherry picked from commit 6765bdeaf7e9cbdb4c39d47f3b77fb28a498408a) +https://bugzilla.redhat.com/show_bug.cgi?id=2152079 +--- + 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 + diff --git a/libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch b/libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch new file mode 100644 index 0000000000000000000000000000000000000000..ea4e7d5d0514e17dce54a9d4ac218f779d07ee94 --- /dev/null +++ b/libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch @@ -0,0 +1,65 @@ +From e37daa747c6615da25a9285be580a05081b14993 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Fri, 8 Jul 2022 14:29:32 +0200 +Subject: [PATCH] vircpi: Add PCIe 5.0 and 6.0 link speeds +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The PCIe 5.0 and PCIe 6.0 standards define new link speeds: +32GT/s and 64GT/s, respectively. Update our internal enum to +include these new speeds. Otherwise we format incorrect XML: + + + + + + +Like all "good" specifications, these are also locked behind a +login portal. But we can look at pciutils' source code: [1] and +[2]. + +1: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=caca31a0eea41c7b051705704c1158fddc02fbd2 +2: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=5bdf63b6b1bc35b59c4b3f47f7ca83ca1868155b + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2105231 +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit d33c2a9e2f933b31f8e96e9938c237bdffe27f84) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2170233 +Signed-off-by: Michal Privoznik +--- + src/util/virpci.c | 2 +- + src/util/virpci.h | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/util/virpci.c b/src/util/virpci.c +index 0d476cd8b4..4949d1a3d4 100644 +--- a/src/util/virpci.c ++++ b/src/util/virpci.c +@@ -46,7 +46,7 @@ VIR_LOG_INIT("util.pci"); + + VIR_ENUM_IMPL(virPCIELinkSpeed, + VIR_PCIE_LINK_SPEED_LAST, +- "", "2.5", "5", "8", "16", ++ "", "2.5", "5", "8", "16", "32", "64" + ); + + VIR_ENUM_IMPL(virPCIStubDriver, +diff --git a/src/util/virpci.h b/src/util/virpci.h +index b9b9cd7b34..4d9193f24e 100644 +--- a/src/util/virpci.h ++++ b/src/util/virpci.h +@@ -83,6 +83,8 @@ typedef enum { + VIR_PCIE_LINK_SPEED_5, + VIR_PCIE_LINK_SPEED_8, + VIR_PCIE_LINK_SPEED_16, ++ VIR_PCIE_LINK_SPEED_32, ++ VIR_PCIE_LINK_SPEED_64, + VIR_PCIE_LINK_SPEED_LAST + } virPCIELinkSpeed; + +-- +2.39.1 + diff --git a/libvirt.spec b/libvirt.spec index 061e5d77b4f38d94ab9b33eab663bca34092bc18..7205bc928a1477ba5b4262be2ac104f5e7e45a1b 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -211,7 +211,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 8.0.0 -Release: 10%{anolis_release}%{?dist}%{?extra_release} +Release: 10.4%{anolis_release}%{?dist}%{?extra_release} License: LGPLv2+ URL: https://libvirt.org/ @@ -268,6 +268,18 @@ Patch44: libvirt-virsh-Add-support-for-VIR_MIGRATE_ZEROCOPY-flag.patch Patch45: libvirt-qemu_migration-Implement-VIR_MIGRATE_ZEROCOPY-flag.patch Patch46: libvirt-security_selinux.c-Relabel-existing-mode-bind-UNIX-sockets.patch Patch47: libvirt-RHEL-qemu_migration-Fix-restoring-memlock-limit-on-destination.patch +Patch48: libvirt-qemu_process-Don-t-require-a-hugetlbfs-mount-for-memfd.patch +Patch49: libvirt-qemu_namespace-Tolerate-missing-ACLs-when-creating-a-path-in-namespace.patch +Patch50: libvirt-qemu_namespace-Fix-a-corner-case-in-qemuDomainGetPreservedMounts.patch +Patch51: libvirt-qemu_namespace-Introduce-qemuDomainNamespaceSetupPath.patch +Patch52: libvirt-qemu_process.c-Propagate-hugetlbfs-mounts-on-reconnect.patch +Patch53: libvirt-qemuProcessReconnect-Don-t-build-memory-paths.patch +Patch54: libvirt-util-json-Split-out-array-strinlist-conversion-from-virJSONValueObjectGetStringArray.patch +Patch55: libvirt-qemuAgentGetDisks-Don-t-use-virJSONValueObjectGetStringArray-for-optional-data.patch +Patch56: libvirt-build-Only-install-libvirt-guests-when-building-libvirtd.patch +Patch57: libvirt-tools-Fix-install_mode-for-some-scripts.patch +Patch58: libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch +Patch59: libvirt-conf-Make-VIR_DOMAIN_NET_TYPE_ETHERNET-not-share-host-view.patch Patch1000: libvirt-Add-loongarch-support.patch Requires: libvirt-daemon = %{version}-%{release} @@ -2142,9 +2154,29 @@ exit 0 %changelog -* Tue Dec 27 2022 zhaotianrui - 8.0.0-10.0.1 +* Thu Apr 06 2023 zhaotianrui - 8.0.0-10.4.0.1 - Add loongarch support +* Thu Mar 2 2023 Jiri Denemark - 8.0.0-10.4.el8 +- conf: Make VIR_DOMAIN_NET_TYPE_ETHERNET not share 'host view' (rhbz#2173976) + +* Fri Feb 17 2023 Jiri Denemark - 8.0.0-10.3.el8 +- vircpi: Add PCIe 5.0 and 6.0 link speeds (rhbz#2170233) + +* Thu Jan 5 2023 Jiri Denemark - 8.0.0-10.2.el8 +- util: json: Split out array->strinlist conversion from virJSONValueObjectGetStringArray (rhbz#2152079) +- qemuAgentGetDisks: Don't use virJSONValueObjectGetStringArray for optional data (rhbz#2152079) +- build: Only install libvirt-guests when building libvirtd (rhbz#2157091) +- tools: Fix install_mode for some scripts (rhbz#2157091) + +* Wed Nov 9 2022 Jiri Denemark - 8.0.0-10.1.el8 +- qemu_process: Don't require a hugetlbfs mount for memfd (rhbz#2132176) +- qemu_namespace: Tolerate missing ACLs when creating a path in namespace (rhbz#2132176) +- qemu_namespace: Fix a corner case in qemuDomainGetPreservedMounts() (rhbz#2132176) +- qemu_namespace: Introduce qemuDomainNamespaceSetupPath() (rhbz#2132176) +- qemu_process.c: Propagate hugetlbfs mounts on reconnect (rhbz#2132176) +- qemuProcessReconnect: Don't build memory paths (rhbz#2132176) + * Mon Jul 25 2022 Jiri Denemark - 8.0.0-10 - security_selinux.c: Relabel existing mode="bind" UNIX sockets (rhbz#2101575) - RHEL: qemu_migration: Fix restoring memlock limit on destination (rhbz#2107954)