From 163b87484b7467d478fe72e45d5a078356008b85 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Oct 06 2023 00:59:33 +0000 Subject: [PATCH 1/19] libvirt-9.8.0-1 Update to version 9.8.0 --- diff --git a/libvirt.spec b/libvirt.spec index a648aeb..e5e2a54 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -128,7 +128,6 @@ %define with_vmware 0 %define with_libxl 0 %define with_hyperv 0 - %define with_vz 0 %define with_lxc 0 %endif @@ -228,7 +227,7 @@ Summary: Library providing a simple virtualization API Name: libvirt -Version: 9.7.0 +Version: 9.8.0 Release: 1%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -249,6 +248,7 @@ Requires: libvirt-daemon-driver-lxc = %{version}-%{release} %endif %if %{with_qemu} Requires: libvirt-daemon-driver-qemu = %{version}-%{release} +Requires: libvirt-client-qemu = %{version}-%{release} %endif # We had UML driver, but we've removed it. Obsoletes: libvirt-daemon-driver-uml <= 5.0.0 @@ -312,6 +312,7 @@ BuildRequires: util-linux BuildRequires: libacl-devel # From QEMU RPMs, used by virstoragetest BuildRequires: /usr/bin/qemu-img +BuildRequires: libnbd-devel %endif # For LVM drivers BuildRequires: lvm2 @@ -768,6 +769,9 @@ Requires: numad Recommends: passt Recommends: passt-selinux %endif +Recommends: nbdkit +Recommends: nbdkit-curl-plugin +Recommends: nbdkit-ssh-plugin %description daemon-driver-qemu The qemu driver plugin for the libvirtd daemon, providing @@ -1074,8 +1078,10 @@ exit 1 %if %{with_qemu} %define arg_qemu -Ddriver_qemu=enabled + %define arg_libnbd -Dlibnbd=enabled %else %define arg_qemu -Ddriver_qemu=disabled + %define arg_libnbd -Dlibnbd=disabled %endif %if %{with_openvz} @@ -1264,6 +1270,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dyajl=enabled \ %{?arg_sanlock} \ -Dlibpcap=enabled \ + %{?arg_libnbd} \ -Dlibnl=enabled \ -Daudit=enabled \ -Ddtrace=enabled \ @@ -1327,6 +1334,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dglusterfs=disabled \ -Dhost_validate=disabled \ -Dlibiscsi=disabled \ + -Dlibnbd=disabled \ -Dlibnl=disabled \ -Dlibpcap=disabled \ -Dlibssh2=disabled \ @@ -2470,6 +2478,9 @@ exit 0 %changelog +* Thu Oct 05 2023 Cole Robinson - 9.8.0-1 +- Update to version 9.8.0 + * Fri Sep 1 2023 Daniel P. Berrangé - 9.7.0-1 - Update to version 9.7.0 diff --git a/sources b/sources index 502c1a1..df8d712 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libvirt-9.7.0.tar.xz) = dd771822c0fa0861a32cab9d7f82235b101867fa0a4e8cf9a857ddfb2347e41b625b1e6f8791c4b3543fec836a1a23cae1fac4ce4b40debd51f2097bae46c949 +SHA512 (libvirt-9.8.0.tar.xz) = 0118725073de33eec3fa3e4616d3154707f9828fdb9ec973f503fe68f18eab72b9704da660f281152630ddc95e605c786673af9d23dc9bdfc0108422e0efbd41 From edf6aa6cd729d98aef329695bcc62934dea659ae Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Nov 01 2023 14:17:27 +0000 Subject: [PATCH 2/19] libvirt-9.9.0-1 Update to version 9.9.0 --- diff --git a/libvirt.spec b/libvirt.spec index e5e2a54..5c47994 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -95,6 +95,7 @@ %define with_fuse 0 %define with_sanlock 0 %define with_numad 0 +%define with_nbdkit 0 %define with_firewalld_zone 0 %define with_netcf 0 %define with_libssh2 0 @@ -173,6 +174,18 @@ %endif %endif +# We should only enable nbdkit support if the OS ships a SELinux policy that +# allows libvirt to launch it. Right now that's not the case anywhere, but +# things should be fine by the time Fedora 40 is released. +# +# TODO: add RHEL 9 once a minor release that contains the necessary SELinux +# bits exists (we only support the most recent minor release) +%if %{with_qemu} + %if 0%{?fedora} >= 40 + %define with_nbdkit 0%{!?_without_nbdkit:1} + %endif +%endif + %ifarch %{arches_dmidecode} %define with_dmidecode 0%{!?_without_dmidecode:1} %endif @@ -227,7 +240,7 @@ Summary: Library providing a simple virtualization API Name: libvirt -Version: 9.8.0 +Version: 9.9.0 Release: 1%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -312,6 +325,9 @@ BuildRequires: util-linux BuildRequires: libacl-devel # From QEMU RPMs, used by virstoragetest BuildRequires: /usr/bin/qemu-img +%endif +# nbdkit support requires libnbd +%if %{with_nbdkit} BuildRequires: libnbd-devel %endif # For LVM drivers @@ -769,9 +785,11 @@ Requires: numad Recommends: passt Recommends: passt-selinux %endif + %if %{with_nbdkit} Recommends: nbdkit Recommends: nbdkit-curl-plugin Recommends: nbdkit-ssh-plugin + %endif %description daemon-driver-qemu The qemu driver plugin for the libvirtd daemon, providing @@ -1078,10 +1096,8 @@ exit 1 %if %{with_qemu} %define arg_qemu -Ddriver_qemu=enabled - %define arg_libnbd -Dlibnbd=enabled %else %define arg_qemu -Ddriver_qemu=disabled - %define arg_libnbd -Dlibnbd=disabled %endif %if %{with_openvz} @@ -1158,6 +1174,12 @@ exit 1 %define arg_numad -Dnumad=disabled %endif +%if %{with_nbdkit} + %define arg_nbdkit -Dnbdkit=enabled +%else + %define arg_nbdkit -Dnbdkit=disabled +%endif + %if %{with_fuse} %define arg_fuse -Dfuse=enabled %else @@ -1270,7 +1292,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dyajl=enabled \ %{?arg_sanlock} \ -Dlibpcap=enabled \ - %{?arg_libnbd} \ + %{?arg_nbdkit} \ -Dlibnl=enabled \ -Daudit=enabled \ -Ddtrace=enabled \ @@ -1334,7 +1356,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dglusterfs=disabled \ -Dhost_validate=disabled \ -Dlibiscsi=disabled \ - -Dlibnbd=disabled \ + -Dnbdkit=disabled \ -Dlibnl=disabled \ -Dlibpcap=disabled \ -Dlibssh2=disabled \ @@ -2478,6 +2500,9 @@ exit 0 %changelog +* Wed Nov 01 2023 Cole Robinson - 9.9.0-1 +- Update to version 9.9.0 + * Thu Oct 05 2023 Cole Robinson - 9.8.0-1 - Update to version 9.8.0 diff --git a/sources b/sources index df8d712..8d03d10 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libvirt-9.8.0.tar.xz) = 0118725073de33eec3fa3e4616d3154707f9828fdb9ec973f503fe68f18eab72b9704da660f281152630ddc95e605c786673af9d23dc9bdfc0108422e0efbd41 +SHA512 (libvirt-9.9.0.tar.xz) = 77cea28acf4f3e8c92fbd5bd72ad084be183c07f14e3a9ce35d6d9d62d36ee97a30cef55fb204b3e43f282890ecd7d5827a784a517e7f4ed8b22ee502c3f09d7 From c879325741269f0a5af10726d184b93d47209f85 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Nov 01 2023 21:06:43 +0000 Subject: [PATCH 3/19] spec: Fix mingw build Signed-off-by: Cole Robinson --- diff --git a/libvirt.spec b/libvirt.spec index 5c47994..51d1113 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -1349,7 +1349,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Ddriver_vmware=disabled \ -Ddriver_vz=disabled \ -Ddtrace=disabled \ - -Dexpensive_tests=enabled \ + -Dexpensive_tests=disabled \ -Dfirewalld=disabled \ -Dfirewalld_zone=disabled \ -Dfuse=disabled \ From 2a7828bae8321c3064e3f27a4c4d96b4281182cb Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Nov 06 2023 14:53:21 +0000 Subject: [PATCH 4/19] libvirt-9.9.0-2 Fix crash with snapshot restore (bz #2247754) --- diff --git a/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch b/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch new file mode 100644 index 0000000..dcd3fa0 --- /dev/null +++ b/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch @@ -0,0 +1,34 @@ +From: Pavel Hrdina +Date: Fri, 3 Nov 2023 14:03:55 +0100 +Subject: [PATCH] qemu_process: fix crash in qemuSaveImageDecompressionStart +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Content-type: text/plain + +Commit changing the code to allow passing NULL as @data into +qemuSaveImageDecompressionStart() was not correct as it left the +original call into the function as well. + +Introduced-by: 2f3e582a1ac1008eba8d43c751cdba8712dd1614 +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2247754 +Signed-off-by: Pavel Hrdina +Reviewed-by: Ján Tomko +--- + 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 1ef032dbd2..b9267d8699 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -8208,9 +8208,6 @@ qemuProcessStartWithMemoryState(virConnectPtr conn, + } + } + +- if (qemuSaveImageDecompressionStart(data, fd, &intermediatefd, &errbuf, &cmd) < 0) +- return -1; +- + /* No cookie means libvirt which saved the domain was too old to mess up + * the CPU definitions. + */ diff --git a/libvirt.spec b/libvirt.spec index 51d1113..6679ae9 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -241,7 +241,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 9.9.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -250,6 +250,9 @@ URL: https://libvirt.org/ %endif Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz +# Fix crash with snapshot restore (bz #2247754) +Patch0001: 0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch + Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} @@ -2500,6 +2503,9 @@ exit 0 %changelog +* Mon Nov 06 2023 Cole Robinson - 9.9.0-2 +- Fix crash with snapshot restore (bz #2247754) + * Wed Nov 01 2023 Cole Robinson - 9.9.0-1 - Update to version 9.9.0 From 56d89b1d6112a8dc9ce23554dcbc3118f607789f Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones Date: Nov 30 2023 08:35:47 +0000 Subject: [PATCH 5/19] Bump and rebuild for xen 4.18.0 --- diff --git a/libvirt.spec b/libvirt.spec index 6679ae9..c231ab0 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -241,7 +241,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 9.9.0 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -2503,6 +2503,9 @@ exit 0 %changelog +* Thu Nov 30 2023 Richard W.M. Jones - 9.9.0-3 +- Bump and rebuild for xen 4.18.0 + * Mon Nov 06 2023 Cole Robinson - 9.9.0-2 - Fix crash with snapshot restore (bz #2247754) From 80a3188a200cf17708ae1284d1dede85ff2277c9 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones Date: Nov 30 2023 09:02:20 +0000 Subject: [PATCH 6/19] Fix libxml2 API changes --- diff --git a/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch b/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch index dcd3fa0..7472e08 100644 --- a/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch +++ b/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch @@ -1,10 +1,11 @@ +From b049f42dda977b094895acdf348304ba2f4f1cd4 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Fri, 3 Nov 2023 14:03:55 +0100 -Subject: [PATCH] qemu_process: fix crash in qemuSaveImageDecompressionStart +Subject: [PATCH 1/7] qemu_process: fix crash in + qemuSaveImageDecompressionStart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Content-type: text/plain Commit changing the code to allow passing NULL as @data into qemuSaveImageDecompressionStart() was not correct as it left the @@ -14,6 +15,7 @@ Introduced-by: 2f3e582a1ac1008eba8d43c751cdba8712dd1614 Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2247754 Signed-off-by: Pavel Hrdina Reviewed-by: Ján Tomko +(cherry picked from commit 4f4a8dce944e05311565b690a84f6bb1ef67c086) --- src/qemu/qemu_process.c | 3 --- 1 file changed, 3 deletions(-) @@ -32,3 +34,6 @@ index 1ef032dbd2..b9267d8699 100644 /* No cookie means libvirt which saved the domain was too old to mess up * the CPU definitions. */ +-- +2.43.0 + diff --git a/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch b/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch new file mode 100644 index 0000000..b9afe87 --- /dev/null +++ b/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch @@ -0,0 +1,109 @@ +From 982184d57fff654c1cccf0d4a4a5d1631058819d Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Mon, 20 Nov 2023 04:49:53 +0100 +Subject: [PATCH 2/7] vbox_snapshot_conf: Parse XMLs without net access +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When working with VirtualBox's snapshots, the snapshot XML is +firstly parsed, stored in memory (with some parts being stored as +verbatim XML snippets, strings), requested changes are made and +then this modified XML is formatted via +virVBoxSnapshotConfSaveVboxFile() which calls +xmlParseInNodeContext() to format those previously stored XML +snippets. + +The first parse of whole VirtualBox snapshot file is done using +virXMLParse() (in virVBoxSnapshotConfLoadVboxFile()) and thus +with XML_PARSE_NONET specified. + +But those ad-hoc parsings when formatting the XML back pass zero +flags mask: xmlParseInNodeContext(..., options = 0, ...); + +This is potentially dangerous. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit d8cb1cd50c608eb647fcb17c4347a2e9d5004e8d) +--- + src/vbox/vbox_snapshot_conf.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c +index 84f7aceac2..467255f77f 100644 +--- a/src/vbox/vbox_snapshot_conf.c ++++ b/src/vbox/vbox_snapshot_conf.c +@@ -369,6 +369,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, + int firstRegexResult = 0; + g_auto(GStrv) secondRegex = NULL; + int secondRegexResult = 0; ++ const int parseFlags = XML_PARSE_NONET; + + uuid = g_strdup_printf("{%s}", snapshot->uuid); + +@@ -406,7 +407,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, + parseError = xmlParseInNodeContext(node, + snapshot->hardware, + (int)strlen(snapshot->hardware), +- 0, ++ parseFlags, + &hardwareNode); + if (parseError != XML_ERR_OK) { + virReportError(VIR_ERR_XML_ERROR, "%s", +@@ -418,7 +419,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, + /* storageController */ + if (xmlParseInNodeContext(node, snapshot->storageController, + (int)strlen(snapshot->storageController), +- 0, ++ parseFlags, + &storageControllerNode) != XML_ERR_OK) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Unable to add the snapshot storageController")); +@@ -944,6 +945,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, + int firstRegexResult = 0; + g_auto(GStrv) secondRegex = NULL; + int secondRegexResult = 0; ++ const int parseFlags = XML_PARSE_NONET; + + if (machine == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +@@ -1051,7 +1053,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, + parseError = xmlParseInNodeContext(mediaRegistryNode, + machine->mediaRegistry->otherMedia[i], + (int)strlen(machine->mediaRegistry->otherMedia[i]), +- 0, ++ parseFlags, + &cur); + if (parseError != XML_ERR_OK) { + virReportError(VIR_ERR_XML_ERROR, "%s", +@@ -1071,7 +1073,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, + parseError = xmlParseInNodeContext(machineNode, + machine->hardware, + (int)strlen(machine->hardware), +- 0, ++ parseFlags, + &cur); + if (parseError != XML_ERR_OK) { + virReportError(VIR_ERR_XML_ERROR, "%s", +@@ -1084,7 +1086,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, + parseError = xmlParseInNodeContext(xmlDocGetRootElement(xml), + machine->extraData, + (int)strlen(machine->extraData), +- 0, ++ parseFlags, + &cur); + if (parseError != XML_ERR_OK) { + virReportError(VIR_ERR_XML_ERROR, "%s", +@@ -1097,7 +1099,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, + parseError = xmlParseInNodeContext(machineNode, + machine->storageController, + (int)strlen(machine->storageController), +- 0, ++ parseFlags, + &cur); + if (parseError != XML_ERR_OK) { + virReportError(VIR_ERR_XML_ERROR, "%s", +-- +2.43.0 + diff --git a/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch b/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch new file mode 100644 index 0000000..d8b8cce --- /dev/null +++ b/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch @@ -0,0 +1,76 @@ +From ee3f790a24ec16308e016f9e7dc1cc5e29a6a525 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 21 Nov 2023 10:40:36 +0100 +Subject: [PATCH 3/7] vbox_snapshot_conf: Keep indent in snapshot XML +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +As mentioned in previous commit, VirtualBox has its own snapshot +XML which we parse, change and then format back. During this, we +ought to keep the indentation to produce better looking result +(especially when we want to compare the output in tests later on, +like we do in vboxsnapshotxmltest). + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit d1f58b10f687050dd097c5a60becf62c35deee68) +--- + src/vbox/vbox_snapshot_conf.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c +index 467255f77f..89cd685954 100644 +--- a/src/vbox/vbox_snapshot_conf.c ++++ b/src/vbox/vbox_snapshot_conf.c +@@ -25,6 +25,7 @@ + #include "virstring.h" + #include "virxml.h" + ++#include + #include + + #define VIR_FROM_THIS VIR_FROM_VBOX +@@ -364,12 +365,11 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, + xmlParserErrors parseError = XML_ERR_OK; + char *uuid = NULL; + char *timeStamp = NULL; +- + g_auto(GStrv) firstRegex = NULL; + int firstRegexResult = 0; + g_auto(GStrv) secondRegex = NULL; + int secondRegexResult = 0; +- const int parseFlags = XML_PARSE_NONET; ++ const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOBLANKS; + + uuid = g_strdup_printf("{%s}", snapshot->uuid); + +@@ -940,12 +940,14 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, + xmlParserErrors parseError = XML_ERR_OK; + char *currentSnapshot = NULL; + char *timeStamp = NULL; +- + g_auto(GStrv) firstRegex = NULL; + int firstRegexResult = 0; + g_auto(GStrv) secondRegex = NULL; + int secondRegexResult = 0; +- const int parseFlags = XML_PARSE_NONET; ++ const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOBLANKS; ++ int oldIndentTreeOutput = xmlIndentTreeOutput; ++ ++ xmlIndentTreeOutput = 1; + + if (machine == NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +@@ -1127,6 +1129,8 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, + ret = 0; + + cleanup: ++ xmlIndentTreeOutput = oldIndentTreeOutput; ++ + VIR_FREE(currentSnapshot); + VIR_FREE(timeStamp); + +-- +2.43.0 + diff --git a/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch b/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch new file mode 100644 index 0000000..0458c5b --- /dev/null +++ b/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch @@ -0,0 +1,36 @@ +From 09f06f6286f864fefdf4877b5792999e0d4e89d1 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Mon, 20 Nov 2023 03:18:12 +0100 +Subject: [PATCH 4/7] virxml: include for + xmlIndentTreeOutput declaration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +After libxml2's commit of v2.12.0~101 we no longer get +xmlIndentTreeOutput declaration by us including just +libxml/xpathInternals.h and libxml2's header files leakage. + +Resolves: https://bugs.gentoo.org/917516 +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 7a5f232be2269e74943a029c0e8b1b0124674a6c) +--- + src/util/virxml.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/util/virxml.c b/src/util/virxml.c +index 0c1eae8c3c..4f215a0e59 100644 +--- a/src/util/virxml.c ++++ b/src/util/virxml.c +@@ -24,6 +24,7 @@ + #include /* for isnan() */ + #include + ++#include + #include + + #include "virerror.h" +-- +2.43.0 + diff --git a/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch b/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch new file mode 100644 index 0000000..4d5c919 --- /dev/null +++ b/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch @@ -0,0 +1,51 @@ +From 68a14369033486ad9e02cb144cde2aced7351ce2 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Sat, 18 Nov 2023 04:17:47 +0100 +Subject: [PATCH 5/7] virXMLParseHelper: Store XML parsing flags in a variable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The virXMLParseHelper() can work in two modes: either it parses a +file or a string. Either way, the same set of flags is specified +in call of corresponding function. Save flags in a local variable +instead. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 1beb69df877596fe57efc8d8a117a30a72e5d04e) +--- + src/util/virxml.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/src/util/virxml.c b/src/util/virxml.c +index 4f215a0e59..027cdb97b9 100644 +--- a/src/util/virxml.c ++++ b/src/util/virxml.c +@@ -1136,6 +1136,7 @@ virXMLParseHelper(int domcode, + g_autoptr(xmlDoc) xml = NULL; + xmlNodePtr rootnode; + const char *docname; ++ const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOWARNING; + + if (filename) + docname = filename; +@@ -1154,13 +1155,9 @@ virXMLParseHelper(int domcode, + pctxt->sax->error = catchXMLError; + + if (filename) { +- xml = xmlCtxtReadFile(pctxt, filename, NULL, +- XML_PARSE_NONET | +- XML_PARSE_NOWARNING); ++ xml = xmlCtxtReadFile(pctxt, filename, NULL, parseFlags); + } else { +- xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL, +- XML_PARSE_NONET | +- XML_PARSE_NOWARNING); ++ xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL, parseFlags); + } + + if (!xml) { +-- +2.43.0 + diff --git a/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch b/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch new file mode 100644 index 0000000..db734fc --- /dev/null +++ b/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch @@ -0,0 +1,123 @@ +From 6371a0d85b6febd8e034eeec02d70c551535ad5b Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 21 Nov 2023 10:39:58 +0100 +Subject: [PATCH 6/7] virxml: Introduce parsing APIs that keep indentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When parsing an XML it may be important to keep indentation to +produce a better looking result when formatting the XML back. +Just look at all those xmlKeepBlanksDefault() calls just before +virXMLParse() is called. + +Anyway, as of libxml2 commit v2.12.0~108 xmlKeepBlanksDefault() +is deprecated. Therefore, introduce virXMLParse...WithIndent() +variants which would do exactly xmlKeepBlanksDefault() did but +with non-deprecated APIs. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 69958ba3102810bb4f90a91d2f6d9032e1a1da2d) +--- + src/util/virxml.c | 9 +++++++-- + src/util/virxml.h | 29 +++++++++++++++++++++++++---- + 2 files changed, 32 insertions(+), 6 deletions(-) + +diff --git a/src/util/virxml.c b/src/util/virxml.c +index 027cdb97b9..6d0c8f0311 100644 +--- a/src/util/virxml.c ++++ b/src/util/virxml.c +@@ -1129,14 +1129,15 @@ virXMLParseHelper(int domcode, + const char *rootelement, + xmlXPathContextPtr *ctxt, + const char *schemafile, +- bool validate) ++ bool validate, ++ bool keepindent) + { + struct virParserData private; + g_autoptr(xmlParserCtxt) pctxt = NULL; + g_autoptr(xmlDoc) xml = NULL; + xmlNodePtr rootnode; + const char *docname; +- const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOWARNING; ++ int parseFlags = XML_PARSE_NONET | XML_PARSE_NOWARNING; + + if (filename) + docname = filename; +@@ -1154,6 +1155,10 @@ virXMLParseHelper(int domcode, + pctxt->_private = &private; + pctxt->sax->error = catchXMLError; + ++ if (keepindent) { ++ parseFlags |= XML_PARSE_NOBLANKS; ++ } ++ + if (filename) { + xml = xmlCtxtReadFile(pctxt, filename, NULL, parseFlags); + } else { +diff --git a/src/util/virxml.h b/src/util/virxml.h +index 7af47437bd..03a85bfb25 100644 +--- a/src/util/virxml.h ++++ b/src/util/virxml.h +@@ -199,7 +199,8 @@ virXMLParseHelper(int domcode, + const char *rootelement, + xmlXPathContextPtr *ctxt, + const char *schemafile, +- bool validate); ++ bool validate, ++ bool keepindent); + + const char * + virXMLPickShellSafeComment(const char *str1, +@@ -219,7 +220,17 @@ virXMLPickShellSafeComment(const char *str1, + * Return the parsed document object, or NULL on failure. + */ + #define virXMLParse(filename, xmlStr, url, rootelement, ctxt, schemafile, validate) \ +- virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, rootelement, ctxt, schemafile, validate) ++ virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, rootelement, ctxt, schemafile, validate, false) ++ ++/** ++ * virXMLParseWithIndent: ++ * ++ * Just like virXMLParse, except indentation is preserved. Should be used when ++ * facing an user provided XML which may be formatted back and keeping verbatim ++ * spacing is necessary (e.g. due to ). ++ */ ++#define virXMLParseWithIndent(filename, xmlStr, url, rootelement, ctxt, schemafile, validate) \ ++ virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, rootelement, ctxt, schemafile, validate, true) + + /** + * virXMLParseStringCtxt: +@@ -233,7 +244,17 @@ virXMLPickShellSafeComment(const char *str1, + * Return the parsed document object, or NULL on failure. + */ + #define virXMLParseStringCtxt(xmlStr, url, pctxt) \ +- virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, pctxt, NULL, false) ++ virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, pctxt, NULL, false, false) ++ ++/** ++ * virXMLParseStringCtxtWithIndent: ++ * ++ * Just like virXMLParseStringCtxt, except indentation is preserved. Should be ++ * used when facing an user provided XML which may be formatted back and ++ * keeping verbatim spacing is necessary (e.g. due to ). ++ */ ++#define virXMLParseStringCtxtWithIndent(xmlStr, url, pctxt) \ ++ virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, pctxt, NULL, false, true) + + /** + * virXMLParseFileCtxt: +@@ -246,7 +267,7 @@ virXMLPickShellSafeComment(const char *str1, + * Return the parsed document object, or NULL on failure. + */ + #define virXMLParseFileCtxt(filename, pctxt) \ +- virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, NULL, pctxt, NULL, false) ++ virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, NULL, pctxt, NULL, false, false) + + int + virXMLSaveFile(const char *path, +-- +2.43.0 + diff --git a/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch b/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch new file mode 100644 index 0000000..07a9c4b --- /dev/null +++ b/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch @@ -0,0 +1,162 @@ +From 215a4afe93c051e35d09fabea19172ab51959737 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Mon, 20 Nov 2023 16:20:51 +0100 +Subject: [PATCH 7/7] lib: Replace xmlKeepBlanksDefault() with + virXMLParseWithIndent() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Now that we have virXMLParseWithIndent() and +virXMLParseStringCtxtWithIndent(), we can use them directly and +drop calls to xmlKeepBlanksDefault(). + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 1fdca3083b52507d7a99f6e9b84e91d8df68013e) +--- + src/conf/backup_conf.c | 8 +++----- + src/conf/checkpoint_conf.c | 8 +++----- + src/conf/domain_conf.c | 11 +++-------- + src/conf/network_conf.c | 6 ++---- + src/conf/snapshot_conf.c | 8 +++----- + tools/virsh-util.c | 5 +---- + 6 files changed, 15 insertions(+), 31 deletions(-) + +diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c +index e151c29738..1fea6a2be7 100644 +--- a/src/conf/backup_conf.c ++++ b/src/conf/backup_conf.c +@@ -276,13 +276,11 @@ virDomainBackupDefParseString(const char *xmlStr, + { + g_autoptr(xmlDoc) xml = NULL; + g_autoptr(xmlXPathContext) ctxt = NULL; +- int keepBlanksDefault = xmlKeepBlanksDefault(0); + bool validate = !(flags & VIR_DOMAIN_BACKUP_PARSE_INTERNAL); + +- xml = virXMLParse(NULL, xmlStr, _("(domain_backup)"), +- "domainbackup", &ctxt, "domainbackup.rng", validate); +- +- xmlKeepBlanksDefault(keepBlanksDefault); ++ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_backup)"), ++ "domainbackup", &ctxt, "domainbackup.rng", ++ validate); + + if (!xml) + return NULL; +diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c +index 89f8675235..3c797f0f5b 100644 +--- a/src/conf/checkpoint_conf.c ++++ b/src/conf/checkpoint_conf.c +@@ -192,12 +192,10 @@ virDomainCheckpointDefParseString(const char *xmlStr, + { + g_autoptr(xmlDoc) xml = NULL; + g_autoptr(xmlXPathContext) ctxt = NULL; +- int keepBlanksDefault = xmlKeepBlanksDefault(0); + +- xml = virXMLParse(NULL, xmlStr, _("(domain_checkpoint)"), +- "domaincheckpoint", &ctxt, "domaincheckpoint.rng", true); +- +- xmlKeepBlanksDefault(keepBlanksDefault); ++ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_checkpoint)"), ++ "domaincheckpoint", &ctxt, ++ "domaincheckpoint.rng", true); + + if (!xml) + return NULL; +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 80f467ae7a..2b6f765b6d 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -19503,13 +19503,10 @@ virDomainDefParse(const char *xmlStr, + { + g_autoptr(xmlDoc) xml = NULL; + g_autoptr(xmlXPathContext) ctxt = NULL; +- int keepBlanksDefault = xmlKeepBlanksDefault(0); + bool validate = flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; + +- xml = virXMLParse(filename, xmlStr, _("(domain_definition)"), +- "domain", &ctxt, "domain.rng", validate); +- +- xmlKeepBlanksDefault(keepBlanksDefault); ++ xml = virXMLParseWithIndent(filename, xmlStr, _("(domain_definition)"), ++ "domain", &ctxt, "domain.rng", validate); + + if (!xml) + return NULL; +@@ -19566,10 +19563,8 @@ virDomainObjParseFile(const char *filename, + { + g_autoptr(xmlDoc) xml = NULL; + g_autoptr(xmlXPathContext) ctxt = NULL; +- int keepBlanksDefault = xmlKeepBlanksDefault(0); + +- xml = virXMLParse(filename, NULL, NULL, "domstatus", &ctxt, NULL, false); +- xmlKeepBlanksDefault(keepBlanksDefault); ++ xml = virXMLParseWithIndent(filename, NULL, NULL, "domstatus", &ctxt, NULL, false); + + if (!xml) + return NULL; +diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c +index 1a6fd86180..0449b6f07c 100644 +--- a/src/conf/network_conf.c ++++ b/src/conf/network_conf.c +@@ -1962,11 +1962,9 @@ virNetworkDefParse(const char *xmlStr, + { + g_autoptr(xmlDoc) xml = NULL; + g_autoptr(xmlXPathContext) ctxt = NULL; +- int keepBlanksDefault = xmlKeepBlanksDefault(0); + +- xml = virXMLParse(filename, xmlStr, _("(network_definition)"), +- "network", &ctxt, "network.rng", validate); +- xmlKeepBlanksDefault(keepBlanksDefault); ++ xml = virXMLParseWithIndent(filename, xmlStr, _("(network_definition)"), ++ "network", &ctxt, "network.rng", validate); + + if (!xml) + return NULL; +diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c +index 4b0555eb8c..d7fcded302 100644 +--- a/src/conf/snapshot_conf.c ++++ b/src/conf/snapshot_conf.c +@@ -426,13 +426,11 @@ virDomainSnapshotDefParseString(const char *xmlStr, + { + g_autoptr(xmlXPathContext) ctxt = NULL; + g_autoptr(xmlDoc) xml = NULL; +- int keepBlanksDefault = xmlKeepBlanksDefault(0); + bool validate = flags & VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE; + +- xml = virXMLParse(NULL, xmlStr, _("(domain_snapshot)"), +- "domainsnapshot", &ctxt, "domainsnapshot.rng", validate); +- +- xmlKeepBlanksDefault(keepBlanksDefault); ++ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_snapshot)"), ++ "domainsnapshot", &ctxt, "domainsnapshot.rng", ++ validate); + + if (!xml) + return NULL; +diff --git a/tools/virsh-util.c b/tools/virsh-util.c +index fb6327613a..a6026eed53 100644 +--- a/tools/virsh-util.c ++++ b/tools/virsh-util.c +@@ -474,16 +474,13 @@ virshDumpXML(vshControl *ctl, + g_autofree xmlNodePtr *nodes = NULL; + int nnodes = 0; + size_t i; +- int oldblanks; + + if (xpath == NULL) { + vshPrint(ctl, "%s", xml); + return true; + } + +- oldblanks = xmlKeepBlanksDefault(0); +- doc = virXMLParseStringCtxt(xml, url, &ctxt); +- xmlKeepBlanksDefault(oldblanks); ++ doc = virXMLParseStringCtxtWithIndent(xml, url, &ctxt); + if (!doc) + return false; + +-- +2.43.0 + diff --git a/libvirt.spec b/libvirt.spec index c231ab0..77cef71 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -251,7 +251,14 @@ URL: https://libvirt.org/ Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz # Fix crash with snapshot restore (bz #2247754) -Patch0001: 0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch +Patch: 0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch +# Fix libxml2 API changes +Patch: 0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch +Patch: 0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch +Patch: 0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch +Patch: 0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch +Patch: 0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch +Patch: 0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} From f8539fae136d975d6ce46d717687ada1e37b52c8 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones Date: Nov 30 2023 10:40:30 +0000 Subject: [PATCH 7/19] Backport upstream cfcbba4c2b8a commit cfcbba4c2b8a2062dec36072a34209229b6c3277 Author: Michal Prívozník Date: Wed Nov 22 14:58:49 2023 +0100 lib: Replace qsort() with g_qsort_with_data() --- diff --git a/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch b/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch index 7472e08..d726d50 100644 --- a/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch +++ b/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch @@ -1,7 +1,7 @@ From b049f42dda977b094895acdf348304ba2f4f1cd4 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Fri, 3 Nov 2023 14:03:55 +0100 -Subject: [PATCH 1/7] qemu_process: fix crash in +Subject: [PATCH 1/8] qemu_process: fix crash in qemuSaveImageDecompressionStart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 diff --git a/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch b/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch index b9afe87..120e442 100644 --- a/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch +++ b/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch @@ -1,7 +1,7 @@ From 982184d57fff654c1cccf0d4a4a5d1631058819d Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 20 Nov 2023 04:49:53 +0100 -Subject: [PATCH 2/7] vbox_snapshot_conf: Parse XMLs without net access +Subject: [PATCH 2/8] vbox_snapshot_conf: Parse XMLs without net access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch b/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch index d8b8cce..a545954 100644 --- a/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch +++ b/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch @@ -1,7 +1,7 @@ From ee3f790a24ec16308e016f9e7dc1cc5e29a6a525 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 21 Nov 2023 10:40:36 +0100 -Subject: [PATCH 3/7] vbox_snapshot_conf: Keep indent in snapshot XML +Subject: [PATCH 3/8] vbox_snapshot_conf: Keep indent in snapshot XML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch b/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch index 0458c5b..922d5a8 100644 --- a/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch +++ b/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch @@ -1,7 +1,7 @@ From 09f06f6286f864fefdf4877b5792999e0d4e89d1 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 20 Nov 2023 03:18:12 +0100 -Subject: [PATCH 4/7] virxml: include for +Subject: [PATCH 4/8] virxml: include for xmlIndentTreeOutput declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 diff --git a/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch b/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch index 4d5c919..b4f1ff1 100644 --- a/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch +++ b/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch @@ -1,7 +1,7 @@ From 68a14369033486ad9e02cb144cde2aced7351ce2 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Sat, 18 Nov 2023 04:17:47 +0100 -Subject: [PATCH 5/7] virXMLParseHelper: Store XML parsing flags in a variable +Subject: [PATCH 5/8] virXMLParseHelper: Store XML parsing flags in a variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch b/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch index db734fc..68949fc 100644 --- a/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch +++ b/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch @@ -1,7 +1,7 @@ From 6371a0d85b6febd8e034eeec02d70c551535ad5b Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 21 Nov 2023 10:39:58 +0100 -Subject: [PATCH 6/7] virxml: Introduce parsing APIs that keep indentation +Subject: [PATCH 6/8] virxml: Introduce parsing APIs that keep indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch b/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch index 07a9c4b..6235d5d 100644 --- a/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch +++ b/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch @@ -1,7 +1,7 @@ From 215a4afe93c051e35d09fabea19172ab51959737 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 20 Nov 2023 16:20:51 +0100 -Subject: [PATCH 7/7] lib: Replace xmlKeepBlanksDefault() with +Subject: [PATCH 7/8] lib: Replace xmlKeepBlanksDefault() with virXMLParseWithIndent() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 diff --git a/0008-lib-Replace-qsort-with-g_qsort_with_data.patch b/0008-lib-Replace-qsort-with-g_qsort_with_data.patch new file mode 100644 index 0000000..4dd70f2 --- /dev/null +++ b/0008-lib-Replace-qsort-with-g_qsort_with_data.patch @@ -0,0 +1,976 @@ +From e1973fb24917234e552a711de16e2fc19f477b63 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Wed, 22 Nov 2023 14:58:49 +0100 +Subject: [PATCH 8/8] lib: Replace qsort() with g_qsort_with_data() + +While glibc provides qsort(), which usually is just a mergesort, +until sorting arrays so huge that temporary array used by +mergesort would not fit into physical memory (which in our case +is never), we are not guaranteed it'll use mergesort. The +advantage of mergesort is clear - it's stable. IOW, if we have an +array of values parsed from XML, qsort() it and produce some +output based on those values, we can then compare the output with +some expected output, line by line. + +But with newer glibc this is all history. After [1], qsort() is +no longer mergesort but introsort instead, which is not stable. +This is suboptimal, because in some cases we want to preserve +order of equal items. For instance, in ebiptablesApplyNewRules(), +nwfilter rules are sorted by their priority. But if two rules +have the same priority, we want to keep them in the order they +appear in the XML. Since it's hard/needless work to identify +places where stable or unstable sorting is needed, let's just +play it safe and use stable sorting everywhere. + +Fortunately, glib provides g_qsort_with_data() which indeed +implement mergesort and it's a drop in replacement for qsort(), +almost. It accepts fifth argument (pointer to opaque data), that +is passed to comparator function, which then accepts three +arguments. + +We have to keep one occurance of qsort() though - in NSS module +which deliberately does not link with glib. + +1: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=03bf8357e8291857a435afcc3048e0b697b6cc04 +Signed-off-by: Michal Privoznik +Reviewed-by: Martin Kletzander +(cherry picked from commit cfcbba4c2b8a2062dec36072a34209229b6c3277) +--- + build-aux/Makefile.nonreentrant | 1 - + build-aux/syntax-check.mk | 2 +- + src/conf/capabilities.c | 8 ++++--- + src/conf/domain_conf.c | 6 +++-- + src/cpu/cpu.c | 7 +++--- + src/cpu/cpu_x86.c | 15 +++++++----- + src/lxc/lxc_container.c | 3 ++- + src/nwfilter/nwfilter_ebiptables_driver.c | 29 +++++++++++++++-------- + src/qemu/qemu_monitor_json.c | 6 +++-- + src/qemu/qemu_process.c | 7 +++--- + src/security/security_manager.c | 9 ++++--- + src/util/virfile.c | 8 ++++--- + src/util/virhash.c | 9 ++++--- + src/util/virresctrl.c | 9 ++++--- + src/util/virstring.c | 12 ++++++---- + src/util/virstring.h | 8 +++++-- + src/util/virtypedparam.c | 9 ++++--- + tests/commandhelper.c | 6 +++-- + tests/virstringtest.c | 8 +++---- + tools/virsh-checkpoint.c | 10 ++++---- + tools/virsh-domain-monitor.c | 11 +++++---- + tools/virsh-host.c | 7 ++++-- + tools/virsh-interface.c | 11 +++++---- + tools/virsh-network.c | 29 +++++++++++++++-------- + tools/virsh-nodedev.c | 11 +++++---- + tools/virsh-nwfilter.c | 22 ++++++++++------- + tools/virsh-pool.c | 11 +++++---- + tools/virsh-secret.c | 11 +++++---- + tools/virsh-snapshot.c | 10 ++++---- + tools/virsh-volume.c | 10 +++++--- + 30 files changed, 195 insertions(+), 110 deletions(-) + +diff --git a/build-aux/Makefile.nonreentrant b/build-aux/Makefile.nonreentrant +index 87bb9db20e..b869c645ce 100644 +--- a/build-aux/Makefile.nonreentrant ++++ b/build-aux/Makefile.nonreentrant +@@ -21,7 +21,6 @@ + # | grep '_r$' \ + # | awk '{print $3}' \ + # | grep -v __ \ +-# | grep -v qsort \ # Red herring since we don't need to pass extra args to qsort comparator + # | grep -v readdir \ # This is safe as long as each DIR * instance is only used by one thread + # | sort \ + # | uniq \ +diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk +index 7af7d20d70..ad2ecd50c7 100644 +--- a/build-aux/syntax-check.mk ++++ b/build-aux/syntax-check.mk +@@ -380,7 +380,7 @@ sc_prohibit_unsigned_pid: + # Many of the function names below came from this filter: + # git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \ + # |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \ +-# |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$' ++# |grep -vE '^(if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$' + + msg_gen_function = + msg_gen_function += VIR_ERROR +diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c +index 34f04cb7d3..32badee7b3 100644 +--- a/src/conf/capabilities.c ++++ b/src/conf/capabilities.c +@@ -2073,7 +2073,8 @@ virCapsHostCacheBankFree(virCapsHostCacheBank *ptr) + + static int + virCapsHostCacheBankSorter(const void *a, +- const void *b) ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virCapsHostCacheBank *ca = *(virCapsHostCacheBank **)a; + virCapsHostCacheBank *cb = *(virCapsHostCacheBank **)b; +@@ -2273,8 +2274,9 @@ virCapabilitiesInitCaches(virCaps *caps) + * still traverse the directory instead of guessing names (in case there is + * 'index1' and 'index3' but no 'index2'). */ + if (caps->host.cache.banks) { +- qsort(caps->host.cache.banks, caps->host.cache.nbanks, +- sizeof(*caps->host.cache.banks), virCapsHostCacheBankSorter); ++ g_qsort_with_data(caps->host.cache.banks, caps->host.cache.nbanks, ++ sizeof(*caps->host.cache.banks), ++ virCapsHostCacheBankSorter, NULL); + } + + if (virCapabilitiesInitResctrlMemory(caps) < 0) +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 2b6f765b6d..aede47a130 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -15703,7 +15703,9 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, + } + + +-static int virDomainIdMapEntrySort(const void *a, const void *b) ++static int virDomainIdMapEntrySort(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + const virDomainIdMapEntry *entrya = a; + const virDomainIdMapEntry *entryb = b; +@@ -15746,7 +15748,7 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, + } + } + +- qsort(idmap, num, sizeof(idmap[0]), virDomainIdMapEntrySort); ++ g_qsort_with_data(idmap, num, sizeof(idmap[0]), virDomainIdMapEntrySort, NULL); + + return idmap; + } +diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c +index bb5737e938..bc43aa4e93 100644 +--- a/src/cpu/cpu.c ++++ b/src/cpu/cpu.c +@@ -1045,7 +1045,8 @@ virCPUConvertLegacy(virArch arch, + + static int + virCPUFeatureCompare(const void *p1, +- const void *p2) ++ const void *p2, ++ void *opaque G_GNUC_UNUSED) + { + const virCPUFeatureDef *f1 = p1; + const virCPUFeatureDef *f2 = p2; +@@ -1085,8 +1086,8 @@ virCPUExpandFeatures(virArch arch, + driver->expandFeatures(cpu) < 0) + return -1; + +- qsort(cpu->features, cpu->nfeatures, sizeof(*cpu->features), +- virCPUFeatureCompare); ++ g_qsort_with_data(cpu->features, cpu->nfeatures, sizeof(*cpu->features), ++ virCPUFeatureCompare, NULL); + + VIR_DEBUG("nfeatures=%zu", cpu->nfeatures); + return 0; +diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c +index 7a7f3b409d..8d0e3947ce 100644 +--- a/src/cpu/cpu_x86.c ++++ b/src/cpu/cpu_x86.c +@@ -393,7 +393,9 @@ x86FeatureFindInternal(const char *name) + + + static int +-virCPUx86DataSorter(const void *a, const void *b) ++virCPUx86DataSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virCPUx86DataItem *da = (virCPUx86DataItem *) a; + virCPUx86DataItem *db = (virCPUx86DataItem *) b; +@@ -437,7 +439,7 @@ static int + virCPUx86DataItemCmp(const virCPUx86DataItem *item1, + const virCPUx86DataItem *item2) + { +- return virCPUx86DataSorter(item1, item2); ++ return virCPUx86DataSorter(item1, item2, NULL); + } + + +@@ -541,8 +543,9 @@ virCPUx86DataAddItem(virCPUx86Data *data, + VIR_APPEND_ELEMENT_COPY(data->items, data->len, + *((virCPUx86DataItem *)item)); + +- qsort(data->items, data->len, +- sizeof(virCPUx86DataItem), virCPUx86DataSorter); ++ g_qsort_with_data(data->items, data->len, ++ sizeof(virCPUx86DataItem), ++ virCPUx86DataSorter, NULL); + } + + return 0; +@@ -3465,8 +3468,8 @@ virCPUx86DataGetHost(void) + } + + /* the rest of the code expects the function to be in order */ +- qsort(cpuid->data.x86.items, cpuid->data.x86.len, +- sizeof(virCPUx86DataItem), virCPUx86DataSorter); ++ g_qsort_with_data(cpuid->data.x86.items, cpuid->data.x86.len, ++ sizeof(virCPUx86DataItem), virCPUx86DataSorter, NULL); + + return cpuid; + } +diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c +index 35a882171b..652697890f 100644 +--- a/src/lxc/lxc_container.c ++++ b/src/lxc/lxc_container.c +@@ -791,7 +791,8 @@ static int lxcContainerSetReadOnly(void) + if (!mounts) + return 0; + +- qsort(mounts, nmounts, sizeof(mounts[0]), virStringSortRevCompare); ++ g_qsort_with_data(mounts, nmounts, ++ sizeof(mounts[0]), virStringSortRevCompare, NULL); + + /* turn 'mounts' into a proper GStrv */ + VIR_EXPAND_N(mounts, nmounts, 1); +diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c +index 1c5da2ae05..56bddb9097 100644 +--- a/src/nwfilter/nwfilter_ebiptables_driver.c ++++ b/src/nwfilter/nwfilter_ebiptables_driver.c +@@ -3087,7 +3087,9 @@ virNWFilterRuleInstSort(const void *a, const void *b) + + + static int +-virNWFilterRuleInstSortPtr(const void *a, const void *b) ++virNWFilterRuleInstSortPtr(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virNWFilterRuleInst * const *insta = a; + virNWFilterRuleInst * const *instb = b; +@@ -3097,7 +3099,8 @@ virNWFilterRuleInstSortPtr(const void *a, const void *b) + + static int + ebiptablesFilterOrderSort(const void *va, +- const void *vb) ++ const void *vb, ++ void *opaque G_GNUC_UNUSED) + { + const virHashKeyValuePair *a = va; + const virHashKeyValuePair *b = vb; +@@ -3244,7 +3247,9 @@ struct _ebtablesSubChainInst { + + + static int +-ebtablesSubChainInstSort(const void *a, const void *b) ++ebtablesSubChainInstSort(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + const ebtablesSubChainInst **insta = (const ebtablesSubChainInst **)a; + const ebtablesSubChainInst **instb = (const ebtablesSubChainInst **)b; +@@ -3268,7 +3273,8 @@ ebtablesGetSubChainInsts(GHashTable *chains, + if (filter_names == NULL) + return -1; + +- qsort(filter_names, nfilter_names, sizeof(*filter_names), ebiptablesFilterOrderSort); ++ g_qsort_with_data(filter_names, nfilter_names, ++ sizeof(*filter_names), ebiptablesFilterOrderSort, NULL); + + for (i = 0; filter_names[i].key; i++) { + g_autofree ebtablesSubChainInst *inst = NULL; +@@ -3306,9 +3312,10 @@ ebiptablesApplyNewRules(const char *ifname, + size_t nsubchains = 0; + int ret = -1; + +- if (nrules) +- qsort(rules, nrules, sizeof(rules[0]), +- virNWFilterRuleInstSortPtr); ++ if (nrules) { ++ g_qsort_with_data(rules, nrules, sizeof(rules[0]), ++ virNWFilterRuleInstSortPtr, NULL); ++ } + + /* cleanup whatever may exist */ + virFirewallStartTransaction(fw, VIR_FIREWALL_TRANSACTION_IGNORE_ERRORS); +@@ -3388,9 +3395,11 @@ ebiptablesApplyNewRules(const char *ifname, + goto cleanup; + } + +- if (nsubchains > 0) +- qsort(subchains, nsubchains, sizeof(subchains[0]), +- ebtablesSubChainInstSort); ++ if (nsubchains > 0) { ++ g_qsort_with_data(subchains, nsubchains, ++ sizeof(subchains[0]), ++ ebtablesSubChainInstSort, NULL); ++ } + + for (i = 0, j = 0; i < nrules; i++) { + if (virNWFilterRuleIsProtocolEthernet(rules[i]->def)) { +diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c +index 105d729d7c..6f1dffe8f7 100644 +--- a/src/qemu/qemu_monitor_json.c ++++ b/src/qemu/qemu_monitor_json.c +@@ -7607,7 +7607,8 @@ qemuMonitorJSONProcessHotpluggableCpusReply(virJSONValue *vcpu, + + static int + qemuMonitorQueryHotpluggableCpusEntrySort(const void *p1, +- const void *p2) ++ const void *p2, ++ void *opaque G_GNUC_UNUSED) + { + const struct qemuMonitorQueryHotpluggableCpusEntry *a = p1; + const struct qemuMonitorQueryHotpluggableCpusEntry *b = p2; +@@ -7659,7 +7660,8 @@ qemuMonitorJSONGetHotpluggableCPUs(qemuMonitor *mon, + goto cleanup; + } + +- qsort(info, ninfo, sizeof(*info), qemuMonitorQueryHotpluggableCpusEntrySort); ++ g_qsort_with_data(info, ninfo, sizeof(*info), ++ qemuMonitorQueryHotpluggableCpusEntrySort, NULL); + + *entries = g_steal_pointer(&info); + *nentries = ninfo; +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index b9267d8699..f32e82bbd1 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -6093,7 +6093,8 @@ qemuDomainHasHotpluggableStartupVcpus(virDomainDef *def) + + static int + qemuProcessVcpusSortOrder(const void *a, +- const void *b) ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virDomainVcpuDef *vcpua = *((virDomainVcpuDef **)a); + virDomainVcpuDef *vcpub = *((virDomainVcpuDef **)b); +@@ -6133,8 +6134,8 @@ qemuProcessSetupHotpluggableVcpus(virDomainObj *vm, + if (nbootHotplug == 0) + return 0; + +- qsort(bootHotplug, nbootHotplug, sizeof(*bootHotplug), +- qemuProcessVcpusSortOrder); ++ g_qsort_with_data(bootHotplug, nbootHotplug, ++ sizeof(*bootHotplug), qemuProcessVcpusSortOrder, NULL); + + if (virDomainCgroupEmulatorAllNodesAllow(priv->cgroup, &emulatorCgroup) < 0) + goto cleanup; +diff --git a/src/security/security_manager.c b/src/security/security_manager.c +index 5df0cd3419..afd41f1c20 100644 +--- a/src/security/security_manager.c ++++ b/src/security/security_manager.c +@@ -1247,7 +1247,9 @@ virSecurityManagerRestoreNetdevLabel(virSecurityManager *mgr, + + + static int +-cmpstringp(const void *p1, const void *p2) ++cmpstringp(const void *p1, ++ const void *p2, ++ void *opaque G_GNUC_UNUSED) + { + const char *s1 = *(char * const *) p1; + const char *s2 = *(char * const *) p2; +@@ -1303,8 +1305,9 @@ virSecurityManagerMetadataLock(virSecurityManager *mgr G_GNUC_UNUSED, + * paths in the same order and thus no deadlock can occur. + * Lastly, it makes searching for duplicate paths below + * simpler. */ +- if (paths) +- qsort(paths, npaths, sizeof(*paths), cmpstringp); ++ if (paths) { ++ g_qsort_with_data(paths, npaths, sizeof(*paths), cmpstringp, NULL); ++ } + + for (i = 0; i < npaths; i++) { + const char *p = paths[i]; +diff --git a/src/util/virfile.c b/src/util/virfile.c +index 54708652fb..007b6cf512 100644 +--- a/src/util/virfile.c ++++ b/src/util/virfile.c +@@ -2193,9 +2193,11 @@ virFileGetMountSubtreeImpl(const char *mtabpath, + mounts[nmounts - 2] = g_strdup(mntent.mnt_dir); + } + +- if (mounts) +- qsort(mounts, nmounts - 1, sizeof(mounts[0]), +- reverse ? virStringSortRevCompare : virStringSortCompare); ++ if (mounts) { ++ g_qsort_with_data(mounts, nmounts - 1, sizeof(mounts[0]), ++ reverse ? virStringSortRevCompare : virStringSortCompare, ++ NULL); ++ } + + *mountsret = mounts; + *nmountsret = nmounts ? nmounts - 1 : 0; +diff --git a/src/util/virhash.c b/src/util/virhash.c +index 8365f51eb3..19908c9412 100644 +--- a/src/util/virhash.c ++++ b/src/util/virhash.c +@@ -514,7 +514,8 @@ void *virHashSearch(GHashTable *table, + + static int + virHashGetItemsKeySorter(const void *va, +- const void *vb) ++ const void *vb, ++ void *opaque G_GNUC_UNUSED) + { + const virHashKeyValuePair *a = va; + const virHashKeyValuePair *b = vb; +@@ -552,8 +553,10 @@ virHashGetItems(GHashTable *table, + i++; + } + +- if (sortKeys) +- qsort(items, *nitems, sizeof(*items), virHashGetItemsKeySorter); ++ if (sortKeys) { ++ g_qsort_with_data(items, *nitems, ++ sizeof(*items), virHashGetItemsKeySorter, NULL); ++ } + + return items; + } +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index 8ca58f5d10..30ae25c487 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -2522,7 +2522,8 @@ virResctrlMonitorRemove(virResctrlMonitor *monitor) + + static int + virResctrlMonitorStatsSorter(const void *a, +- const void *b) ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + return (*(virResctrlMonitorStats **)a)->id + - (*(virResctrlMonitorStats **)b)->id; +@@ -2625,8 +2626,10 @@ virResctrlMonitorGetStats(virResctrlMonitor *monitor, + } + + /* Sort in id's ascending order */ +- if (*nstats) +- qsort(*stats, *nstats, sizeof(**stats), virResctrlMonitorStatsSorter); ++ if (*nstats) { ++ g_qsort_with_data(*stats, *nstats, sizeof(**stats), ++ virResctrlMonitorStatsSorter, NULL); ++ } + + ret = 0; + cleanup: +diff --git a/src/util/virstring.c b/src/util/virstring.c +index 6b728ff047..81c9aff304 100644 +--- a/src/util/virstring.c ++++ b/src/util/virstring.c +@@ -518,9 +518,11 @@ virStringIsEmpty(const char *str) + * virStringSortCompare: + * + * A comparator function for sorting strings in +- * normal order with qsort(). ++ * normal order with g_qsort_with_data(). + */ +-int virStringSortCompare(const void *a, const void *b) ++int virStringSortCompare(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + const char **sa = (const char**)a; + const char **sb = (const char**)b; +@@ -532,9 +534,11 @@ int virStringSortCompare(const void *a, const void *b) + * virStringSortRevCompare: + * + * A comparator function for sorting strings in +- * reverse order with qsort(). ++ * reverse order with g_qsort_with_data(). + */ +-int virStringSortRevCompare(const void *a, const void *b) ++int virStringSortRevCompare(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + const char **sa = (const char**)a; + const char **sb = (const char**)b; +diff --git a/src/util/virstring.h b/src/util/virstring.h +index 16dcce98f4..8f9b1edc8f 100644 +--- a/src/util/virstring.h ++++ b/src/util/virstring.h +@@ -83,8 +83,12 @@ bool virStringIsEmpty(const char *str); + int virStrcpy(char *dest, const char *src, size_t destbytes); + #define virStrcpyStatic(dest, src) virStrcpy((dest), (src), sizeof(dest)) + +-int virStringSortCompare(const void *a, const void *b); +-int virStringSortRevCompare(const void *a, const void *b); ++int virStringSortCompare(const void *a, ++ const void *b, ++ void *opaque); ++int virStringSortRevCompare(const void *a, ++ const void *b, ++ void *opaque); + int virStringToUpper(char **dst, const char *src); + + ssize_t virStringSearch(const char *str, +diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c +index ef3b8052f6..1be249d855 100644 +--- a/src/util/virtypedparam.c ++++ b/src/util/virtypedparam.c +@@ -43,7 +43,9 @@ VIR_ENUM_IMPL(virTypedParameter, + ); + + static int +-virTypedParamsSortName(const void *left, const void *right) ++virTypedParamsSortName(const void *left, ++ const void *right, ++ void *opaque G_GNUC_UNUSED) + { + const virTypedParameter *param_left = left, *param_right = right; + return strcmp(param_left->field, param_right->field); +@@ -78,7 +80,8 @@ virTypedParamsValidate(virTypedParameterPtr params, int nparams, ...) + + /* Here we intentionally don't copy values */ + memcpy(sorted, params, sizeof(*params) * nparams); +- qsort(sorted, nparams, sizeof(*sorted), virTypedParamsSortName); ++ g_qsort_with_data(sorted, nparams, ++ sizeof(*sorted), virTypedParamsSortName, NULL); + + name = va_arg(ap, const char *); + while (name) { +@@ -102,7 +105,7 @@ virTypedParamsValidate(virTypedParameterPtr params, int nparams, ...) + + va_end(ap); + +- qsort(keys, nkeys, sizeof(*keys), virTypedParamsSortName); ++ g_qsort_with_data(keys, nkeys, sizeof(*keys), virTypedParamsSortName, NULL); + + for (i = 0, j = 0; i < nparams && j < nkeys;) { + if (STRNEQ(sorted[i].field, keys[j].field)) { +diff --git a/tests/commandhelper.c b/tests/commandhelper.c +index 9b56feb120..9f28aa7674 100644 +--- a/tests/commandhelper.c ++++ b/tests/commandhelper.c +@@ -129,7 +129,9 @@ static void printArguments(FILE *log, int argc, char** argv) + } + } + +-static int envsort(const void *a, const void *b) ++static int envsort(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + const char *astr = *(const char**)a; + const char *bstr = *(const char**)b; +@@ -165,7 +167,7 @@ static int printEnvironment(FILE *log) + newenv[i] = environ[i]; + } + +- qsort(newenv, length, sizeof(newenv[0]), envsort); ++ g_qsort_with_data(newenv, length, sizeof(newenv[0]), envsort, NULL); + + for (i = 0; i < length; i++) { + /* Ignore the variables used to instruct the loader into +diff --git a/tests/virstringtest.c b/tests/virstringtest.c +index 6e697cc240..f4976890db 100644 +--- a/tests/virstringtest.c ++++ b/tests/virstringtest.c +@@ -89,10 +89,10 @@ testStringSortCompare(const void *opaque G_GNUC_UNUSED) + }; + size_t i; + +- qsort(randlist, G_N_ELEMENTS(randlist), sizeof(randlist[0]), +- virStringSortCompare); +- qsort(randrlist, G_N_ELEMENTS(randrlist), sizeof(randrlist[0]), +- virStringSortRevCompare); ++ g_qsort_with_data(randlist, G_N_ELEMENTS(randlist), ++ sizeof(randlist[0]), virStringSortCompare, NULL); ++ g_qsort_with_data(randrlist, G_N_ELEMENTS(randrlist), ++ sizeof(randrlist[0]), virStringSortRevCompare, NULL); + + for (i = 0; i < G_N_ELEMENTS(randlist); i++) { + if (STRNEQ(randlist[i], sortlist[i])) { +diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c +index 727de34abb..34bae34f9a 100644 +--- a/tools/virsh-checkpoint.c ++++ b/tools/virsh-checkpoint.c +@@ -526,7 +526,8 @@ virshCheckpointListFree(struct virshCheckpointList *checkpointlist) + + static int + virshChkSorter(const void *a, +- const void *b) ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + const struct virshChk *sa = a; + const struct virshChk *sb = b; +@@ -594,9 +595,10 @@ virshCheckpointListCollect(vshControl *ctl, + } + + if (!(orig_flags & VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL) && +- checkpointlist->chks) +- qsort(checkpointlist->chks, checkpointlist->nchks, +- sizeof(*checkpointlist->chks), virshChkSorter); ++ checkpointlist->chks) { ++ g_qsort_with_data(checkpointlist->chks, checkpointlist->nchks, ++ sizeof(*checkpointlist->chks), virshChkSorter, NULL); ++ } + + ret = g_steal_pointer(&checkpointlist); + +diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c +index 89fdc7a050..a2c56fc090 100644 +--- a/tools/virsh-domain-monitor.c ++++ b/tools/virsh-domain-monitor.c +@@ -1483,7 +1483,9 @@ static const vshCmdInfo info_list[] = { + + /* compare domains, pack NULLed ones at the end */ + static int +-virshDomainSorter(const void *a, const void *b) ++virshDomainSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virDomainPtr *da = (virDomainPtr *) a; + virDomainPtr *db = (virDomainPtr *) b; +@@ -1741,9 +1743,10 @@ virshDomainListCollect(vshControl *ctl, unsigned int flags) + + finished: + /* sort the list */ +- if (list->domains && list->ndomains) +- qsort(list->domains, list->ndomains, sizeof(*list->domains), +- virshDomainSorter); ++ if (list->domains && list->ndomains) { ++ g_qsort_with_data(list->domains, list->ndomains, ++ sizeof(*list->domains), virshDomainSorter, NULL); ++ } + + /* truncate the list if filter simulation deleted entries */ + if (deleted) +diff --git a/tools/virsh-host.c b/tools/virsh-host.c +index 4116481978..6c14be865f 100644 +--- a/tools/virsh-host.c ++++ b/tools/virsh-host.c +@@ -300,7 +300,9 @@ static const vshCmdOptDef opts_freepages[] = { + }; + + static int +-vshPageSizeSorter(const void *a, const void *b) ++vshPageSizeSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + unsigned int pa = *(unsigned int *)a; + unsigned int pb = *(unsigned int *)b; +@@ -377,7 +379,8 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd) + * @pagesize array will contain duplicates. We should + * remove them otherwise not very nice output will be + * produced. */ +- qsort(pagesize, nodes_cnt, sizeof(*pagesize), vshPageSizeSorter); ++ g_qsort_with_data(pagesize, nodes_cnt, ++ sizeof(*pagesize), vshPageSizeSorter, NULL); + + for (i = 0; i < nodes_cnt - 1;) { + if (pagesize[i] == pagesize[i + 1]) { +diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c +index 77c0fff847..09a3668438 100644 +--- a/tools/virsh-interface.c ++++ b/tools/virsh-interface.c +@@ -141,7 +141,9 @@ cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd) + } + + static int +-virshInterfaceSorter(const void *a, const void *b) ++virshInterfaceSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virInterfacePtr *ia = (virInterfacePtr *) a; + virInterfacePtr *ib = (virInterfacePtr *) b; +@@ -281,9 +283,10 @@ virshInterfaceListCollect(vshControl *ctl, + + finished: + /* sort the list */ +- if (list->ifaces && list->nifaces) +- qsort(list->ifaces, list->nifaces, +- sizeof(*list->ifaces), virshInterfaceSorter); ++ if (list->ifaces && list->nifaces) { ++ g_qsort_with_data(list->ifaces, list->nifaces, ++ sizeof(*list->ifaces), virshInterfaceSorter, NULL); ++ } + + /* truncate the list if filter simulation deleted entries */ + if (deleted) +diff --git a/tools/virsh-network.c b/tools/virsh-network.c +index 998e7e15e3..68c7543863 100644 +--- a/tools/virsh-network.c ++++ b/tools/virsh-network.c +@@ -791,7 +791,9 @@ cmdNetworkInfo(vshControl *ctl, const vshCmd *cmd) + } + + static int +-virshNetworkSorter(const void *a, const void *b) ++virshNetworkSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virNetworkPtr *na = (virNetworkPtr *) a; + virNetworkPtr *nb = (virNetworkPtr *) b; +@@ -982,9 +984,10 @@ virshNetworkListCollect(vshControl *ctl, + + finished: + /* sort the list */ +- if (list->nets && list->nnets) +- qsort(list->nets, list->nnets, +- sizeof(*list->nets), virshNetworkSorter); ++ if (list->nets && list->nnets) { ++ g_qsort_with_data(list->nets, list->nnets, ++ sizeof(*list->nets), virshNetworkSorter, NULL); ++ } + + /* truncate the list if filter simulation deleted entries */ + if (deleted) +@@ -1801,7 +1804,9 @@ static const vshCmdOptDef opts_network_dhcp_leases[] = { + }; + + static int +-virshNetworkDHCPLeaseSorter(const void *a, const void *b) ++virshNetworkDHCPLeaseSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virNetworkDHCPLeasePtr *lease1 = (virNetworkDHCPLeasePtr *) a; + virNetworkDHCPLeasePtr *lease2 = (virNetworkDHCPLeasePtr *) b; +@@ -1840,7 +1845,8 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd) + } + + /* Sort the list according to MAC Address/IAID */ +- qsort(leases, nleases, sizeof(*leases), virshNetworkDHCPLeaseSorter); ++ g_qsort_with_data(leases, nleases, ++ sizeof(*leases), virshNetworkDHCPLeaseSorter, NULL); + + table = vshTableNew(_("Expiry Time"), _("MAC address"), _("Protocol"), + _("IP address"), _("Hostname"), _("Client ID or DUID"), +@@ -2068,7 +2074,9 @@ cmdNetworkPortDelete(vshControl *ctl, const vshCmd *cmd) + + + static int +-virshNetworkPortSorter(const void *a, const void *b) ++virshNetworkPortSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virNetworkPortPtr *na = (virNetworkPortPtr *) a; + virNetworkPortPtr *nb = (virNetworkPortPtr *) b; +@@ -2129,9 +2137,10 @@ virshNetworkPortListCollect(vshControl *ctl, + list->nports = ret; + + /* sort the list */ +- if (list->ports && list->nports) +- qsort(list->ports, list->nports, +- sizeof(*list->ports), virshNetworkPortSorter); ++ if (list->ports && list->nports) { ++ g_qsort_with_data(list->ports, list->nports, ++ sizeof(*list->ports), virshNetworkPortSorter, NULL); ++ } + + success = true; + +diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c +index 82b8fb44fc..fb38fd7fcc 100644 +--- a/tools/virsh-nodedev.c ++++ b/tools/virsh-nodedev.c +@@ -183,7 +183,9 @@ virshNodeListLookup(int devid, bool parent, void *opaque) + } + + static int +-virshNodeDeviceSorter(const void *a, const void *b) ++virshNodeDeviceSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virNodeDevicePtr *na = (virNodeDevicePtr *) a; + virNodeDevicePtr *nb = (virNodeDevicePtr *) b; +@@ -334,9 +336,10 @@ virshNodeDeviceListCollect(vshControl *ctl, + + finished: + /* sort the list */ +- if (list->devices && list->ndevices) +- qsort(list->devices, list->ndevices, +- sizeof(*list->devices), virshNodeDeviceSorter); ++ if (list->devices && list->ndevices) { ++ g_qsort_with_data(list->devices, list->ndevices, ++ sizeof(*list->devices), virshNodeDeviceSorter, NULL); ++ } + + /* truncate the list if filter simulation deleted entries */ + if (deleted) +diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c +index 92b2b7b3bc..fa52d020e4 100644 +--- a/tools/virsh-nwfilter.c ++++ b/tools/virsh-nwfilter.c +@@ -220,7 +220,9 @@ cmdNWFilterDumpXML(vshControl *ctl, const vshCmd *cmd) + } + + static int +-virshNWFilterSorter(const void *a, const void *b) ++virshNWFilterSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virNWFilterPtr *fa = (virNWFilterPtr *) a; + virNWFilterPtr *fb = (virNWFilterPtr *) b; +@@ -323,9 +325,10 @@ virshNWFilterListCollect(vshControl *ctl, + + finished: + /* sort the list */ +- if (list->filters && list->nfilters) +- qsort(list->filters, list->nfilters, +- sizeof(*list->filters), virshNWFilterSorter); ++ if (list->filters && list->nfilters) { ++ g_qsort_with_data(list->filters, list->nfilters, ++ sizeof(*list->filters), virshNWFilterSorter, NULL); ++ } + + /* truncate the list for not found filter objects */ + if (deleted) +@@ -644,7 +647,9 @@ cmdNWFilterBindingDumpXML(vshControl *ctl, const vshCmd *cmd) + + + static int +-virshNWFilterBindingSorter(const void *a, const void *b) ++virshNWFilterBindingSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virNWFilterBindingPtr *fa = (virNWFilterBindingPtr *) a; + virNWFilterBindingPtr *fb = (virNWFilterBindingPtr *) b; +@@ -702,9 +707,10 @@ virshNWFilterBindingListCollect(vshControl *ctl, + list->nbindings = ret; + + /* sort the list */ +- if (list->bindings && list->nbindings > 1) +- qsort(list->bindings, list->nbindings, +- sizeof(*list->bindings), virshNWFilterBindingSorter); ++ if (list->bindings && list->nbindings > 1) { ++ g_qsort_with_data(list->bindings, list->nbindings, ++ sizeof(*list->bindings), virshNWFilterBindingSorter, NULL); ++ } + + success = true; + +diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c +index 5803530d79..36f00cf643 100644 +--- a/tools/virsh-pool.c ++++ b/tools/virsh-pool.c +@@ -814,7 +814,9 @@ cmdPoolDumpXML(vshControl *ctl, const vshCmd *cmd) + } + + static int +-virshStoragePoolSorter(const void *a, const void *b) ++virshStoragePoolSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virStoragePoolPtr *pa = (virStoragePoolPtr *) a; + virStoragePoolPtr *pb = (virStoragePoolPtr *) b; +@@ -1005,9 +1007,10 @@ virshStoragePoolListCollect(vshControl *ctl, + + finished: + /* sort the list */ +- if (list->pools && list->npools) +- qsort(list->pools, list->npools, +- sizeof(*list->pools), virshStoragePoolSorter); ++ if (list->pools && list->npools) { ++ g_qsort_with_data(list->pools, list->npools, ++ sizeof(*list->pools), virshStoragePoolSorter, NULL); ++ } + + /* truncate the list if filter simulation deleted entries */ + if (deleted) +diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c +index 694e16c5cb..e54712ba78 100644 +--- a/tools/virsh-secret.c ++++ b/tools/virsh-secret.c +@@ -399,7 +399,9 @@ cmdSecretUndefine(vshControl *ctl, const vshCmd *cmd) + } + + static int +-virshSecretSorter(const void *a, const void *b) ++virshSecretSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virSecretPtr *sa = (virSecretPtr *) a; + virSecretPtr *sb = (virSecretPtr *) b; +@@ -509,9 +511,10 @@ virshSecretListCollect(vshControl *ctl, + + finished: + /* sort the list */ +- if (list->secrets && list->nsecrets) +- qsort(list->secrets, list->nsecrets, +- sizeof(*list->secrets), virshSecretSorter); ++ if (list->secrets && list->nsecrets) { ++ g_qsort_with_data(list->secrets, list->nsecrets, ++ sizeof(*list->secrets), virshSecretSorter, NULL); ++ } + + /* truncate the list for not found secret objects */ + if (deleted) +diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c +index c85258c09a..2049872322 100644 +--- a/tools/virsh-snapshot.c ++++ b/tools/virsh-snapshot.c +@@ -982,7 +982,9 @@ virshSnapshotListFree(struct virshSnapshotList *snaplist) + } + + static int +-virshSnapSorter(const void *a, const void *b) ++virshSnapSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + const struct virshSnap *sa = a; + const struct virshSnap *sb = b; +@@ -1232,7 +1234,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom, + * still in list. We mark known descendants by clearing + * snaps[i].parents. Sorry, this is O(n^3) - hope your + * hierarchy isn't huge. XXX Is it worth making O(n^2 log n) +- * by using qsort and bsearch? */ ++ * by using g_qsort_with_data and bsearch? */ + if (start_index < 0) { + vshError(ctl, _("snapshot %1$s disappeared from list"), fromname); + goto cleanup; +@@ -1312,8 +1314,8 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom, + } + if (!(orig_flags & VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL) && + snaplist->snaps && snaplist->nsnaps) { +- qsort(snaplist->snaps, snaplist->nsnaps, sizeof(*snaplist->snaps), +- virshSnapSorter); ++ g_qsort_with_data(snaplist->snaps, snaplist->nsnaps, ++ sizeof(*snaplist->snaps), virshSnapSorter, NULL); + } + snaplist->nsnaps -= deleted; + +diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c +index 9a2b21d3f3..329ca3a66c 100644 +--- a/tools/virsh-volume.c ++++ b/tools/virsh-volume.c +@@ -1200,7 +1200,9 @@ cmdVolDumpXML(vshControl *ctl, const vshCmd *cmd) + } + + static int +-virshStorageVolSorter(const void *a, const void *b) ++virshStorageVolSorter(const void *a, ++ const void *b, ++ void *opaque G_GNUC_UNUSED) + { + virStorageVolPtr *va = (virStorageVolPtr *) a; + virStorageVolPtr *vb = (virStorageVolPtr *) b; +@@ -1299,8 +1301,10 @@ virshStorageVolListCollect(vshControl *ctl, + + finished: + /* sort the list */ +- if (list->vols && list->nvols) +- qsort(list->vols, list->nvols, sizeof(*list->vols), virshStorageVolSorter); ++ if (list->vols && list->nvols) { ++ g_qsort_with_data(list->vols, list->nvols, ++ sizeof(*list->vols), virshStorageVolSorter, NULL); ++ } + + if (deleted) + VIR_SHRINK_N(list->vols, list->nvols, deleted); +-- +2.43.0 + diff --git a/libvirt.spec b/libvirt.spec index 77cef71..1dcf022 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -259,6 +259,7 @@ Patch: 0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch Patch: 0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch Patch: 0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch Patch: 0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch +Patch: 0008-lib-Replace-qsort-with-g_qsort_with_data.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} From 8556d44e844606185500ae0c534d821f57a07ae8 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Dec 02 2023 17:22:48 +0000 Subject: [PATCH 8/19] libvirt-9.10.0-1 Update to version 9.10.0 --- diff --git a/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch b/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch deleted file mode 100644 index d726d50..0000000 --- a/0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch +++ /dev/null @@ -1,39 +0,0 @@ -From b049f42dda977b094895acdf348304ba2f4f1cd4 Mon Sep 17 00:00:00 2001 -From: Pavel Hrdina -Date: Fri, 3 Nov 2023 14:03:55 +0100 -Subject: [PATCH 1/8] qemu_process: fix crash in - qemuSaveImageDecompressionStart -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Commit changing the code to allow passing NULL as @data into -qemuSaveImageDecompressionStart() was not correct as it left the -original call into the function as well. - -Introduced-by: 2f3e582a1ac1008eba8d43c751cdba8712dd1614 -Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2247754 -Signed-off-by: Pavel Hrdina -Reviewed-by: Ján Tomko -(cherry picked from commit 4f4a8dce944e05311565b690a84f6bb1ef67c086) ---- - 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 1ef032dbd2..b9267d8699 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -8208,9 +8208,6 @@ qemuProcessStartWithMemoryState(virConnectPtr conn, - } - } - -- if (qemuSaveImageDecompressionStart(data, fd, &intermediatefd, &errbuf, &cmd) < 0) -- return -1; -- - /* No cookie means libvirt which saved the domain was too old to mess up - * the CPU definitions. - */ --- -2.43.0 - diff --git a/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch b/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch deleted file mode 100644 index 120e442..0000000 --- a/0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 982184d57fff654c1cccf0d4a4a5d1631058819d Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Mon, 20 Nov 2023 04:49:53 +0100 -Subject: [PATCH 2/8] vbox_snapshot_conf: Parse XMLs without net access -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When working with VirtualBox's snapshots, the snapshot XML is -firstly parsed, stored in memory (with some parts being stored as -verbatim XML snippets, strings), requested changes are made and -then this modified XML is formatted via -virVBoxSnapshotConfSaveVboxFile() which calls -xmlParseInNodeContext() to format those previously stored XML -snippets. - -The first parse of whole VirtualBox snapshot file is done using -virXMLParse() (in virVBoxSnapshotConfLoadVboxFile()) and thus -with XML_PARSE_NONET specified. - -But those ad-hoc parsings when formatting the XML back pass zero -flags mask: xmlParseInNodeContext(..., options = 0, ...); - -This is potentially dangerous. - -Signed-off-by: Michal Privoznik -Reviewed-by: Ján Tomko -(cherry picked from commit d8cb1cd50c608eb647fcb17c4347a2e9d5004e8d) ---- - src/vbox/vbox_snapshot_conf.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c -index 84f7aceac2..467255f77f 100644 ---- a/src/vbox/vbox_snapshot_conf.c -+++ b/src/vbox/vbox_snapshot_conf.c -@@ -369,6 +369,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, - int firstRegexResult = 0; - g_auto(GStrv) secondRegex = NULL; - int secondRegexResult = 0; -+ const int parseFlags = XML_PARSE_NONET; - - uuid = g_strdup_printf("{%s}", snapshot->uuid); - -@@ -406,7 +407,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, - parseError = xmlParseInNodeContext(node, - snapshot->hardware, - (int)strlen(snapshot->hardware), -- 0, -+ parseFlags, - &hardwareNode); - if (parseError != XML_ERR_OK) { - virReportError(VIR_ERR_XML_ERROR, "%s", -@@ -418,7 +419,7 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, - /* storageController */ - if (xmlParseInNodeContext(node, snapshot->storageController, - (int)strlen(snapshot->storageController), -- 0, -+ parseFlags, - &storageControllerNode) != XML_ERR_OK) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Unable to add the snapshot storageController")); -@@ -944,6 +945,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, - int firstRegexResult = 0; - g_auto(GStrv) secondRegex = NULL; - int secondRegexResult = 0; -+ const int parseFlags = XML_PARSE_NONET; - - if (machine == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -@@ -1051,7 +1053,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, - parseError = xmlParseInNodeContext(mediaRegistryNode, - machine->mediaRegistry->otherMedia[i], - (int)strlen(machine->mediaRegistry->otherMedia[i]), -- 0, -+ parseFlags, - &cur); - if (parseError != XML_ERR_OK) { - virReportError(VIR_ERR_XML_ERROR, "%s", -@@ -1071,7 +1073,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, - parseError = xmlParseInNodeContext(machineNode, - machine->hardware, - (int)strlen(machine->hardware), -- 0, -+ parseFlags, - &cur); - if (parseError != XML_ERR_OK) { - virReportError(VIR_ERR_XML_ERROR, "%s", -@@ -1084,7 +1086,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, - parseError = xmlParseInNodeContext(xmlDocGetRootElement(xml), - machine->extraData, - (int)strlen(machine->extraData), -- 0, -+ parseFlags, - &cur); - if (parseError != XML_ERR_OK) { - virReportError(VIR_ERR_XML_ERROR, "%s", -@@ -1097,7 +1099,7 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, - parseError = xmlParseInNodeContext(machineNode, - machine->storageController, - (int)strlen(machine->storageController), -- 0, -+ parseFlags, - &cur); - if (parseError != XML_ERR_OK) { - virReportError(VIR_ERR_XML_ERROR, "%s", --- -2.43.0 - diff --git a/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch b/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch deleted file mode 100644 index a545954..0000000 --- a/0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch +++ /dev/null @@ -1,76 +0,0 @@ -From ee3f790a24ec16308e016f9e7dc1cc5e29a6a525 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Tue, 21 Nov 2023 10:40:36 +0100 -Subject: [PATCH 3/8] vbox_snapshot_conf: Keep indent in snapshot XML -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -As mentioned in previous commit, VirtualBox has its own snapshot -XML which we parse, change and then format back. During this, we -ought to keep the indentation to produce better looking result -(especially when we want to compare the output in tests later on, -like we do in vboxsnapshotxmltest). - -Signed-off-by: Michal Privoznik -Reviewed-by: Ján Tomko -(cherry picked from commit d1f58b10f687050dd097c5a60becf62c35deee68) ---- - src/vbox/vbox_snapshot_conf.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c -index 467255f77f..89cd685954 100644 ---- a/src/vbox/vbox_snapshot_conf.c -+++ b/src/vbox/vbox_snapshot_conf.c -@@ -25,6 +25,7 @@ - #include "virstring.h" - #include "virxml.h" - -+#include - #include - - #define VIR_FROM_THIS VIR_FROM_VBOX -@@ -364,12 +365,11 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, - xmlParserErrors parseError = XML_ERR_OK; - char *uuid = NULL; - char *timeStamp = NULL; -- - g_auto(GStrv) firstRegex = NULL; - int firstRegexResult = 0; - g_auto(GStrv) secondRegex = NULL; - int secondRegexResult = 0; -- const int parseFlags = XML_PARSE_NONET; -+ const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOBLANKS; - - uuid = g_strdup_printf("{%s}", snapshot->uuid); - -@@ -940,12 +940,14 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, - xmlParserErrors parseError = XML_ERR_OK; - char *currentSnapshot = NULL; - char *timeStamp = NULL; -- - g_auto(GStrv) firstRegex = NULL; - int firstRegexResult = 0; - g_auto(GStrv) secondRegex = NULL; - int secondRegexResult = 0; -- const int parseFlags = XML_PARSE_NONET; -+ const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOBLANKS; -+ int oldIndentTreeOutput = xmlIndentTreeOutput; -+ -+ xmlIndentTreeOutput = 1; - - if (machine == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -@@ -1127,6 +1129,8 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, - ret = 0; - - cleanup: -+ xmlIndentTreeOutput = oldIndentTreeOutput; -+ - VIR_FREE(currentSnapshot); - VIR_FREE(timeStamp); - --- -2.43.0 - diff --git a/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch b/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch deleted file mode 100644 index 922d5a8..0000000 --- a/0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 09f06f6286f864fefdf4877b5792999e0d4e89d1 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Mon, 20 Nov 2023 03:18:12 +0100 -Subject: [PATCH 4/8] virxml: include for - xmlIndentTreeOutput declaration -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -After libxml2's commit of v2.12.0~101 we no longer get -xmlIndentTreeOutput declaration by us including just -libxml/xpathInternals.h and libxml2's header files leakage. - -Resolves: https://bugs.gentoo.org/917516 -Signed-off-by: Michal Privoznik -Reviewed-by: Ján Tomko -(cherry picked from commit 7a5f232be2269e74943a029c0e8b1b0124674a6c) ---- - src/util/virxml.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/util/virxml.c b/src/util/virxml.c -index 0c1eae8c3c..4f215a0e59 100644 ---- a/src/util/virxml.c -+++ b/src/util/virxml.c -@@ -24,6 +24,7 @@ - #include /* for isnan() */ - #include - -+#include - #include - - #include "virerror.h" --- -2.43.0 - diff --git a/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch b/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch deleted file mode 100644 index b4f1ff1..0000000 --- a/0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 68a14369033486ad9e02cb144cde2aced7351ce2 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Sat, 18 Nov 2023 04:17:47 +0100 -Subject: [PATCH 5/8] virXMLParseHelper: Store XML parsing flags in a variable -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The virXMLParseHelper() can work in two modes: either it parses a -file or a string. Either way, the same set of flags is specified -in call of corresponding function. Save flags in a local variable -instead. - -Signed-off-by: Michal Privoznik -Reviewed-by: Ján Tomko -(cherry picked from commit 1beb69df877596fe57efc8d8a117a30a72e5d04e) ---- - src/util/virxml.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -diff --git a/src/util/virxml.c b/src/util/virxml.c -index 4f215a0e59..027cdb97b9 100644 ---- a/src/util/virxml.c -+++ b/src/util/virxml.c -@@ -1136,6 +1136,7 @@ virXMLParseHelper(int domcode, - g_autoptr(xmlDoc) xml = NULL; - xmlNodePtr rootnode; - const char *docname; -+ const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOWARNING; - - if (filename) - docname = filename; -@@ -1154,13 +1155,9 @@ virXMLParseHelper(int domcode, - pctxt->sax->error = catchXMLError; - - if (filename) { -- xml = xmlCtxtReadFile(pctxt, filename, NULL, -- XML_PARSE_NONET | -- XML_PARSE_NOWARNING); -+ xml = xmlCtxtReadFile(pctxt, filename, NULL, parseFlags); - } else { -- xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL, -- XML_PARSE_NONET | -- XML_PARSE_NOWARNING); -+ xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL, parseFlags); - } - - if (!xml) { --- -2.43.0 - diff --git a/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch b/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch deleted file mode 100644 index 68949fc..0000000 --- a/0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 6371a0d85b6febd8e034eeec02d70c551535ad5b Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Tue, 21 Nov 2023 10:39:58 +0100 -Subject: [PATCH 6/8] virxml: Introduce parsing APIs that keep indentation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When parsing an XML it may be important to keep indentation to -produce a better looking result when formatting the XML back. -Just look at all those xmlKeepBlanksDefault() calls just before -virXMLParse() is called. - -Anyway, as of libxml2 commit v2.12.0~108 xmlKeepBlanksDefault() -is deprecated. Therefore, introduce virXMLParse...WithIndent() -variants which would do exactly xmlKeepBlanksDefault() did but -with non-deprecated APIs. - -Signed-off-by: Michal Privoznik -Reviewed-by: Ján Tomko -(cherry picked from commit 69958ba3102810bb4f90a91d2f6d9032e1a1da2d) ---- - src/util/virxml.c | 9 +++++++-- - src/util/virxml.h | 29 +++++++++++++++++++++++++---- - 2 files changed, 32 insertions(+), 6 deletions(-) - -diff --git a/src/util/virxml.c b/src/util/virxml.c -index 027cdb97b9..6d0c8f0311 100644 ---- a/src/util/virxml.c -+++ b/src/util/virxml.c -@@ -1129,14 +1129,15 @@ virXMLParseHelper(int domcode, - const char *rootelement, - xmlXPathContextPtr *ctxt, - const char *schemafile, -- bool validate) -+ bool validate, -+ bool keepindent) - { - struct virParserData private; - g_autoptr(xmlParserCtxt) pctxt = NULL; - g_autoptr(xmlDoc) xml = NULL; - xmlNodePtr rootnode; - const char *docname; -- const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOWARNING; -+ int parseFlags = XML_PARSE_NONET | XML_PARSE_NOWARNING; - - if (filename) - docname = filename; -@@ -1154,6 +1155,10 @@ virXMLParseHelper(int domcode, - pctxt->_private = &private; - pctxt->sax->error = catchXMLError; - -+ if (keepindent) { -+ parseFlags |= XML_PARSE_NOBLANKS; -+ } -+ - if (filename) { - xml = xmlCtxtReadFile(pctxt, filename, NULL, parseFlags); - } else { -diff --git a/src/util/virxml.h b/src/util/virxml.h -index 7af47437bd..03a85bfb25 100644 ---- a/src/util/virxml.h -+++ b/src/util/virxml.h -@@ -199,7 +199,8 @@ virXMLParseHelper(int domcode, - const char *rootelement, - xmlXPathContextPtr *ctxt, - const char *schemafile, -- bool validate); -+ bool validate, -+ bool keepindent); - - const char * - virXMLPickShellSafeComment(const char *str1, -@@ -219,7 +220,17 @@ virXMLPickShellSafeComment(const char *str1, - * Return the parsed document object, or NULL on failure. - */ - #define virXMLParse(filename, xmlStr, url, rootelement, ctxt, schemafile, validate) \ -- virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, rootelement, ctxt, schemafile, validate) -+ virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, rootelement, ctxt, schemafile, validate, false) -+ -+/** -+ * virXMLParseWithIndent: -+ * -+ * Just like virXMLParse, except indentation is preserved. Should be used when -+ * facing an user provided XML which may be formatted back and keeping verbatim -+ * spacing is necessary (e.g. due to ). -+ */ -+#define virXMLParseWithIndent(filename, xmlStr, url, rootelement, ctxt, schemafile, validate) \ -+ virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, rootelement, ctxt, schemafile, validate, true) - - /** - * virXMLParseStringCtxt: -@@ -233,7 +244,17 @@ virXMLPickShellSafeComment(const char *str1, - * Return the parsed document object, or NULL on failure. - */ - #define virXMLParseStringCtxt(xmlStr, url, pctxt) \ -- virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, pctxt, NULL, false) -+ virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, pctxt, NULL, false, false) -+ -+/** -+ * virXMLParseStringCtxtWithIndent: -+ * -+ * Just like virXMLParseStringCtxt, except indentation is preserved. Should be -+ * used when facing an user provided XML which may be formatted back and -+ * keeping verbatim spacing is necessary (e.g. due to ). -+ */ -+#define virXMLParseStringCtxtWithIndent(xmlStr, url, pctxt) \ -+ virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, pctxt, NULL, false, true) - - /** - * virXMLParseFileCtxt: -@@ -246,7 +267,7 @@ virXMLPickShellSafeComment(const char *str1, - * Return the parsed document object, or NULL on failure. - */ - #define virXMLParseFileCtxt(filename, pctxt) \ -- virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, NULL, pctxt, NULL, false) -+ virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, NULL, pctxt, NULL, false, false) - - int - virXMLSaveFile(const char *path, --- -2.43.0 - diff --git a/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch b/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch deleted file mode 100644 index 6235d5d..0000000 --- a/0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 215a4afe93c051e35d09fabea19172ab51959737 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Mon, 20 Nov 2023 16:20:51 +0100 -Subject: [PATCH 7/8] lib: Replace xmlKeepBlanksDefault() with - virXMLParseWithIndent() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Now that we have virXMLParseWithIndent() and -virXMLParseStringCtxtWithIndent(), we can use them directly and -drop calls to xmlKeepBlanksDefault(). - -Signed-off-by: Michal Privoznik -Reviewed-by: Ján Tomko -(cherry picked from commit 1fdca3083b52507d7a99f6e9b84e91d8df68013e) ---- - src/conf/backup_conf.c | 8 +++----- - src/conf/checkpoint_conf.c | 8 +++----- - src/conf/domain_conf.c | 11 +++-------- - src/conf/network_conf.c | 6 ++---- - src/conf/snapshot_conf.c | 8 +++----- - tools/virsh-util.c | 5 +---- - 6 files changed, 15 insertions(+), 31 deletions(-) - -diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c -index e151c29738..1fea6a2be7 100644 ---- a/src/conf/backup_conf.c -+++ b/src/conf/backup_conf.c -@@ -276,13 +276,11 @@ virDomainBackupDefParseString(const char *xmlStr, - { - g_autoptr(xmlDoc) xml = NULL; - g_autoptr(xmlXPathContext) ctxt = NULL; -- int keepBlanksDefault = xmlKeepBlanksDefault(0); - bool validate = !(flags & VIR_DOMAIN_BACKUP_PARSE_INTERNAL); - -- xml = virXMLParse(NULL, xmlStr, _("(domain_backup)"), -- "domainbackup", &ctxt, "domainbackup.rng", validate); -- -- xmlKeepBlanksDefault(keepBlanksDefault); -+ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_backup)"), -+ "domainbackup", &ctxt, "domainbackup.rng", -+ validate); - - if (!xml) - return NULL; -diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c -index 89f8675235..3c797f0f5b 100644 ---- a/src/conf/checkpoint_conf.c -+++ b/src/conf/checkpoint_conf.c -@@ -192,12 +192,10 @@ virDomainCheckpointDefParseString(const char *xmlStr, - { - g_autoptr(xmlDoc) xml = NULL; - g_autoptr(xmlXPathContext) ctxt = NULL; -- int keepBlanksDefault = xmlKeepBlanksDefault(0); - -- xml = virXMLParse(NULL, xmlStr, _("(domain_checkpoint)"), -- "domaincheckpoint", &ctxt, "domaincheckpoint.rng", true); -- -- xmlKeepBlanksDefault(keepBlanksDefault); -+ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_checkpoint)"), -+ "domaincheckpoint", &ctxt, -+ "domaincheckpoint.rng", true); - - if (!xml) - return NULL; -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 80f467ae7a..2b6f765b6d 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -19503,13 +19503,10 @@ virDomainDefParse(const char *xmlStr, - { - g_autoptr(xmlDoc) xml = NULL; - g_autoptr(xmlXPathContext) ctxt = NULL; -- int keepBlanksDefault = xmlKeepBlanksDefault(0); - bool validate = flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; - -- xml = virXMLParse(filename, xmlStr, _("(domain_definition)"), -- "domain", &ctxt, "domain.rng", validate); -- -- xmlKeepBlanksDefault(keepBlanksDefault); -+ xml = virXMLParseWithIndent(filename, xmlStr, _("(domain_definition)"), -+ "domain", &ctxt, "domain.rng", validate); - - if (!xml) - return NULL; -@@ -19566,10 +19563,8 @@ virDomainObjParseFile(const char *filename, - { - g_autoptr(xmlDoc) xml = NULL; - g_autoptr(xmlXPathContext) ctxt = NULL; -- int keepBlanksDefault = xmlKeepBlanksDefault(0); - -- xml = virXMLParse(filename, NULL, NULL, "domstatus", &ctxt, NULL, false); -- xmlKeepBlanksDefault(keepBlanksDefault); -+ xml = virXMLParseWithIndent(filename, NULL, NULL, "domstatus", &ctxt, NULL, false); - - if (!xml) - return NULL; -diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c -index 1a6fd86180..0449b6f07c 100644 ---- a/src/conf/network_conf.c -+++ b/src/conf/network_conf.c -@@ -1962,11 +1962,9 @@ virNetworkDefParse(const char *xmlStr, - { - g_autoptr(xmlDoc) xml = NULL; - g_autoptr(xmlXPathContext) ctxt = NULL; -- int keepBlanksDefault = xmlKeepBlanksDefault(0); - -- xml = virXMLParse(filename, xmlStr, _("(network_definition)"), -- "network", &ctxt, "network.rng", validate); -- xmlKeepBlanksDefault(keepBlanksDefault); -+ xml = virXMLParseWithIndent(filename, xmlStr, _("(network_definition)"), -+ "network", &ctxt, "network.rng", validate); - - if (!xml) - return NULL; -diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c -index 4b0555eb8c..d7fcded302 100644 ---- a/src/conf/snapshot_conf.c -+++ b/src/conf/snapshot_conf.c -@@ -426,13 +426,11 @@ virDomainSnapshotDefParseString(const char *xmlStr, - { - g_autoptr(xmlXPathContext) ctxt = NULL; - g_autoptr(xmlDoc) xml = NULL; -- int keepBlanksDefault = xmlKeepBlanksDefault(0); - bool validate = flags & VIR_DOMAIN_SNAPSHOT_PARSE_VALIDATE; - -- xml = virXMLParse(NULL, xmlStr, _("(domain_snapshot)"), -- "domainsnapshot", &ctxt, "domainsnapshot.rng", validate); -- -- xmlKeepBlanksDefault(keepBlanksDefault); -+ xml = virXMLParseWithIndent(NULL, xmlStr, _("(domain_snapshot)"), -+ "domainsnapshot", &ctxt, "domainsnapshot.rng", -+ validate); - - if (!xml) - return NULL; -diff --git a/tools/virsh-util.c b/tools/virsh-util.c -index fb6327613a..a6026eed53 100644 ---- a/tools/virsh-util.c -+++ b/tools/virsh-util.c -@@ -474,16 +474,13 @@ virshDumpXML(vshControl *ctl, - g_autofree xmlNodePtr *nodes = NULL; - int nnodes = 0; - size_t i; -- int oldblanks; - - if (xpath == NULL) { - vshPrint(ctl, "%s", xml); - return true; - } - -- oldblanks = xmlKeepBlanksDefault(0); -- doc = virXMLParseStringCtxt(xml, url, &ctxt); -- xmlKeepBlanksDefault(oldblanks); -+ doc = virXMLParseStringCtxtWithIndent(xml, url, &ctxt); - if (!doc) - return false; - --- -2.43.0 - diff --git a/0008-lib-Replace-qsort-with-g_qsort_with_data.patch b/0008-lib-Replace-qsort-with-g_qsort_with_data.patch deleted file mode 100644 index 4dd70f2..0000000 --- a/0008-lib-Replace-qsort-with-g_qsort_with_data.patch +++ /dev/null @@ -1,976 +0,0 @@ -From e1973fb24917234e552a711de16e2fc19f477b63 Mon Sep 17 00:00:00 2001 -From: Michal Privoznik -Date: Wed, 22 Nov 2023 14:58:49 +0100 -Subject: [PATCH 8/8] lib: Replace qsort() with g_qsort_with_data() - -While glibc provides qsort(), which usually is just a mergesort, -until sorting arrays so huge that temporary array used by -mergesort would not fit into physical memory (which in our case -is never), we are not guaranteed it'll use mergesort. The -advantage of mergesort is clear - it's stable. IOW, if we have an -array of values parsed from XML, qsort() it and produce some -output based on those values, we can then compare the output with -some expected output, line by line. - -But with newer glibc this is all history. After [1], qsort() is -no longer mergesort but introsort instead, which is not stable. -This is suboptimal, because in some cases we want to preserve -order of equal items. For instance, in ebiptablesApplyNewRules(), -nwfilter rules are sorted by their priority. But if two rules -have the same priority, we want to keep them in the order they -appear in the XML. Since it's hard/needless work to identify -places where stable or unstable sorting is needed, let's just -play it safe and use stable sorting everywhere. - -Fortunately, glib provides g_qsort_with_data() which indeed -implement mergesort and it's a drop in replacement for qsort(), -almost. It accepts fifth argument (pointer to opaque data), that -is passed to comparator function, which then accepts three -arguments. - -We have to keep one occurance of qsort() though - in NSS module -which deliberately does not link with glib. - -1: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=03bf8357e8291857a435afcc3048e0b697b6cc04 -Signed-off-by: Michal Privoznik -Reviewed-by: Martin Kletzander -(cherry picked from commit cfcbba4c2b8a2062dec36072a34209229b6c3277) ---- - build-aux/Makefile.nonreentrant | 1 - - build-aux/syntax-check.mk | 2 +- - src/conf/capabilities.c | 8 ++++--- - src/conf/domain_conf.c | 6 +++-- - src/cpu/cpu.c | 7 +++--- - src/cpu/cpu_x86.c | 15 +++++++----- - src/lxc/lxc_container.c | 3 ++- - src/nwfilter/nwfilter_ebiptables_driver.c | 29 +++++++++++++++-------- - src/qemu/qemu_monitor_json.c | 6 +++-- - src/qemu/qemu_process.c | 7 +++--- - src/security/security_manager.c | 9 ++++--- - src/util/virfile.c | 8 ++++--- - src/util/virhash.c | 9 ++++--- - src/util/virresctrl.c | 9 ++++--- - src/util/virstring.c | 12 ++++++---- - src/util/virstring.h | 8 +++++-- - src/util/virtypedparam.c | 9 ++++--- - tests/commandhelper.c | 6 +++-- - tests/virstringtest.c | 8 +++---- - tools/virsh-checkpoint.c | 10 ++++---- - tools/virsh-domain-monitor.c | 11 +++++---- - tools/virsh-host.c | 7 ++++-- - tools/virsh-interface.c | 11 +++++---- - tools/virsh-network.c | 29 +++++++++++++++-------- - tools/virsh-nodedev.c | 11 +++++---- - tools/virsh-nwfilter.c | 22 ++++++++++------- - tools/virsh-pool.c | 11 +++++---- - tools/virsh-secret.c | 11 +++++---- - tools/virsh-snapshot.c | 10 ++++---- - tools/virsh-volume.c | 10 +++++--- - 30 files changed, 195 insertions(+), 110 deletions(-) - -diff --git a/build-aux/Makefile.nonreentrant b/build-aux/Makefile.nonreentrant -index 87bb9db20e..b869c645ce 100644 ---- a/build-aux/Makefile.nonreentrant -+++ b/build-aux/Makefile.nonreentrant -@@ -21,7 +21,6 @@ - # | grep '_r$' \ - # | awk '{print $3}' \ - # | grep -v __ \ --# | grep -v qsort \ # Red herring since we don't need to pass extra args to qsort comparator - # | grep -v readdir \ # This is safe as long as each DIR * instance is only used by one thread - # | sort \ - # | uniq \ -diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk -index 7af7d20d70..ad2ecd50c7 100644 ---- a/build-aux/syntax-check.mk -+++ b/build-aux/syntax-check.mk -@@ -380,7 +380,7 @@ sc_prohibit_unsigned_pid: - # Many of the function names below came from this filter: - # git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \ - # |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \ --# |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$' -+# |grep -vE '^(if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$' - - msg_gen_function = - msg_gen_function += VIR_ERROR -diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c -index 34f04cb7d3..32badee7b3 100644 ---- a/src/conf/capabilities.c -+++ b/src/conf/capabilities.c -@@ -2073,7 +2073,8 @@ virCapsHostCacheBankFree(virCapsHostCacheBank *ptr) - - static int - virCapsHostCacheBankSorter(const void *a, -- const void *b) -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virCapsHostCacheBank *ca = *(virCapsHostCacheBank **)a; - virCapsHostCacheBank *cb = *(virCapsHostCacheBank **)b; -@@ -2273,8 +2274,9 @@ virCapabilitiesInitCaches(virCaps *caps) - * still traverse the directory instead of guessing names (in case there is - * 'index1' and 'index3' but no 'index2'). */ - if (caps->host.cache.banks) { -- qsort(caps->host.cache.banks, caps->host.cache.nbanks, -- sizeof(*caps->host.cache.banks), virCapsHostCacheBankSorter); -+ g_qsort_with_data(caps->host.cache.banks, caps->host.cache.nbanks, -+ sizeof(*caps->host.cache.banks), -+ virCapsHostCacheBankSorter, NULL); - } - - if (virCapabilitiesInitResctrlMemory(caps) < 0) -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 2b6f765b6d..aede47a130 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -15703,7 +15703,9 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, - } - - --static int virDomainIdMapEntrySort(const void *a, const void *b) -+static int virDomainIdMapEntrySort(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - const virDomainIdMapEntry *entrya = a; - const virDomainIdMapEntry *entryb = b; -@@ -15746,7 +15748,7 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, - } - } - -- qsort(idmap, num, sizeof(idmap[0]), virDomainIdMapEntrySort); -+ g_qsort_with_data(idmap, num, sizeof(idmap[0]), virDomainIdMapEntrySort, NULL); - - return idmap; - } -diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c -index bb5737e938..bc43aa4e93 100644 ---- a/src/cpu/cpu.c -+++ b/src/cpu/cpu.c -@@ -1045,7 +1045,8 @@ virCPUConvertLegacy(virArch arch, - - static int - virCPUFeatureCompare(const void *p1, -- const void *p2) -+ const void *p2, -+ void *opaque G_GNUC_UNUSED) - { - const virCPUFeatureDef *f1 = p1; - const virCPUFeatureDef *f2 = p2; -@@ -1085,8 +1086,8 @@ virCPUExpandFeatures(virArch arch, - driver->expandFeatures(cpu) < 0) - return -1; - -- qsort(cpu->features, cpu->nfeatures, sizeof(*cpu->features), -- virCPUFeatureCompare); -+ g_qsort_with_data(cpu->features, cpu->nfeatures, sizeof(*cpu->features), -+ virCPUFeatureCompare, NULL); - - VIR_DEBUG("nfeatures=%zu", cpu->nfeatures); - return 0; -diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c -index 7a7f3b409d..8d0e3947ce 100644 ---- a/src/cpu/cpu_x86.c -+++ b/src/cpu/cpu_x86.c -@@ -393,7 +393,9 @@ x86FeatureFindInternal(const char *name) - - - static int --virCPUx86DataSorter(const void *a, const void *b) -+virCPUx86DataSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virCPUx86DataItem *da = (virCPUx86DataItem *) a; - virCPUx86DataItem *db = (virCPUx86DataItem *) b; -@@ -437,7 +439,7 @@ static int - virCPUx86DataItemCmp(const virCPUx86DataItem *item1, - const virCPUx86DataItem *item2) - { -- return virCPUx86DataSorter(item1, item2); -+ return virCPUx86DataSorter(item1, item2, NULL); - } - - -@@ -541,8 +543,9 @@ virCPUx86DataAddItem(virCPUx86Data *data, - VIR_APPEND_ELEMENT_COPY(data->items, data->len, - *((virCPUx86DataItem *)item)); - -- qsort(data->items, data->len, -- sizeof(virCPUx86DataItem), virCPUx86DataSorter); -+ g_qsort_with_data(data->items, data->len, -+ sizeof(virCPUx86DataItem), -+ virCPUx86DataSorter, NULL); - } - - return 0; -@@ -3465,8 +3468,8 @@ virCPUx86DataGetHost(void) - } - - /* the rest of the code expects the function to be in order */ -- qsort(cpuid->data.x86.items, cpuid->data.x86.len, -- sizeof(virCPUx86DataItem), virCPUx86DataSorter); -+ g_qsort_with_data(cpuid->data.x86.items, cpuid->data.x86.len, -+ sizeof(virCPUx86DataItem), virCPUx86DataSorter, NULL); - - return cpuid; - } -diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c -index 35a882171b..652697890f 100644 ---- a/src/lxc/lxc_container.c -+++ b/src/lxc/lxc_container.c -@@ -791,7 +791,8 @@ static int lxcContainerSetReadOnly(void) - if (!mounts) - return 0; - -- qsort(mounts, nmounts, sizeof(mounts[0]), virStringSortRevCompare); -+ g_qsort_with_data(mounts, nmounts, -+ sizeof(mounts[0]), virStringSortRevCompare, NULL); - - /* turn 'mounts' into a proper GStrv */ - VIR_EXPAND_N(mounts, nmounts, 1); -diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c -index 1c5da2ae05..56bddb9097 100644 ---- a/src/nwfilter/nwfilter_ebiptables_driver.c -+++ b/src/nwfilter/nwfilter_ebiptables_driver.c -@@ -3087,7 +3087,9 @@ virNWFilterRuleInstSort(const void *a, const void *b) - - - static int --virNWFilterRuleInstSortPtr(const void *a, const void *b) -+virNWFilterRuleInstSortPtr(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virNWFilterRuleInst * const *insta = a; - virNWFilterRuleInst * const *instb = b; -@@ -3097,7 +3099,8 @@ virNWFilterRuleInstSortPtr(const void *a, const void *b) - - static int - ebiptablesFilterOrderSort(const void *va, -- const void *vb) -+ const void *vb, -+ void *opaque G_GNUC_UNUSED) - { - const virHashKeyValuePair *a = va; - const virHashKeyValuePair *b = vb; -@@ -3244,7 +3247,9 @@ struct _ebtablesSubChainInst { - - - static int --ebtablesSubChainInstSort(const void *a, const void *b) -+ebtablesSubChainInstSort(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - const ebtablesSubChainInst **insta = (const ebtablesSubChainInst **)a; - const ebtablesSubChainInst **instb = (const ebtablesSubChainInst **)b; -@@ -3268,7 +3273,8 @@ ebtablesGetSubChainInsts(GHashTable *chains, - if (filter_names == NULL) - return -1; - -- qsort(filter_names, nfilter_names, sizeof(*filter_names), ebiptablesFilterOrderSort); -+ g_qsort_with_data(filter_names, nfilter_names, -+ sizeof(*filter_names), ebiptablesFilterOrderSort, NULL); - - for (i = 0; filter_names[i].key; i++) { - g_autofree ebtablesSubChainInst *inst = NULL; -@@ -3306,9 +3312,10 @@ ebiptablesApplyNewRules(const char *ifname, - size_t nsubchains = 0; - int ret = -1; - -- if (nrules) -- qsort(rules, nrules, sizeof(rules[0]), -- virNWFilterRuleInstSortPtr); -+ if (nrules) { -+ g_qsort_with_data(rules, nrules, sizeof(rules[0]), -+ virNWFilterRuleInstSortPtr, NULL); -+ } - - /* cleanup whatever may exist */ - virFirewallStartTransaction(fw, VIR_FIREWALL_TRANSACTION_IGNORE_ERRORS); -@@ -3388,9 +3395,11 @@ ebiptablesApplyNewRules(const char *ifname, - goto cleanup; - } - -- if (nsubchains > 0) -- qsort(subchains, nsubchains, sizeof(subchains[0]), -- ebtablesSubChainInstSort); -+ if (nsubchains > 0) { -+ g_qsort_with_data(subchains, nsubchains, -+ sizeof(subchains[0]), -+ ebtablesSubChainInstSort, NULL); -+ } - - for (i = 0, j = 0; i < nrules; i++) { - if (virNWFilterRuleIsProtocolEthernet(rules[i]->def)) { -diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c -index 105d729d7c..6f1dffe8f7 100644 ---- a/src/qemu/qemu_monitor_json.c -+++ b/src/qemu/qemu_monitor_json.c -@@ -7607,7 +7607,8 @@ qemuMonitorJSONProcessHotpluggableCpusReply(virJSONValue *vcpu, - - static int - qemuMonitorQueryHotpluggableCpusEntrySort(const void *p1, -- const void *p2) -+ const void *p2, -+ void *opaque G_GNUC_UNUSED) - { - const struct qemuMonitorQueryHotpluggableCpusEntry *a = p1; - const struct qemuMonitorQueryHotpluggableCpusEntry *b = p2; -@@ -7659,7 +7660,8 @@ qemuMonitorJSONGetHotpluggableCPUs(qemuMonitor *mon, - goto cleanup; - } - -- qsort(info, ninfo, sizeof(*info), qemuMonitorQueryHotpluggableCpusEntrySort); -+ g_qsort_with_data(info, ninfo, sizeof(*info), -+ qemuMonitorQueryHotpluggableCpusEntrySort, NULL); - - *entries = g_steal_pointer(&info); - *nentries = ninfo; -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index b9267d8699..f32e82bbd1 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -6093,7 +6093,8 @@ qemuDomainHasHotpluggableStartupVcpus(virDomainDef *def) - - static int - qemuProcessVcpusSortOrder(const void *a, -- const void *b) -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virDomainVcpuDef *vcpua = *((virDomainVcpuDef **)a); - virDomainVcpuDef *vcpub = *((virDomainVcpuDef **)b); -@@ -6133,8 +6134,8 @@ qemuProcessSetupHotpluggableVcpus(virDomainObj *vm, - if (nbootHotplug == 0) - return 0; - -- qsort(bootHotplug, nbootHotplug, sizeof(*bootHotplug), -- qemuProcessVcpusSortOrder); -+ g_qsort_with_data(bootHotplug, nbootHotplug, -+ sizeof(*bootHotplug), qemuProcessVcpusSortOrder, NULL); - - if (virDomainCgroupEmulatorAllNodesAllow(priv->cgroup, &emulatorCgroup) < 0) - goto cleanup; -diff --git a/src/security/security_manager.c b/src/security/security_manager.c -index 5df0cd3419..afd41f1c20 100644 ---- a/src/security/security_manager.c -+++ b/src/security/security_manager.c -@@ -1247,7 +1247,9 @@ virSecurityManagerRestoreNetdevLabel(virSecurityManager *mgr, - - - static int --cmpstringp(const void *p1, const void *p2) -+cmpstringp(const void *p1, -+ const void *p2, -+ void *opaque G_GNUC_UNUSED) - { - const char *s1 = *(char * const *) p1; - const char *s2 = *(char * const *) p2; -@@ -1303,8 +1305,9 @@ virSecurityManagerMetadataLock(virSecurityManager *mgr G_GNUC_UNUSED, - * paths in the same order and thus no deadlock can occur. - * Lastly, it makes searching for duplicate paths below - * simpler. */ -- if (paths) -- qsort(paths, npaths, sizeof(*paths), cmpstringp); -+ if (paths) { -+ g_qsort_with_data(paths, npaths, sizeof(*paths), cmpstringp, NULL); -+ } - - for (i = 0; i < npaths; i++) { - const char *p = paths[i]; -diff --git a/src/util/virfile.c b/src/util/virfile.c -index 54708652fb..007b6cf512 100644 ---- a/src/util/virfile.c -+++ b/src/util/virfile.c -@@ -2193,9 +2193,11 @@ virFileGetMountSubtreeImpl(const char *mtabpath, - mounts[nmounts - 2] = g_strdup(mntent.mnt_dir); - } - -- if (mounts) -- qsort(mounts, nmounts - 1, sizeof(mounts[0]), -- reverse ? virStringSortRevCompare : virStringSortCompare); -+ if (mounts) { -+ g_qsort_with_data(mounts, nmounts - 1, sizeof(mounts[0]), -+ reverse ? virStringSortRevCompare : virStringSortCompare, -+ NULL); -+ } - - *mountsret = mounts; - *nmountsret = nmounts ? nmounts - 1 : 0; -diff --git a/src/util/virhash.c b/src/util/virhash.c -index 8365f51eb3..19908c9412 100644 ---- a/src/util/virhash.c -+++ b/src/util/virhash.c -@@ -514,7 +514,8 @@ void *virHashSearch(GHashTable *table, - - static int - virHashGetItemsKeySorter(const void *va, -- const void *vb) -+ const void *vb, -+ void *opaque G_GNUC_UNUSED) - { - const virHashKeyValuePair *a = va; - const virHashKeyValuePair *b = vb; -@@ -552,8 +553,10 @@ virHashGetItems(GHashTable *table, - i++; - } - -- if (sortKeys) -- qsort(items, *nitems, sizeof(*items), virHashGetItemsKeySorter); -+ if (sortKeys) { -+ g_qsort_with_data(items, *nitems, -+ sizeof(*items), virHashGetItemsKeySorter, NULL); -+ } - - return items; - } -diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c -index 8ca58f5d10..30ae25c487 100644 ---- a/src/util/virresctrl.c -+++ b/src/util/virresctrl.c -@@ -2522,7 +2522,8 @@ virResctrlMonitorRemove(virResctrlMonitor *monitor) - - static int - virResctrlMonitorStatsSorter(const void *a, -- const void *b) -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - return (*(virResctrlMonitorStats **)a)->id - - (*(virResctrlMonitorStats **)b)->id; -@@ -2625,8 +2626,10 @@ virResctrlMonitorGetStats(virResctrlMonitor *monitor, - } - - /* Sort in id's ascending order */ -- if (*nstats) -- qsort(*stats, *nstats, sizeof(**stats), virResctrlMonitorStatsSorter); -+ if (*nstats) { -+ g_qsort_with_data(*stats, *nstats, sizeof(**stats), -+ virResctrlMonitorStatsSorter, NULL); -+ } - - ret = 0; - cleanup: -diff --git a/src/util/virstring.c b/src/util/virstring.c -index 6b728ff047..81c9aff304 100644 ---- a/src/util/virstring.c -+++ b/src/util/virstring.c -@@ -518,9 +518,11 @@ virStringIsEmpty(const char *str) - * virStringSortCompare: - * - * A comparator function for sorting strings in -- * normal order with qsort(). -+ * normal order with g_qsort_with_data(). - */ --int virStringSortCompare(const void *a, const void *b) -+int virStringSortCompare(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - const char **sa = (const char**)a; - const char **sb = (const char**)b; -@@ -532,9 +534,11 @@ int virStringSortCompare(const void *a, const void *b) - * virStringSortRevCompare: - * - * A comparator function for sorting strings in -- * reverse order with qsort(). -+ * reverse order with g_qsort_with_data(). - */ --int virStringSortRevCompare(const void *a, const void *b) -+int virStringSortRevCompare(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - const char **sa = (const char**)a; - const char **sb = (const char**)b; -diff --git a/src/util/virstring.h b/src/util/virstring.h -index 16dcce98f4..8f9b1edc8f 100644 ---- a/src/util/virstring.h -+++ b/src/util/virstring.h -@@ -83,8 +83,12 @@ bool virStringIsEmpty(const char *str); - int virStrcpy(char *dest, const char *src, size_t destbytes); - #define virStrcpyStatic(dest, src) virStrcpy((dest), (src), sizeof(dest)) - --int virStringSortCompare(const void *a, const void *b); --int virStringSortRevCompare(const void *a, const void *b); -+int virStringSortCompare(const void *a, -+ const void *b, -+ void *opaque); -+int virStringSortRevCompare(const void *a, -+ const void *b, -+ void *opaque); - int virStringToUpper(char **dst, const char *src); - - ssize_t virStringSearch(const char *str, -diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c -index ef3b8052f6..1be249d855 100644 ---- a/src/util/virtypedparam.c -+++ b/src/util/virtypedparam.c -@@ -43,7 +43,9 @@ VIR_ENUM_IMPL(virTypedParameter, - ); - - static int --virTypedParamsSortName(const void *left, const void *right) -+virTypedParamsSortName(const void *left, -+ const void *right, -+ void *opaque G_GNUC_UNUSED) - { - const virTypedParameter *param_left = left, *param_right = right; - return strcmp(param_left->field, param_right->field); -@@ -78,7 +80,8 @@ virTypedParamsValidate(virTypedParameterPtr params, int nparams, ...) - - /* Here we intentionally don't copy values */ - memcpy(sorted, params, sizeof(*params) * nparams); -- qsort(sorted, nparams, sizeof(*sorted), virTypedParamsSortName); -+ g_qsort_with_data(sorted, nparams, -+ sizeof(*sorted), virTypedParamsSortName, NULL); - - name = va_arg(ap, const char *); - while (name) { -@@ -102,7 +105,7 @@ virTypedParamsValidate(virTypedParameterPtr params, int nparams, ...) - - va_end(ap); - -- qsort(keys, nkeys, sizeof(*keys), virTypedParamsSortName); -+ g_qsort_with_data(keys, nkeys, sizeof(*keys), virTypedParamsSortName, NULL); - - for (i = 0, j = 0; i < nparams && j < nkeys;) { - if (STRNEQ(sorted[i].field, keys[j].field)) { -diff --git a/tests/commandhelper.c b/tests/commandhelper.c -index 9b56feb120..9f28aa7674 100644 ---- a/tests/commandhelper.c -+++ b/tests/commandhelper.c -@@ -129,7 +129,9 @@ static void printArguments(FILE *log, int argc, char** argv) - } - } - --static int envsort(const void *a, const void *b) -+static int envsort(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - const char *astr = *(const char**)a; - const char *bstr = *(const char**)b; -@@ -165,7 +167,7 @@ static int printEnvironment(FILE *log) - newenv[i] = environ[i]; - } - -- qsort(newenv, length, sizeof(newenv[0]), envsort); -+ g_qsort_with_data(newenv, length, sizeof(newenv[0]), envsort, NULL); - - for (i = 0; i < length; i++) { - /* Ignore the variables used to instruct the loader into -diff --git a/tests/virstringtest.c b/tests/virstringtest.c -index 6e697cc240..f4976890db 100644 ---- a/tests/virstringtest.c -+++ b/tests/virstringtest.c -@@ -89,10 +89,10 @@ testStringSortCompare(const void *opaque G_GNUC_UNUSED) - }; - size_t i; - -- qsort(randlist, G_N_ELEMENTS(randlist), sizeof(randlist[0]), -- virStringSortCompare); -- qsort(randrlist, G_N_ELEMENTS(randrlist), sizeof(randrlist[0]), -- virStringSortRevCompare); -+ g_qsort_with_data(randlist, G_N_ELEMENTS(randlist), -+ sizeof(randlist[0]), virStringSortCompare, NULL); -+ g_qsort_with_data(randrlist, G_N_ELEMENTS(randrlist), -+ sizeof(randrlist[0]), virStringSortRevCompare, NULL); - - for (i = 0; i < G_N_ELEMENTS(randlist); i++) { - if (STRNEQ(randlist[i], sortlist[i])) { -diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c -index 727de34abb..34bae34f9a 100644 ---- a/tools/virsh-checkpoint.c -+++ b/tools/virsh-checkpoint.c -@@ -526,7 +526,8 @@ virshCheckpointListFree(struct virshCheckpointList *checkpointlist) - - static int - virshChkSorter(const void *a, -- const void *b) -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - const struct virshChk *sa = a; - const struct virshChk *sb = b; -@@ -594,9 +595,10 @@ virshCheckpointListCollect(vshControl *ctl, - } - - if (!(orig_flags & VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL) && -- checkpointlist->chks) -- qsort(checkpointlist->chks, checkpointlist->nchks, -- sizeof(*checkpointlist->chks), virshChkSorter); -+ checkpointlist->chks) { -+ g_qsort_with_data(checkpointlist->chks, checkpointlist->nchks, -+ sizeof(*checkpointlist->chks), virshChkSorter, NULL); -+ } - - ret = g_steal_pointer(&checkpointlist); - -diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c -index 89fdc7a050..a2c56fc090 100644 ---- a/tools/virsh-domain-monitor.c -+++ b/tools/virsh-domain-monitor.c -@@ -1483,7 +1483,9 @@ static const vshCmdInfo info_list[] = { - - /* compare domains, pack NULLed ones at the end */ - static int --virshDomainSorter(const void *a, const void *b) -+virshDomainSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virDomainPtr *da = (virDomainPtr *) a; - virDomainPtr *db = (virDomainPtr *) b; -@@ -1741,9 +1743,10 @@ virshDomainListCollect(vshControl *ctl, unsigned int flags) - - finished: - /* sort the list */ -- if (list->domains && list->ndomains) -- qsort(list->domains, list->ndomains, sizeof(*list->domains), -- virshDomainSorter); -+ if (list->domains && list->ndomains) { -+ g_qsort_with_data(list->domains, list->ndomains, -+ sizeof(*list->domains), virshDomainSorter, NULL); -+ } - - /* truncate the list if filter simulation deleted entries */ - if (deleted) -diff --git a/tools/virsh-host.c b/tools/virsh-host.c -index 4116481978..6c14be865f 100644 ---- a/tools/virsh-host.c -+++ b/tools/virsh-host.c -@@ -300,7 +300,9 @@ static const vshCmdOptDef opts_freepages[] = { - }; - - static int --vshPageSizeSorter(const void *a, const void *b) -+vshPageSizeSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - unsigned int pa = *(unsigned int *)a; - unsigned int pb = *(unsigned int *)b; -@@ -377,7 +379,8 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd) - * @pagesize array will contain duplicates. We should - * remove them otherwise not very nice output will be - * produced. */ -- qsort(pagesize, nodes_cnt, sizeof(*pagesize), vshPageSizeSorter); -+ g_qsort_with_data(pagesize, nodes_cnt, -+ sizeof(*pagesize), vshPageSizeSorter, NULL); - - for (i = 0; i < nodes_cnt - 1;) { - if (pagesize[i] == pagesize[i + 1]) { -diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c -index 77c0fff847..09a3668438 100644 ---- a/tools/virsh-interface.c -+++ b/tools/virsh-interface.c -@@ -141,7 +141,9 @@ cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd) - } - - static int --virshInterfaceSorter(const void *a, const void *b) -+virshInterfaceSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virInterfacePtr *ia = (virInterfacePtr *) a; - virInterfacePtr *ib = (virInterfacePtr *) b; -@@ -281,9 +283,10 @@ virshInterfaceListCollect(vshControl *ctl, - - finished: - /* sort the list */ -- if (list->ifaces && list->nifaces) -- qsort(list->ifaces, list->nifaces, -- sizeof(*list->ifaces), virshInterfaceSorter); -+ if (list->ifaces && list->nifaces) { -+ g_qsort_with_data(list->ifaces, list->nifaces, -+ sizeof(*list->ifaces), virshInterfaceSorter, NULL); -+ } - - /* truncate the list if filter simulation deleted entries */ - if (deleted) -diff --git a/tools/virsh-network.c b/tools/virsh-network.c -index 998e7e15e3..68c7543863 100644 ---- a/tools/virsh-network.c -+++ b/tools/virsh-network.c -@@ -791,7 +791,9 @@ cmdNetworkInfo(vshControl *ctl, const vshCmd *cmd) - } - - static int --virshNetworkSorter(const void *a, const void *b) -+virshNetworkSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virNetworkPtr *na = (virNetworkPtr *) a; - virNetworkPtr *nb = (virNetworkPtr *) b; -@@ -982,9 +984,10 @@ virshNetworkListCollect(vshControl *ctl, - - finished: - /* sort the list */ -- if (list->nets && list->nnets) -- qsort(list->nets, list->nnets, -- sizeof(*list->nets), virshNetworkSorter); -+ if (list->nets && list->nnets) { -+ g_qsort_with_data(list->nets, list->nnets, -+ sizeof(*list->nets), virshNetworkSorter, NULL); -+ } - - /* truncate the list if filter simulation deleted entries */ - if (deleted) -@@ -1801,7 +1804,9 @@ static const vshCmdOptDef opts_network_dhcp_leases[] = { - }; - - static int --virshNetworkDHCPLeaseSorter(const void *a, const void *b) -+virshNetworkDHCPLeaseSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virNetworkDHCPLeasePtr *lease1 = (virNetworkDHCPLeasePtr *) a; - virNetworkDHCPLeasePtr *lease2 = (virNetworkDHCPLeasePtr *) b; -@@ -1840,7 +1845,8 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd) - } - - /* Sort the list according to MAC Address/IAID */ -- qsort(leases, nleases, sizeof(*leases), virshNetworkDHCPLeaseSorter); -+ g_qsort_with_data(leases, nleases, -+ sizeof(*leases), virshNetworkDHCPLeaseSorter, NULL); - - table = vshTableNew(_("Expiry Time"), _("MAC address"), _("Protocol"), - _("IP address"), _("Hostname"), _("Client ID or DUID"), -@@ -2068,7 +2074,9 @@ cmdNetworkPortDelete(vshControl *ctl, const vshCmd *cmd) - - - static int --virshNetworkPortSorter(const void *a, const void *b) -+virshNetworkPortSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virNetworkPortPtr *na = (virNetworkPortPtr *) a; - virNetworkPortPtr *nb = (virNetworkPortPtr *) b; -@@ -2129,9 +2137,10 @@ virshNetworkPortListCollect(vshControl *ctl, - list->nports = ret; - - /* sort the list */ -- if (list->ports && list->nports) -- qsort(list->ports, list->nports, -- sizeof(*list->ports), virshNetworkPortSorter); -+ if (list->ports && list->nports) { -+ g_qsort_with_data(list->ports, list->nports, -+ sizeof(*list->ports), virshNetworkPortSorter, NULL); -+ } - - success = true; - -diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c -index 82b8fb44fc..fb38fd7fcc 100644 ---- a/tools/virsh-nodedev.c -+++ b/tools/virsh-nodedev.c -@@ -183,7 +183,9 @@ virshNodeListLookup(int devid, bool parent, void *opaque) - } - - static int --virshNodeDeviceSorter(const void *a, const void *b) -+virshNodeDeviceSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virNodeDevicePtr *na = (virNodeDevicePtr *) a; - virNodeDevicePtr *nb = (virNodeDevicePtr *) b; -@@ -334,9 +336,10 @@ virshNodeDeviceListCollect(vshControl *ctl, - - finished: - /* sort the list */ -- if (list->devices && list->ndevices) -- qsort(list->devices, list->ndevices, -- sizeof(*list->devices), virshNodeDeviceSorter); -+ if (list->devices && list->ndevices) { -+ g_qsort_with_data(list->devices, list->ndevices, -+ sizeof(*list->devices), virshNodeDeviceSorter, NULL); -+ } - - /* truncate the list if filter simulation deleted entries */ - if (deleted) -diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c -index 92b2b7b3bc..fa52d020e4 100644 ---- a/tools/virsh-nwfilter.c -+++ b/tools/virsh-nwfilter.c -@@ -220,7 +220,9 @@ cmdNWFilterDumpXML(vshControl *ctl, const vshCmd *cmd) - } - - static int --virshNWFilterSorter(const void *a, const void *b) -+virshNWFilterSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virNWFilterPtr *fa = (virNWFilterPtr *) a; - virNWFilterPtr *fb = (virNWFilterPtr *) b; -@@ -323,9 +325,10 @@ virshNWFilterListCollect(vshControl *ctl, - - finished: - /* sort the list */ -- if (list->filters && list->nfilters) -- qsort(list->filters, list->nfilters, -- sizeof(*list->filters), virshNWFilterSorter); -+ if (list->filters && list->nfilters) { -+ g_qsort_with_data(list->filters, list->nfilters, -+ sizeof(*list->filters), virshNWFilterSorter, NULL); -+ } - - /* truncate the list for not found filter objects */ - if (deleted) -@@ -644,7 +647,9 @@ cmdNWFilterBindingDumpXML(vshControl *ctl, const vshCmd *cmd) - - - static int --virshNWFilterBindingSorter(const void *a, const void *b) -+virshNWFilterBindingSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virNWFilterBindingPtr *fa = (virNWFilterBindingPtr *) a; - virNWFilterBindingPtr *fb = (virNWFilterBindingPtr *) b; -@@ -702,9 +707,10 @@ virshNWFilterBindingListCollect(vshControl *ctl, - list->nbindings = ret; - - /* sort the list */ -- if (list->bindings && list->nbindings > 1) -- qsort(list->bindings, list->nbindings, -- sizeof(*list->bindings), virshNWFilterBindingSorter); -+ if (list->bindings && list->nbindings > 1) { -+ g_qsort_with_data(list->bindings, list->nbindings, -+ sizeof(*list->bindings), virshNWFilterBindingSorter, NULL); -+ } - - success = true; - -diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c -index 5803530d79..36f00cf643 100644 ---- a/tools/virsh-pool.c -+++ b/tools/virsh-pool.c -@@ -814,7 +814,9 @@ cmdPoolDumpXML(vshControl *ctl, const vshCmd *cmd) - } - - static int --virshStoragePoolSorter(const void *a, const void *b) -+virshStoragePoolSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virStoragePoolPtr *pa = (virStoragePoolPtr *) a; - virStoragePoolPtr *pb = (virStoragePoolPtr *) b; -@@ -1005,9 +1007,10 @@ virshStoragePoolListCollect(vshControl *ctl, - - finished: - /* sort the list */ -- if (list->pools && list->npools) -- qsort(list->pools, list->npools, -- sizeof(*list->pools), virshStoragePoolSorter); -+ if (list->pools && list->npools) { -+ g_qsort_with_data(list->pools, list->npools, -+ sizeof(*list->pools), virshStoragePoolSorter, NULL); -+ } - - /* truncate the list if filter simulation deleted entries */ - if (deleted) -diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c -index 694e16c5cb..e54712ba78 100644 ---- a/tools/virsh-secret.c -+++ b/tools/virsh-secret.c -@@ -399,7 +399,9 @@ cmdSecretUndefine(vshControl *ctl, const vshCmd *cmd) - } - - static int --virshSecretSorter(const void *a, const void *b) -+virshSecretSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virSecretPtr *sa = (virSecretPtr *) a; - virSecretPtr *sb = (virSecretPtr *) b; -@@ -509,9 +511,10 @@ virshSecretListCollect(vshControl *ctl, - - finished: - /* sort the list */ -- if (list->secrets && list->nsecrets) -- qsort(list->secrets, list->nsecrets, -- sizeof(*list->secrets), virshSecretSorter); -+ if (list->secrets && list->nsecrets) { -+ g_qsort_with_data(list->secrets, list->nsecrets, -+ sizeof(*list->secrets), virshSecretSorter, NULL); -+ } - - /* truncate the list for not found secret objects */ - if (deleted) -diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c -index c85258c09a..2049872322 100644 ---- a/tools/virsh-snapshot.c -+++ b/tools/virsh-snapshot.c -@@ -982,7 +982,9 @@ virshSnapshotListFree(struct virshSnapshotList *snaplist) - } - - static int --virshSnapSorter(const void *a, const void *b) -+virshSnapSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - const struct virshSnap *sa = a; - const struct virshSnap *sb = b; -@@ -1232,7 +1234,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom, - * still in list. We mark known descendants by clearing - * snaps[i].parents. Sorry, this is O(n^3) - hope your - * hierarchy isn't huge. XXX Is it worth making O(n^2 log n) -- * by using qsort and bsearch? */ -+ * by using g_qsort_with_data and bsearch? */ - if (start_index < 0) { - vshError(ctl, _("snapshot %1$s disappeared from list"), fromname); - goto cleanup; -@@ -1312,8 +1314,8 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom, - } - if (!(orig_flags & VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL) && - snaplist->snaps && snaplist->nsnaps) { -- qsort(snaplist->snaps, snaplist->nsnaps, sizeof(*snaplist->snaps), -- virshSnapSorter); -+ g_qsort_with_data(snaplist->snaps, snaplist->nsnaps, -+ sizeof(*snaplist->snaps), virshSnapSorter, NULL); - } - snaplist->nsnaps -= deleted; - -diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c -index 9a2b21d3f3..329ca3a66c 100644 ---- a/tools/virsh-volume.c -+++ b/tools/virsh-volume.c -@@ -1200,7 +1200,9 @@ cmdVolDumpXML(vshControl *ctl, const vshCmd *cmd) - } - - static int --virshStorageVolSorter(const void *a, const void *b) -+virshStorageVolSorter(const void *a, -+ const void *b, -+ void *opaque G_GNUC_UNUSED) - { - virStorageVolPtr *va = (virStorageVolPtr *) a; - virStorageVolPtr *vb = (virStorageVolPtr *) b; -@@ -1299,8 +1301,10 @@ virshStorageVolListCollect(vshControl *ctl, - - finished: - /* sort the list */ -- if (list->vols && list->nvols) -- qsort(list->vols, list->nvols, sizeof(*list->vols), virshStorageVolSorter); -+ if (list->vols && list->nvols) { -+ g_qsort_with_data(list->vols, list->nvols, -+ sizeof(*list->vols), virshStorageVolSorter, NULL); -+ } - - if (deleted) - VIR_SHRINK_N(list->vols, list->nvols, deleted); --- -2.43.0 - diff --git a/libvirt.spec b/libvirt.spec index 1dcf022..7abaf9d 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -203,9 +203,29 @@ %define qemu_moddir %{_libdir}/qemu %define qemu_datadir %{_datadir}/qemu -%define with_mingw 0 +# Native / MinGW builds +%define with_native 0%{!?_without_native:1} + +%define with_mingw32 0 +%define with_mingw64 0 + %if 0%{?fedora} - %define with_mingw 0%{!?_without_mingw:1} + %if 0%{!?_without_mingw:1} + %define with_mingw32 0%{!?_without_mingw32:1} + %define with_mingw64 0%{!?_without_mingw64:1} + %endif + + # These tell the other mingw macros whether to perform or + # skip the 32-bit and 64-bit specific steps respectively + %define mingw_build_win32 %{with_mingw32} + %define mingw_build_win64 %{with_mingw64} +%endif + +%if !%{with_native} + # Building the debugsource package apparently only works if the + # native build is enabled. debuginfo packages don't have this + # problem and setting this doesn't disable them + %global debug_package %{nil} %endif # RHEL releases provide stable tool chains and so it is safe to turn @@ -240,8 +260,8 @@ Summary: Library providing a simple virtualization API Name: libvirt -Version: 9.9.0 -Release: 3%{?dist} +Version: 9.10.0 +Release: 1%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -250,17 +270,6 @@ URL: https://libvirt.org/ %endif Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz -# Fix crash with snapshot restore (bz #2247754) -Patch: 0001-qemu_process-fix-crash-in-qemuSaveImageDecompression.patch -# Fix libxml2 API changes -Patch: 0002-vbox_snapshot_conf-Parse-XMLs-without-net-access.patch -Patch: 0003-vbox_snapshot_conf-Keep-indent-in-snapshot-XML.patch -Patch: 0004-virxml-include-libxml-xmlsave.h-for-xmlIndentTreeOut.patch -Patch: 0005-virXMLParseHelper-Store-XML-parsing-flags-in-a-varia.patch -Patch: 0006-virxml-Introduce-parsing-APIs-that-keep-indentation.patch -Patch: 0007-lib-Replace-xmlKeepBlanksDefault-with-virXMLParseWit.patch -Patch: 0008-lib-Replace-qsort-with-g_qsort_with_data.patch - Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} @@ -292,21 +301,29 @@ Requires: libvirt-libs = %{version}-%{release} # All build-time requirements. Run-time requirements are # listed against each sub-RPM BuildRequires: python3-docutils -BuildRequires: gcc BuildRequires: meson >= 0.56.0 BuildRequires: ninja-build BuildRequires: git BuildRequires: perl-interpreter BuildRequires: python3 -%if %{with_libxl} +BuildRequires: python3-pytest +# For xmllint +BuildRequires: libxml2 +# For xsltproc +BuildRequires: libxslt +BuildRequires: gettext +BuildRequires: systemd-rpm-macros +# Fedora build root suckage +BuildRequires: gawk +%if %{with_native} +BuildRequires: gcc + %if %{with_libxl} BuildRequires: xen-devel -%endif + %endif BuildRequires: glib2-devel >= 2.56 BuildRequires: libxml2-devel -BuildRequires: libxslt BuildRequires: readline-devel BuildRequires: bash-completion >= 2.0 -BuildRequires: gettext BuildRequires: libtasn1-devel BuildRequires: gnutls-devel BuildRequires: libattr-devel @@ -315,75 +332,75 @@ BuildRequires: libblkid-devel >= 2.17 # for augparse, optionally used in testing BuildRequires: augeas BuildRequires: systemd-devel >= 185 -BuildRequires: systemd-rpm-macros BuildRequires: libpciaccess-devel >= 0.10.9 BuildRequires: yajl-devel -%if %{with_sanlock} + %if %{with_sanlock} BuildRequires: sanlock-devel >= 2.4 -%endif + %endif BuildRequires: libpcap-devel >= 1.5.0 BuildRequires: libnl3-devel BuildRequires: libselinux-devel BuildRequires: iptables BuildRequires: ebtables -BuildRequires: module-init-tools +# For modprobe +BuildRequires: kmod BuildRequires: cyrus-sasl-devel BuildRequires: polkit >= 0.112 # For mount/umount in FS driver BuildRequires: util-linux -%if %{with_qemu} + %if %{with_qemu} # For managing ACLs BuildRequires: libacl-devel # From QEMU RPMs, used by virstoragetest BuildRequires: /usr/bin/qemu-img -%endif + %endif # nbdkit support requires libnbd -%if %{with_nbdkit} + %if %{with_nbdkit} BuildRequires: libnbd-devel -%endif + %endif # For LVM drivers BuildRequires: lvm2 # For pool type=iscsi BuildRequires: iscsi-initiator-utils -%if %{with_storage_iscsi_direct} + %if %{with_storage_iscsi_direct} # For pool type=iscsi-direct BuildRequires: libiscsi-devel -%endif + %endif # For disk driver BuildRequires: parted-devel # For Multipath support BuildRequires: device-mapper-devel -%if %{with_storage_rbd} + %if %{with_storage_rbd} BuildRequires: librados-devel BuildRequires: librbd-devel -%endif -%if %{with_storage_gluster} + %endif + %if %{with_storage_gluster} BuildRequires: glusterfs-api-devel >= 3.4.1 BuildRequires: glusterfs-devel >= 3.4.1 -%endif -%if %{with_numactl} + %endif + %if %{with_numactl} # For QEMU/LXC numa info BuildRequires: numactl-devel -%endif + %endif BuildRequires: libcap-ng-devel >= 0.5.0 -%if %{with_fuse} + %if %{with_fuse} BuildRequires: fuse-devel >= 2.8.6 -%endif -%if %{with_libssh2} + %endif + %if %{with_libssh2} BuildRequires: libssh2-devel >= 1.3.0 -%endif -%if %{with_netcf} + %endif + %if %{with_netcf} BuildRequires: netcf-devel >= 0.2.2 -%endif -%if 0%{?fedora} || 0%{?rhel} >= 9 + %endif + %if 0%{?fedora} || 0%{?rhel} >= 9 BuildRequires: passt -%endif -%if %{with_esx} + %endif + %if %{with_esx} BuildRequires: libcurl-devel -%endif -%if %{with_hyperv} + %endif + %if %{with_hyperv} BuildRequires: libwsman-devel >= 2.6.3 -%endif + %endif BuildRequires: audit-libs-devel # we need /usr/sbin/dtrace BuildRequires: systemtap-sdt-devel @@ -391,27 +408,25 @@ BuildRequires: systemtap-sdt-devel BuildRequires: util-linux # For showmount in FS driver (netfs discovery) BuildRequires: nfs-utils -# Fedora build root suckage -BuildRequires: gawk # For storage wiping with different algorithms BuildRequires: scrub -%if %{with_numad} + %if %{with_numad} BuildRequires: numad -%endif -%if %{with_wireshark} + %endif + %if %{with_wireshark} BuildRequires: wireshark-devel -%endif -%if %{with_libssh} + %endif + %if %{with_libssh} BuildRequires: libssh-devel >= 0.8.1 -%endif -BuildRequires: rpcgen + %endif BuildRequires: libtirpc-devel + %if %{with_firewalld_zone} # Needed for the firewalld_reload macro -%if %{with_firewalld_zone} BuildRequires: firewalld-filesystem + %endif %endif -%if %{with_mingw} +%if %{with_mingw32} BuildRequires: mingw32-filesystem BuildRequires: mingw32-gcc BuildRequires: mingw32-binutils @@ -425,6 +440,8 @@ BuildRequires: mingw32-portablexdr BuildRequires: mingw32-dlfcn BuildRequires: mingw32-libssh2 BuildRequires: mingw32-curl +%endif +%if %{with_mingw64} BuildRequires: mingw64-filesystem BuildRequires: mingw64-gcc BuildRequires: mingw64-binutils @@ -445,6 +462,7 @@ Libvirt is a C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). The main package includes the libvirtd server exporting the virtualization support. +%if %{with_native} %package docs Summary: API reference and website documentation @@ -484,10 +502,10 @@ Requires: iproute # for /sbin/tc Requires: iproute-tc Requires: polkit >= 0.112 -%if %{with_dmidecode} + %if %{with_dmidecode} # For virConnectGetSysinfo Requires: dmidecode -%endif + %endif # For service management Requires(posttrans): /usr/bin/systemctl Requires(preun): /usr/bin/systemctl @@ -496,11 +514,11 @@ Requires: dbus # For uid creation during pre Requires(pre): shadow-utils # Needed by /usr/libexec/libvirt-guests.sh script. -%if 0%{?fedora} + %if 0%{?fedora} Requires: gettext-runtime -%else + %else Requires: gettext -%endif + %endif # Ensure smooth upgrades Obsoletes: libvirt-admin < 7.3.0 @@ -608,9 +626,9 @@ capabilities. Summary: Interface driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-libs = %{version}-%{release} -%if %{with_netcf} + %if %{with_netcf} Requires: netcf-libs >= 0.2.2 -%endif + %endif %description daemon-driver-interface The interface driver plugin for the libvirtd daemon, providing @@ -632,13 +650,13 @@ Requires: libvirt-libs = %{version}-%{release} Requires: nfs-utils # For mkfs Requires: util-linux -%if %{with_qemu} + %if %{with_qemu} # From QEMU RPMs Requires: /usr/bin/qemu-img -%endif -%if !%{with_storage_rbd} + %endif + %if !%{with_storage_rbd} Obsoletes: libvirt-daemon-driver-storage-rbd < 5.2.0 -%endif + %endif Obsoletes: libvirt-daemon-driver-storage-sheepdog < 8.8.0 %description daemon-driver-storage-core @@ -686,7 +704,7 @@ Requires: iscsi-initiator-utils The storage driver backend adding implementation of the storage APIs for iscsi volumes using the host iscsi stack. -%if %{with_storage_iscsi_direct} + %if %{with_storage_iscsi_direct} %package daemon-driver-storage-iscsi-direct Summary: Storage driver plugin for iscsi-direct Requires: libvirt-daemon-driver-storage-core = %{version}-%{release} @@ -695,7 +713,7 @@ Requires: libvirt-libs = %{version}-%{release} %description daemon-driver-storage-iscsi-direct The storage driver backend adding implementation of the storage APIs for iscsi volumes using libiscsi direct connection. -%endif + %endif %package daemon-driver-storage-mpath Summary: Storage driver plugin for multipath volumes @@ -707,24 +725,24 @@ Requires: device-mapper The storage driver backend adding implementation of the storage APIs for multipath storage using device mapper. -%if %{with_storage_gluster} + %if %{with_storage_gluster} %package daemon-driver-storage-gluster Summary: Storage driver plugin for gluster Requires: libvirt-daemon-driver-storage-core = %{version}-%{release} Requires: libvirt-libs = %{version}-%{release} - %if 0%{?fedora} + %if 0%{?fedora} Requires: glusterfs-client >= 2.0.1 - %endif - %if 0%{?fedora} || 0%{?with_storage_gluster} + %endif + %if 0%{?fedora} || 0%{?with_storage_gluster} Requires: /usr/sbin/gluster - %endif + %endif %description daemon-driver-storage-gluster The storage driver backend adding implementation of the storage APIs for gluster volumes using libgfapi. -%endif + %endif -%if %{with_storage_rbd} + %if %{with_storage_rbd} %package daemon-driver-storage-rbd Summary: Storage driver plugin for rbd Requires: libvirt-daemon-driver-storage-core = %{version}-%{release} @@ -733,9 +751,9 @@ Requires: libvirt-libs = %{version}-%{release} %description daemon-driver-storage-rbd The storage driver backend adding implementation of the storage APIs for rbd volumes using the ceph protocol. -%endif + %endif -%if %{with_storage_zfs} + %if %{with_storage_zfs} %package daemon-driver-storage-zfs Summary: Storage driver plugin for ZFS Requires: libvirt-daemon-driver-storage-core = %{version}-%{release} @@ -747,7 +765,7 @@ Requires: /sbin/zpool %description daemon-driver-storage-zfs The storage driver backend adding implementation of the storage APIs for ZFS volumes. -%endif + %endif %package daemon-driver-storage Summary: Storage driver plugin including all backends for the libvirtd daemon @@ -757,25 +775,25 @@ Requires: libvirt-daemon-driver-storage-logical = %{version}-%{release} Requires: libvirt-daemon-driver-storage-scsi = %{version}-%{release} Requires: libvirt-daemon-driver-storage-iscsi = %{version}-%{release} Requires: libvirt-daemon-driver-storage-mpath = %{version}-%{release} -%if %{with_storage_iscsi_direct} + %if %{with_storage_iscsi_direct} Requires: libvirt-daemon-driver-storage-iscsi-direct = %{version}-%{release} -%endif -%if %{with_storage_gluster} + %endif + %if %{with_storage_gluster} Requires: libvirt-daemon-driver-storage-gluster = %{version}-%{release} -%endif -%if %{with_storage_rbd} + %endif + %if %{with_storage_rbd} Requires: libvirt-daemon-driver-storage-rbd = %{version}-%{release} -%endif -%if %{with_storage_zfs} + %endif + %if %{with_storage_zfs} Requires: libvirt-daemon-driver-storage-zfs = %{version}-%{release} -%endif + %endif %description daemon-driver-storage The storage driver plugin for the libvirtd daemon, providing an implementation of the storage APIs using LVM, iSCSI, parted and more. -%if %{with_qemu} + %if %{with_qemu} %package daemon-driver-qemu Summary: QEMU driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} @@ -789,26 +807,26 @@ Requires: lzop Requires: xz Requires: systemd-container Requires: swtpm-tools - %if %{with_numad} + %if %{with_numad} Requires: numad - %endif - %if 0%{?fedora} || 0%{?rhel} >= 9 + %endif + %if 0%{?fedora} || 0%{?rhel} >= 9 Recommends: passt Recommends: passt-selinux - %endif - %if %{with_nbdkit} + %endif + %if %{with_nbdkit} Recommends: nbdkit Recommends: nbdkit-curl-plugin Recommends: nbdkit-ssh-plugin - %endif + %endif %description daemon-driver-qemu The qemu driver plugin for the libvirtd daemon, providing an implementation of the hypervisor driver APIs using QEMU -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %package daemon-driver-lxc Summary: LXC driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} @@ -818,17 +836,17 @@ Requires: libvirt-daemon-driver-network = %{version}-%{release} Requires: systemd-container # for modprobe of nbd driver Requires: module-init-tools - %if %{with_numad} + %if %{with_numad} Requires: numad - %endif + %endif %description daemon-driver-lxc The LXC driver plugin for the libvirtd daemon, providing an implementation of the hypervisor driver APIs using the Linux kernel -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %package daemon-driver-vbox Summary: VirtualBox driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} @@ -838,9 +856,9 @@ Requires: libvirt-libs = %{version}-%{release} The vbox driver plugin for the libvirtd daemon, providing an implementation of the hypervisor driver APIs using VirtualBox -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %package daemon-driver-libxl Summary: Libxl driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} @@ -851,22 +869,22 @@ Obsoletes: libvirt-daemon-driver-xen < 4.3.0 The Libxl driver plugin for the libvirtd daemon, providing an implementation of the hypervisor driver APIs using Libxl -%endif + %endif -%if %{with_qemu_tcg} + %if %{with_qemu_tcg} %package daemon-qemu Summary: Server side daemon & driver required to run QEMU guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-log = %{version}-%{release} Requires: libvirt-daemon-lock = %{version}-%{release} Requires: libvirt-daemon-plugin-lockd = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-qemu = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -879,22 +897,22 @@ Requires: qemu %description daemon-qemu Server side daemon and driver required to manage the virtualization capabilities of the QEMU TCG emulators -%endif + %endif -%if %{with_qemu_kvm} + %if %{with_qemu_kvm} %package daemon-kvm Summary: Server side daemon & driver required to run KVM guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-log = %{version}-%{release} Requires: libvirt-daemon-lock = %{version}-%{release} Requires: libvirt-daemon-plugin-lockd = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-qemu = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -907,19 +925,19 @@ Requires: qemu-kvm %description daemon-kvm Server side daemon and driver required to manage the virtualization capabilities of the KVM hypervisor -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %package daemon-lxc Summary: Server side daemon & driver required to run LXC guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-lxc = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -931,21 +949,21 @@ Requires: libvirt-daemon-driver-storage = %{version}-%{release} %description daemon-lxc Server side daemon and driver required to manage the virtualization capabilities of LXC -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %package daemon-xen Summary: Server side daemon & driver required to run XEN guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-lock = %{version}-%{release} Requires: libvirt-daemon-plugin-lockd = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-libxl = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -958,19 +976,19 @@ Requires: xen %description daemon-xen Server side daemon and driver required to manage the virtualization capabilities of XEN -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %package daemon-vbox Summary: Server side daemon & driver required to run VirtualBox guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-vbox = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -982,7 +1000,7 @@ Requires: libvirt-daemon-driver-storage = %{version}-%{release} %description daemon-vbox Server side daemon and driver required to manage the virtualization capabilities of VirtualBox -%endif + %endif %package client Summary: Client side utilities of the libvirt library @@ -1019,7 +1037,7 @@ Requires: cyrus-sasl-gssapi %description libs Shared libraries for accessing the libvirt daemon. -%if %{with_wireshark} + %if %{with_wireshark} %package wireshark Summary: Wireshark dissector plugin for libvirt RPC transactions Requires: wireshark @@ -1027,9 +1045,9 @@ Requires: libvirt-libs = %{version}-%{release} %description wireshark Wireshark dissector plugin for better analysis of libvirt RPC traffic. -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %package login-shell Summary: Login shell for connecting users to an LXC container Requires: libvirt-libs = %{version}-%{release} @@ -1038,7 +1056,7 @@ Requires: libvirt-libs = %{version}-%{release} Provides the set-uid virt-login-shell binary that is used to connect a user to an LXC container when they login, by switching namespaces. -%endif + %endif %package devel Summary: Libraries, includes, etc. to compile with the libvirt library @@ -1048,7 +1066,7 @@ Requires: pkgconfig %description devel Include header files & development libraries for the libvirt C library. -%if %{with_sanlock} + %if %{with_sanlock} %package daemon-plugin-sanlock Summary: Sanlock lock manager plugin for QEMU driver Requires: sanlock >= 2.4 @@ -1061,7 +1079,7 @@ Provides: libvirt-lock-sanlock = %{version}-%{release} %description daemon-plugin-sanlock Includes the Sanlock lock manager plugin for the QEMU driver -%endif + %endif %package nss Summary: Libvirt plugin for Name Service Switch @@ -1069,8 +1087,9 @@ Requires: libvirt-daemon-driver-network = %{version}-%{release} %description nss Libvirt plugin for NSS for translating domain names into IP addresses. +%endif -%if %{with_mingw} +%if %{with_mingw32} %package -n mingw32-libvirt Summary: %{summary} Obsoletes: mingw32-libvirt-static < 7.0.0 @@ -1079,6 +1098,10 @@ BuildArch: noarch %description -n mingw32-libvirt MinGW Windows libvirt virtualization library. +%{?mingw32_debug_package} +%endif + +%if %{with_mingw64} %package -n mingw64-libvirt Summary: %{summary} Obsoletes: mingw64-libvirt-static < 7.0.0 @@ -1087,7 +1110,7 @@ BuildArch: noarch %description -n mingw64-libvirt MinGW Windows libvirt virtualization library. -%{?mingw_debug_package} +%{?mingw64_debug_package} %endif %prep @@ -1256,6 +1279,7 @@ exit 1 export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) +%if %{with_native} %meson \ -Drunstatedir=%{_rundir} \ -Dinitconfdir=%{_sysconfdir}/sysconfig \ @@ -1294,6 +1318,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dcapng=enabled \ %{?arg_fuse} \ %{?arg_netcf} \ + -Dnls=enabled \ -Dselinux=enabled \ %{?arg_selinux_mount} \ -Dapparmor=disabled \ @@ -1330,8 +1355,9 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) %{?arg_login_shell} %meson_build +%endif -%if %{with_mingw} +%if %{with_mingw32} || %{with_mingw64} %mingw_meson \ --auto-features=enabled \ -Ddriver_remote=enabled \ @@ -1374,7 +1400,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dlibssh=disabled \ -Dlogin_shell=disabled \ -Dnetcf=disabled \ - -Dnls=disabled \ + -Dnls=enabled \ -Dnss=disabled \ -Dnumactl=disabled \ -Dnumad=disabled \ @@ -1406,7 +1432,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dudev=disabled \ -Dwireshark_dissector=disabled \ -Dyajl=disabled -%mingw_ninja + %mingw_ninja %endif %install @@ -1414,6 +1440,7 @@ rm -fr %{buildroot} export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) +%if %{with_native} %meson_install # We don't want to install /etc/libvirt/qemu/networks in the main %%files list @@ -1433,65 +1460,72 @@ cp -a $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml \ # libvirt saves these files with mode 600 chmod 600 $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml -%if ! %{with_qemu} + %if ! %{with_qemu} rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug -%endif + %endif %find_lang %{name} -%if ! %{with_sanlock} + %if ! %{with_sanlock} rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirt_sanlock.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug -%endif + %endif -%if ! %{with_lxc} + %if ! %{with_lxc} rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug -%endif + %endif -%if ! %{with_qemu} + %if ! %{with_qemu} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu.conf rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu -%endif -%if ! %{with_lxc} + %endif + %if ! %{with_lxc} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/lxc.conf rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc -%endif -%if ! %{with_libxl} + %endif + %if ! %{with_libxl} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/libxl.conf rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.libxl rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_libxl.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug -%endif + %endif # Copied into libvirt-docs subpackage eventually mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt libvirt-docs -%ifarch %{arches_systemtap_64bit} + %ifarch %{arches_systemtap_64bit} mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes.stp \ $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes-64.stp - %if %{with_qemu} + %if %{with_qemu} mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \ $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes-64.stp + %endif %endif %endif -%if %{with_mingw} +%if %{with_mingw32} || %{with_mingw64} %mingw_ninja_install +%endif +%if %{with_mingw32} rm -rf $RPM_BUILD_ROOT%{mingw32_sysconfdir}/libvirt/nwfilter -rm -rf $RPM_BUILD_ROOT%{mingw64_sysconfdir}/libvirt/nwfilter rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/doc/* -rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/doc/* rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/gtk-doc/* -rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc/* - rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt_iohelper.exe -rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt_iohelper.exe rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt-guests.sh +%endif + +%if %{with_mingw64} +rm -rf $RPM_BUILD_ROOT%{mingw64_sysconfdir}/libvirt/nwfilter +rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/doc/* +rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc/* +rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt_iohelper.exe rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh +%endif +%if %{with_mingw32} || %{with_mingw64} %mingw_debug_install_post %mingw_find_lang %{name} @@ -1499,9 +1533,12 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh %endif %check + +%if %{with_native} # Building on slow archs, like emulated s390x in Fedora copr, requires # raising the test timeout VIR_TEST_DEBUG=1 %meson_test --no-suite syntax-check --timeout-multiplier 10 +%endif %define libvirt_rpmstatedir %{_localstatedir}/lib/rpm-state/libvirt @@ -1647,6 +1684,7 @@ VIR_TEST_DEBUG=1 %meson_test --no-suite syntax-check --timeout-multiplier 10 %define libvirt_systemd_config_pre() %libvirt_systemd_schedule_restart %1.service %define libvirt_systemd_config_posttrans() %libvirt_systemd_perform_restart %1.service +%if %{with_native} %pre daemon %libvirt_sysconfig_pre libvirtd %libvirt_systemd_inet_pre libvirtd @@ -1711,9 +1749,9 @@ exit 0 %libvirt_systemd_unix_pre virtnetworkd %post daemon-driver-network -%if %{with_firewalld_zone} + %if %{with_firewalld_zone} %firewalld_reload -%endif + %endif %posttrans daemon-driver-network %libvirt_sysconfig_posttrans virtnetworkd @@ -1723,9 +1761,9 @@ exit 0 %libvirt_systemd_unix_preun virtnetworkd %postun daemon-driver-network -%if %{with_firewalld_zone} + %if %{with_firewalld_zone} %firewalld_reload -%endif + %endif %pre daemon-driver-nwfilter %libvirt_sysconfig_pre virtnwfilterd @@ -1782,7 +1820,7 @@ exit 0 %preun daemon-driver-storage-core %libvirt_systemd_unix_preun virtstoraged -%if %{with_qemu} + %if %{with_qemu} %pre daemon-driver-qemu %libvirt_sysconfig_pre virtqemud %libvirt_systemd_unix_pre virtqemud @@ -1806,9 +1844,9 @@ exit 0 %preun daemon-driver-qemu %libvirt_systemd_unix_preun virtqemud -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %pre daemon-driver-lxc %libvirt_sysconfig_pre virtlxcd %libvirt_systemd_unix_pre virtlxcd @@ -1819,9 +1857,9 @@ exit 0 %preun daemon-driver-lxc %libvirt_systemd_unix_preun virtlxcd -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %pre daemon-driver-vbox %libvirt_sysconfig_pre virtvboxd %libvirt_systemd_unix_pre virtvboxd @@ -1832,9 +1870,9 @@ exit 0 %preun daemon-driver-vbox %libvirt_systemd_unix_preun virtvboxd -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %pre daemon-driver-libxl %libvirt_sysconfig_pre virtxend %libvirt_systemd_unix_pre virtxend @@ -1845,7 +1883,7 @@ exit 0 %preun daemon-driver-libxl %libvirt_systemd_unix_preun virtxend -%endif + %endif %pre daemon-config-network %libvirt_systemd_config_pre libvirtd @@ -1910,12 +1948,14 @@ done %libvirt_systemd_config_posttrans libvirtd %libvirt_systemd_config_posttrans virtnwfilterd -%if %{with_lxc} + %if %{with_lxc} %pre login-shell getent group virtlogin >/dev/null || groupadd -r virtlogin exit 0 + %endif %endif +%if %{with_native} %files %files docs @@ -1976,9 +2016,9 @@ exit 0 %{_datadir}/augeas/lenses/virtlockd.aug %{_datadir}/augeas/lenses/tests/test_virtlockd.aug %{_datadir}/augeas/lenses/libvirt_lockd.aug -%if %{with_qemu} + %if %{with_qemu} %{_datadir}/augeas/lenses/tests/test_libvirt_lockd.aug -%endif + %endif %attr(0755, root, root) %{_sbindir}/virtlockd %{_mandir}/man8/virtlockd.8* @@ -2051,13 +2091,13 @@ exit 0 %attr(0755, root, root) %{_libexecdir}/libvirt_leaseshelper %{_libdir}/libvirt/connection-driver/libvirt_driver_network.so %{_mandir}/man8/virtnetworkd.8* -%if %{with_firewalld_zone} + %if %{with_firewalld_zone} %{_prefix}/lib/firewalld/zones/libvirt.xml %{_prefix}/lib/firewalld/zones/libvirt-routed.xml %{_prefix}/lib/firewalld/policies/libvirt-routed-in.xml %{_prefix}/lib/firewalld/policies/libvirt-routed-out.xml %{_prefix}/lib/firewalld/policies/libvirt-to-host.xml -%endif + %endif %files daemon-driver-nodedev %config(noreplace) %{_sysconfdir}/libvirt/virtnodedevd.conf @@ -2134,31 +2174,31 @@ exit 0 %files daemon-driver-storage-iscsi %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_iscsi.so -%if %{with_storage_iscsi_direct} + %if %{with_storage_iscsi_direct} %files daemon-driver-storage-iscsi-direct %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_iscsi-direct.so -%endif + %endif %files daemon-driver-storage-mpath %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_mpath.so -%if %{with_storage_gluster} + %if %{with_storage_gluster} %files daemon-driver-storage-gluster %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_gluster.so %{_libdir}/libvirt/storage-file/libvirt_storage_file_gluster.so -%endif + %endif -%if %{with_storage_rbd} + %if %{with_storage_rbd} %files daemon-driver-storage-rbd %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_rbd.so -%endif + %endif -%if %{with_storage_zfs} + %if %{with_storage_zfs} %files daemon-driver-storage-zfs %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_zfs.so -%endif + %endif -%if %{with_qemu} + %if %{with_qemu} %files daemon-driver-qemu %config(noreplace) %{_sysconfdir}/libvirt/virtqemud.conf %config(noreplace) %{_prefix}/lib/sysctl.d/60-qemu-postcopy-migration.conf @@ -2196,9 +2236,9 @@ exit 0 %{_bindir}/virt-qemu-run %{_mandir}/man1/virt-qemu-run.1* %{_mandir}/man8/virtqemud.8* -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %files daemon-driver-lxc %config(noreplace) %{_sysconfdir}/libvirt/virtlxcd.conf %{_datadir}/augeas/lenses/virtlxcd.aug @@ -2220,9 +2260,9 @@ exit 0 %attr(0755, root, root) %{_libexecdir}/libvirt_lxc %{_libdir}/libvirt/connection-driver/libvirt_driver_lxc.so %{_mandir}/man8/virtlxcd.8* -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %files daemon-driver-libxl %config(noreplace) %{_sysconfdir}/libvirt/virtxend.conf %{_datadir}/augeas/lenses/virtxend.aug @@ -2248,9 +2288,9 @@ exit 0 %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/save/ %{_libdir}/libvirt/connection-driver/libvirt_driver_libxl.so %{_mandir}/man8/virtxend.8* -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %files daemon-driver-vbox %config(noreplace) %{_sysconfdir}/libvirt/virtvboxd.conf %{_datadir}/augeas/lenses/virtvboxd.aug @@ -2262,36 +2302,36 @@ exit 0 %attr(0755, root, root) %{_sbindir}/virtvboxd %{_libdir}/libvirt/connection-driver/libvirt_driver_vbox.so %{_mandir}/man8/virtvboxd.8* -%endif + %endif -%if %{with_qemu_tcg} + %if %{with_qemu_tcg} %files daemon-qemu -%endif + %endif -%if %{with_qemu_kvm} + %if %{with_qemu_kvm} %files daemon-kvm -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %files daemon-lxc -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %files daemon-xen -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %files daemon-vbox -%endif + %endif -%if %{with_sanlock} + %if %{with_sanlock} %files daemon-plugin-sanlock - %if %{with_qemu} + %if %{with_qemu} %config(noreplace) %{_sysconfdir}/libvirt/qemu-sanlock.conf - %endif - %if %{with_libxl} + %endif + %if %{with_libxl} %config(noreplace) %{_sysconfdir}/libvirt/libxl-sanlock.conf - %endif + %endif %dir %attr(0755, root, root) %{_libdir}/libvirt/lock-driver/ %attr(0755, root, root) %{_libdir}/libvirt/lock-driver/sanlock.so %{_datadir}/augeas/lenses/libvirt_sanlock.aug @@ -2300,7 +2340,7 @@ exit 0 %{_sbindir}/virt-sanlock-cleanup %{_mandir}/man8/virt-sanlock-cleanup.8* %attr(0755, root, root) %{_libexecdir}/libvirt_sanlock_helper -%endif + %endif %files client %{_mandir}/man1/virsh.1* @@ -2314,13 +2354,13 @@ exit 0 %{_bindir}/virt-pki-validate %{_datadir}/bash-completion/completions/virsh -%if %{with_qemu} + %if %{with_qemu} %files client-qemu %{_mandir}/man1/virt-qemu-qmp-proxy.1* %{_mandir}/man1/virt-qemu-sev-validate.1* %{_bindir}/virt-qemu-qmp-proxy %{_bindir}/virt-qemu-sev-validate -%endif + %endif %files libs -f %{name}.lang %license COPYING COPYING.LESSER @@ -2335,29 +2375,29 @@ exit 0 %dir %{_datadir}/libvirt/schemas/ %{_datadir}/systemtap/tapset/libvirt_probes*.stp %{_datadir}/systemtap/tapset/libvirt_functions.stp -%if %{with_qemu} + %if %{with_qemu} %{_datadir}/systemtap/tapset/libvirt_qemu_probes*.stp -%endif + %endif %{_datadir}/libvirt/schemas/*.rng %{_datadir}/libvirt/cpu_map/*.xml %{_datadir}/libvirt/test-screenshot.png -%if %{with_wireshark} + %if %{with_wireshark} %files wireshark %{wireshark_plugindir}/libvirt.so -%endif + %endif %files nss %{_libdir}/libnss_libvirt.so.2 %{_libdir}/libnss_libvirt_guest.so.2 -%if %{with_lxc} + %if %{with_lxc} %files login-shell %attr(4750, root, virtlogin) %{_bindir}/virt-login-shell %{_libexecdir}/virt-login-shell-helper %config(noreplace) %{_sysconfdir}/libvirt/virt-login-shell.conf %{_mandir}/man1/virt-login-shell.1* -%endif + %endif %files devel %{_libdir}/libvirt.so @@ -2392,8 +2432,9 @@ exit 0 %{_datadir}/libvirt/api/libvirt-admin-api.xml %{_datadir}/libvirt/api/libvirt-qemu-api.xml %{_datadir}/libvirt/api/libvirt-lxc-api.xml +%endif -%if %{with_mingw} +%if %{with_mingw32} %files -n mingw32-libvirt -f mingw32-libvirt.lang %dir %{mingw32_sysconfdir}/libvirt/ %config(noreplace) %{mingw32_sysconfdir}/libvirt/libvirt.conf @@ -2450,7 +2491,9 @@ exit 0 %{mingw32_mandir}/man1/virt-pki-query-dn.1* %{mingw32_mandir}/man1/virt-pki-validate.1* %{mingw32_mandir}/man7/virkey*.7* +%endif +%if %{with_mingw64} %files -n mingw64-libvirt -f mingw64-libvirt.lang %dir %{mingw64_sysconfdir}/libvirt/ %config(noreplace) %{mingw64_sysconfdir}/libvirt/libvirt.conf @@ -2511,6 +2554,9 @@ exit 0 %changelog +* Sat Dec 02 2023 Cole Robinson - 9.10.0-1 +- Update to version 9.10.0 + * Thu Nov 30 2023 Richard W.M. Jones - 9.9.0-3 - Bump and rebuild for xen 4.18.0 diff --git a/sources b/sources index 8d03d10..6a9762a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libvirt-9.9.0.tar.xz) = 77cea28acf4f3e8c92fbd5bd72ad084be183c07f14e3a9ce35d6d9d62d36ee97a30cef55fb204b3e43f282890ecd7d5827a784a517e7f4ed8b22ee502c3f09d7 +SHA512 (libvirt-9.10.0.tar.xz) = d35d14810a29aef9319d894e60d493c9011930e0b45d832861c8f8669ee66c0539cdd49f8e0a94801b510ae0f1ed150e4d6a03ea03cc23e8cb2e5456edd76f68 From f2a998ce76ae9e221e88ec90f866f4a6ad3caff6 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Dec 05 2023 18:41:25 +0000 Subject: [PATCH 9/19] Rebuild for xen 4.18.0 again --- diff --git a/libvirt.spec b/libvirt.spec index 7abaf9d..1ed5b3b 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -261,7 +261,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 9.10.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -2554,6 +2554,9 @@ exit 0 %changelog +* Tue Dec 05 2023 Adam Williamson - 9.10.0-2 +- Rebuild for xen 4.18.0 again + * Sat Dec 02 2023 Cole Robinson - 9.10.0-1 - Update to version 9.10.0 From 93a549eb1a21e6bbf507d05be7211dcb0897e505 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones Date: Dec 08 2023 10:02:08 +0000 Subject: [PATCH 10/19] Bump and rebuild for xen 4.18.0, third attempt --- diff --git a/libvirt.spec b/libvirt.spec index 1ed5b3b..7bd1dac 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -261,7 +261,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 9.10.0 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -2554,6 +2554,9 @@ exit 0 %changelog +* Fri Dec 8 2023 Richard W.M. Jones - 9.10.0-3 +- Bump and rebuild for xen 4.18.0, third attempt + * Tue Dec 05 2023 Adam Williamson - 9.10.0-2 - Rebuild for xen 4.18.0 again From 6eb56c2e715e7a764fe149f71449d04ab732e8b5 Mon Sep 17 00:00:00 2001 From: jonathanspw Date: Jan 03 2024 22:27:00 +0000 Subject: [PATCH 11/19] fix regression for default input bus in libvirt >= 9.3 (cherry picked from commit dfeabf11e5d21bd81209d4a7b0acd9b4b0afa754) --- diff --git a/libvirt-regression-input-default-bus.patch b/libvirt-regression-input-default-bus.patch new file mode 100644 index 0000000..eb687e5 --- /dev/null +++ b/libvirt-regression-input-default-bus.patch @@ -0,0 +1,31 @@ +From c9056e682a8a67dc29e39eb01392fcf8ee978c31 Mon Sep 17 00:00:00 2001 +From: Jonathan Wright +Date: Wed, 3 Jan 2024 09:26:59 -0600 +Subject: [PATCH] conf: Restore setting default bus for input devices + +Prior to v9.3.0-rc1~30 we used to set default bus for +devices, during XML parsing. In the commit this code was moved to +a post parse callback. But somehow the line that sets the bus in +one specific case disappeared. Bring it back. + +Resolves: https://gitlab.com/libvirt/libvirt/-/issues/577 +Fixes: c4bc4d3b82fbe22e03c986ca896090f481df5c10 +Signed-off-by: Jonathan Wright +Reviewed-by: Michal Privoznik +--- + src/conf/domain_postparse.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c +index e79913b73f..ee27023f3e 100644 +--- a/src/conf/domain_postparse.c ++++ b/src/conf/domain_postparse.c +@@ -657,6 +657,7 @@ virDomainInputDefPostParse(virDomainInputDef *input, + if ((input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE || + input->type == VIR_DOMAIN_INPUT_TYPE_KBD) && + (ARCH_IS_X86(def->os.arch) || def->os.arch == VIR_ARCH_NONE)) { ++ input->bus = VIR_DOMAIN_INPUT_BUS_PS2; + } else if (ARCH_IS_S390(def->os.arch) || + input->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) { + input->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO; +-- diff --git a/libvirt.spec b/libvirt.spec index 7bd1dac..c9fc8ab 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -261,7 +261,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 9.10.0 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -270,6 +270,10 @@ URL: https://libvirt.org/ %endif Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz +# Fix regression in default input bus +# https://gitlab.com/libvirt/libvirt/-/issues/577 +Patch1: libvirt-regression-input-default-bus.patch + Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} @@ -2554,6 +2558,9 @@ exit 0 %changelog +* Wed Jan 03 2024 Jonathan Wright - 9.10.0-4 +- conf: fix regression for default input bus + * Fri Dec 8 2023 Richard W.M. Jones - 9.10.0-3 - Bump and rebuild for xen 4.18.0, third attempt From f3cac3532b366f20ceeb8f72d30fcd3848451bee Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Jan 16 2024 16:11:03 +0000 Subject: [PATCH 12/19] libvirt-10.0.0-1 Update to version 10.0.0 --- diff --git a/libvirt-regression-input-default-bus.patch b/libvirt-regression-input-default-bus.patch deleted file mode 100644 index eb687e5..0000000 --- a/libvirt-regression-input-default-bus.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c9056e682a8a67dc29e39eb01392fcf8ee978c31 Mon Sep 17 00:00:00 2001 -From: Jonathan Wright -Date: Wed, 3 Jan 2024 09:26:59 -0600 -Subject: [PATCH] conf: Restore setting default bus for input devices - -Prior to v9.3.0-rc1~30 we used to set default bus for -devices, during XML parsing. In the commit this code was moved to -a post parse callback. But somehow the line that sets the bus in -one specific case disappeared. Bring it back. - -Resolves: https://gitlab.com/libvirt/libvirt/-/issues/577 -Fixes: c4bc4d3b82fbe22e03c986ca896090f481df5c10 -Signed-off-by: Jonathan Wright -Reviewed-by: Michal Privoznik ---- - src/conf/domain_postparse.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c -index e79913b73f..ee27023f3e 100644 ---- a/src/conf/domain_postparse.c -+++ b/src/conf/domain_postparse.c -@@ -657,6 +657,7 @@ virDomainInputDefPostParse(virDomainInputDef *input, - if ((input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE || - input->type == VIR_DOMAIN_INPUT_TYPE_KBD) && - (ARCH_IS_X86(def->os.arch) || def->os.arch == VIR_ARCH_NONE)) { -+ input->bus = VIR_DOMAIN_INPUT_BUS_PS2; - } else if (ARCH_IS_S390(def->os.arch) || - input->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) { - input->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO; --- diff --git a/libvirt.spec b/libvirt.spec index c9fc8ab..a74b516 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -96,6 +96,7 @@ %define with_sanlock 0 %define with_numad 0 %define with_nbdkit 0 +%define with_nbdkit_config_default 0 %define with_firewalld_zone 0 %define with_netcf 0 %define with_libssh2 0 @@ -174,15 +175,23 @@ %endif %endif -# We should only enable nbdkit support if the OS ships a SELinux policy that -# allows libvirt to launch it. Right now that's not the case anywhere, but -# things should be fine by the time Fedora 40 is released. -# -# TODO: add RHEL 9 once a minor release that contains the necessary SELinux -# bits exists (we only support the most recent minor release) +# We want to build with nbdkit support, but should only enable nbdkit by +# default if the OS ships a SELinux policy that allows libvirt to launch it. +# Right now that's not the case anywhere, but things should be fine by the time +# Fedora 40 is released. %if %{with_qemu} - %if 0%{?fedora} >= 40 + # rhel-8 lacks pidfd_open + %if 0%{?fedora} || 0%{?rhel} >= 9 %define with_nbdkit 0%{!?_without_nbdkit:1} + + # setting 'with_nbdkit_config_default' must be done only when compiling + # in nbdkit support + # + # TODO: add RHEL 9 once a minor release that contains the necessary SELinux + # bits exists (we only support the most recent minor release) + %if 0%{?fedora} >= 40 + %define with_nbdkit_config_default 0%{!?_without_nbdkit_config_default:1} + %endif %endif %endif @@ -260,8 +269,8 @@ Summary: Library providing a simple virtualization API Name: libvirt -Version: 9.10.0 -Release: 4%{?dist} +Version: 10.0.0 +Release: 1%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -270,10 +279,6 @@ URL: https://libvirt.org/ %endif Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz -# Fix regression in default input bus -# https://gitlab.com/libvirt/libvirt/-/issues/577 -Patch1: libvirt-regression-input-default-bus.patch - Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} @@ -396,9 +401,6 @@ BuildRequires: libssh2-devel >= 1.3.0 %if %{with_netcf} BuildRequires: netcf-devel >= 0.2.2 %endif - %if 0%{?fedora} || 0%{?rhel} >= 9 -BuildRequires: passt - %endif %if %{with_esx} BuildRequires: libcurl-devel %endif @@ -412,8 +414,6 @@ BuildRequires: systemtap-sdt-devel BuildRequires: util-linux # For showmount in FS driver (netfs discovery) BuildRequires: nfs-utils -# For storage wiping with different algorithms -BuildRequires: scrub %if %{with_numad} BuildRequires: numad %endif @@ -435,8 +435,6 @@ BuildRequires: mingw32-filesystem BuildRequires: mingw32-gcc BuildRequires: mingw32-binutils BuildRequires: mingw32-glib2 >= 2.48 -BuildRequires: mingw32-libgpg-error -BuildRequires: mingw32-libgcrypt BuildRequires: mingw32-gnutls BuildRequires: mingw32-gettext BuildRequires: mingw32-libxml2 @@ -450,8 +448,6 @@ BuildRequires: mingw64-filesystem BuildRequires: mingw64-gcc BuildRequires: mingw64-binutils BuildRequires: mingw64-glib2 >= 2.48 -BuildRequires: mingw64-libgpg-error -BuildRequires: mingw64-libgcrypt BuildRequires: mingw64-gnutls BuildRequires: mingw64-gettext BuildRequires: mingw64-libxml2 @@ -654,6 +650,8 @@ Requires: libvirt-libs = %{version}-%{release} Requires: nfs-utils # For mkfs Requires: util-linux +# For storage wiping with different algorithms +Requires: scrub %if %{with_qemu} # From QEMU RPMs Requires: /usr/bin/qemu-img @@ -1218,6 +1216,12 @@ exit 1 %define arg_nbdkit -Dnbdkit=disabled %endif +%if %{with_nbdkit_config_default} + %define arg_nbdkit_config_default -Dnbdkit_config_default=enabled +%else + %define arg_nbdkit_config_default -Dnbdkit_config_default=disabled +%endif + %if %{with_fuse} %define arg_fuse -Dfuse=enabled %else @@ -1333,6 +1337,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) %{?arg_sanlock} \ -Dlibpcap=enabled \ %{?arg_nbdkit} \ + %{?arg_nbdkit_config_default} \ -Dlibnl=enabled \ -Daudit=enabled \ -Ddtrace=enabled \ @@ -1398,6 +1403,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dhost_validate=disabled \ -Dlibiscsi=disabled \ -Dnbdkit=disabled \ + -Dnbdkit_config_default=disabled \ -Dlibnl=disabled \ -Dlibpcap=disabled \ -Dlibssh2=disabled \ @@ -2558,6 +2564,9 @@ exit 0 %changelog +* Tue Jan 16 2024 Cole Robinson - 10.0.0-1 +- Update to version 10.0.0 + * Wed Jan 03 2024 Jonathan Wright - 9.10.0-4 - conf: fix regression for default input bus diff --git a/sources b/sources index 6a9762a..c02b15d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libvirt-9.10.0.tar.xz) = d35d14810a29aef9319d894e60d493c9011930e0b45d832861c8f8669ee66c0539cdd49f8e0a94801b510ae0f1ed150e4d6a03ea03cc23e8cb2e5456edd76f68 +SHA512 (libvirt-10.0.0.tar.xz) = 4ab28539ff0e9a78ac231b11b4ec88b91d76ff2607cabd0226f04aaece73b05cab4aa9cfcf05073cd257ea270a377cd5d2cb915971583dbec04dadf2cf7ad252 From 659f2f0b369715f4fa17f432d8f5a56736c49b1b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Jan 21 2024 05:41:08 +0000 Subject: [PATCH 13/19] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- diff --git a/libvirt.spec b/libvirt.spec index a74b516..2686608 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -270,7 +270,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 10.0.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -2564,6 +2564,9 @@ exit 0 %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 10.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Tue Jan 16 2024 Cole Robinson - 10.0.0-1 - Update to version 10.0.0 From 9ef5501a94ae68617c2e9642870ad955533c646a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Jan 25 2024 03:55:08 +0000 Subject: [PATCH 14/19] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- diff --git a/libvirt.spec b/libvirt.spec index 2686608..8206143 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -270,7 +270,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 10.0.0 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -2564,6 +2564,9 @@ exit 0 %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 10.0.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 10.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 2513c9ff81f66a37428e1187f29eb553eeecaba1 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Feb 19 2024 15:44:48 +0000 Subject: [PATCH 15/19] libvirt-10.0.0-4 Rebuild for wireshark soname bump --- diff --git a/libvirt.spec b/libvirt.spec index 8206143..8717be8 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -270,7 +270,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 10.0.0 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -2564,6 +2564,9 @@ exit 0 %changelog +* Mon Feb 19 2024 Cole Robinson - 10.0.0-4 +- Rebuild for wireshark soname bump + * Thu Jan 25 2024 Fedora Release Engineering - 10.0.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From b0dd0117281dd01d26aafb52362984c6e240d212 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Feb 19 2024 16:35:24 +0000 Subject: [PATCH 16/19] spec: Handle bash-completion .pc file move it's in bash-completion-devel now, but pkgconfig() will handle that for us. Signed-off-by: Cole Robinson --- diff --git a/libvirt.spec b/libvirt.spec index 8717be8..86f8b73 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -332,7 +332,7 @@ BuildRequires: xen-devel BuildRequires: glib2-devel >= 2.56 BuildRequires: libxml2-devel BuildRequires: readline-devel -BuildRequires: bash-completion >= 2.0 +BuildRequires: pkgconfig(bash-completion) >= 2.0 BuildRequires: libtasn1-devel BuildRequires: gnutls-devel BuildRequires: libattr-devel From b0d2e09842f3a7b45aaedd84b0d74908d11cbbf9 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mar 01 2024 17:47:39 +0000 Subject: [PATCH 17/19] Update to version 10.1.0 Signed-off-by: Cole Robinson --- diff --git a/libvirt.spec b/libvirt.spec index 86f8b73..b8aa25b 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -90,6 +90,7 @@ # Other optional features %define with_numactl 0%{!?_without_numactl:1} +%define with_userfaultfd_sysctl 0%{!?_without_userfaultfd_sysctl:1} # A few optional bits off by default, we enable later %define with_fuse 0 @@ -246,6 +247,12 @@ %define enable_werror -Dwerror=false -Dgit_werror=disabled %endif +# Fedora and RHEL-9 are new enough to support /dev/userfaultfd, which +# does not require enabling vm.unprivileged_userfaultfd sysctl. +%if 0%{?fedora} || 0%{?rhel} >= 9 + %define with_userfaultfd_sysctl 0 +%endif + %define tls_priority "@LIBVIRT,SYSTEM" # libvirt 8.1.0 stops distributing any sysconfig files. @@ -269,12 +276,12 @@ Summary: Library providing a simple virtualization API Name: libvirt -Version: 10.0.0 -Release: 4%{?dist} +Version: 10.1.0 +Release: 1%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ -%if %(echo %{version} | grep -q "\.0$"; echo $?) == 1 +%if %(echo %{version} | grep "\.0$" >/dev/null; echo $?) == 1 %define mainturl stable_updates/ %endif Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz @@ -613,6 +620,7 @@ Requires: libvirt-libs = %{version}-%{release} # needed for device enumeration Requires: systemd >= 185 # For managing persistent mediated devices +# Note: for nodedev-update support at least mdevctl v1.3.0 is required Requires: mdevctl # for modprobe of pci devices Requires: module-init-tools @@ -1276,6 +1284,12 @@ exit 1 %define arg_remote_mode -Dremote_default_mode=legacy %endif +%if %{with_userfaultfd_sysctl} + %define arg_userfaultfd_sysctl -Duserfaultfd_sysctl=enabled +%else + %define arg_userfaultfd_sysctl -Duserfaultfd_sysctl=disabled +%endif + %define when %(date +"%%F-%%T") %define where %(hostname) %define who %{?packager}%{!?packager:Unknown} @@ -1355,6 +1369,8 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dqemu_moddir=%{qemu_moddir} \ -Dqemu_datadir=%{qemu_datadir} \ -Dtls_priority=%{tls_priority} \ + -Dsysctl_config=enabled \ + %{?arg_userfaultfd_sysctl} \ %{?enable_werror} \ -Dexpensive_tests=enabled \ -Dinit_script=systemd \ @@ -1438,6 +1454,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dstorage_vstorage=disabled \ -Dstorage_zfs=disabled \ -Dsysctl_config=disabled \ + -Duserfaultfd_sysctl=disabled \ -Dtests=disabled \ -Dudev=disabled \ -Dwireshark_dissector=disabled \ @@ -1473,6 +1490,7 @@ chmod 600 $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml %if ! %{with_qemu} rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug +rm -f $RPM_BUILD_ROOT%{_sysusersdir}/libvirt-qemu.conf %endif %find_lang %{name} @@ -1834,16 +1852,19 @@ exit 0 %pre daemon-driver-qemu %libvirt_sysconfig_pre virtqemud %libvirt_systemd_unix_pre virtqemud + # We want soft static allocation of well-known ids, as disk images -# are commonly shared across NFS mounts by id rather than name; see -# https://fedoraproject.org/wiki/Packaging:UsersAndGroups -getent group kvm >/dev/null || groupadd -f -g 36 -r kvm -getent group qemu >/dev/null || groupadd -f -g 107 -r qemu -if ! getent passwd qemu >/dev/null; then - if ! getent passwd 107 >/dev/null; then - useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu +# are commonly shared across NFS mounts by id rather than name. +# See https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/ +# We can not use the sysusers_create_compat macro here as we want to keep the +# specfile standalone and not relying on additionnal files. +getent group 'kvm' >/dev/null || groupadd -f -g '36' -r 'kvm' || : +getent group 'qemu' >/dev/null || groupadd -f -g '107' -r 'qemu' || : +if ! getent passwd 'qemu' >/dev/null; then + if ! getent passwd '107' >/dev/null; then + useradd -r -u '107' -g 'qemu' -G 'kvm' -d '/' -s '/sbin/nologin' -c 'qemu user' 'qemu' || : else - useradd -r -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu + useradd -r -g 'qemu' -G 'kvm' -d '/' -s '/sbin/nologin' -c 'qemu user' 'qemu' || : fi fi exit 0 @@ -2211,7 +2232,9 @@ exit 0 %if %{with_qemu} %files daemon-driver-qemu %config(noreplace) %{_sysconfdir}/libvirt/virtqemud.conf + %if %{with_userfaultfd_sysctl} %config(noreplace) %{_prefix}/lib/sysctl.d/60-qemu-postcopy-migration.conf + %endif %{_datadir}/augeas/lenses/virtqemud.aug %{_datadir}/augeas/lenses/tests/test_virtqemud.aug %{_unitdir}/virtqemud.service @@ -2246,6 +2269,7 @@ exit 0 %{_bindir}/virt-qemu-run %{_mandir}/man1/virt-qemu-run.1* %{_mandir}/man8/virtqemud.8* +%{_sysusersdir}/libvirt-qemu.conf %endif %if %{with_lxc} @@ -2564,6 +2588,9 @@ exit 0 %changelog +* Fri Mar 01 2024 Cole Robinson - 10.1.0-1 +- Update to version 10.1.0 + * Mon Feb 19 2024 Cole Robinson - 10.0.0-4 - Rebuild for wireshark soname bump From f4d251ad6e3ad2bfb213dc2072aa7861b061c852 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mar 01 2024 18:00:28 +0000 Subject: [PATCH 18/19] Add sources Signed-off-by: Cole Robinson --- diff --git a/sources b/sources index c02b15d..fa67790 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libvirt-10.0.0.tar.xz) = 4ab28539ff0e9a78ac231b11b4ec88b91d76ff2607cabd0226f04aaece73b05cab4aa9cfcf05073cd257ea270a377cd5d2cb915971583dbec04dadf2cf7ad252 +SHA512 (libvirt-10.1.0.tar.xz) = 08e73ae15de5681430b62db85ec9901242dca5e9a4ca9685614f4a67092c6e28f27f9187144b3ceb18ad6b40e6eb1a90b1a4b056b0888724d04a62002ee2bc48 From 475d2833d9a72df80d6604ca8e5d8adcbfe3b070 Mon Sep 17 00:00:00 2001 From: Roberto Campesato Date: Mar 27 2024 13:44:20 +0000 Subject: [PATCH 19/19] Merge remote-tracking branch 'upstream/rawhide' into upgrade-hyperscale-libvirt --- diff --git a/libvirt.spec b/libvirt.spec index a648aeb..a0774ca 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -90,11 +90,14 @@ # Other optional features %define with_numactl 0%{!?_without_numactl:1} +%define with_userfaultfd_sysctl 0%{!?_without_userfaultfd_sysctl:1} # A few optional bits off by default, we enable later %define with_fuse 0 %define with_sanlock 0 %define with_numad 0 +%define with_nbdkit 0 +%define with_nbdkit_config_default 0 %define with_firewalld_zone 0 %define with_netcf 0 %define with_libssh2 0 @@ -128,7 +131,6 @@ %define with_vmware 0 %define with_libxl 0 %define with_hyperv 0 - %define with_vz 0 %define with_lxc 0 %endif @@ -174,6 +176,26 @@ %endif %endif +# We want to build with nbdkit support, but should only enable nbdkit by +# default if the OS ships a SELinux policy that allows libvirt to launch it. +# Right now that's not the case anywhere, but things should be fine by the time +# Fedora 40 is released. +%if %{with_qemu} + # rhel-8 lacks pidfd_open + %if 0%{?fedora} || 0%{?rhel} >= 9 + %define with_nbdkit 0%{!?_without_nbdkit:1} + + # setting 'with_nbdkit_config_default' must be done only when compiling + # in nbdkit support + # + # TODO: add RHEL 9 once a minor release that contains the necessary SELinux + # bits exists (we only support the most recent minor release) + %if 0%{?fedora} >= 40 + %define with_nbdkit_config_default 0%{!?_without_nbdkit_config_default:1} + %endif + %endif +%endif + %ifarch %{arches_dmidecode} %define with_dmidecode 0%{!?_without_dmidecode:1} %endif @@ -191,9 +213,29 @@ %define qemu_moddir %{_libdir}/qemu %define qemu_datadir %{_datadir}/qemu -%define with_mingw 0 +# Native / MinGW builds +%define with_native 0%{!?_without_native:1} + +%define with_mingw32 0 +%define with_mingw64 0 + %if 0%{?fedora} - %define with_mingw 0%{!?_without_mingw:1} + %if 0%{!?_without_mingw:1} + %define with_mingw32 0%{!?_without_mingw32:1} + %define with_mingw64 0%{!?_without_mingw64:1} + %endif + + # These tell the other mingw macros whether to perform or + # skip the 32-bit and 64-bit specific steps respectively + %define mingw_build_win32 %{with_mingw32} + %define mingw_build_win64 %{with_mingw64} +%endif + +%if !%{with_native} + # Building the debugsource package apparently only works if the + # native build is enabled. debuginfo packages don't have this + # problem and setting this doesn't disable them + %global debug_package %{nil} %endif # RHEL releases provide stable tool chains and so it is safe to turn @@ -205,6 +247,12 @@ %define enable_werror -Dwerror=false -Dgit_werror=disabled %endif +# Fedora and RHEL-9 are new enough to support /dev/userfaultfd, which +# does not require enabling vm.unprivileged_userfaultfd sysctl. +%if 0%{?fedora} || 0%{?rhel} >= 9 + %define with_userfaultfd_sysctl 0 +%endif + %define tls_priority "@LIBVIRT,SYSTEM" # libvirt 8.1.0 stops distributing any sysconfig files. @@ -226,14 +274,20 @@ done \ %{nil} +# To prevent rpmdev-bumpspec breakage +%global baserelease 1 + +# Hyperscale release +%global hsrel .1 + Summary: Library providing a simple virtualization API Name: libvirt -Version: 9.7.0 -Release: 1%{?dist} +Version: 10.1.0 +Release: %{baserelease}%{?hsrel}%{?dist} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ -%if %(echo %{version} | grep -q "\.0$"; echo $?) == 1 +%if %(echo %{version} | grep "\.0$" >/dev/null; echo $?) == 1 %define mainturl stable_updates/ %endif Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz @@ -249,6 +303,7 @@ Requires: libvirt-daemon-driver-lxc = %{version}-%{release} %endif %if %{with_qemu} Requires: libvirt-daemon-driver-qemu = %{version}-%{release} +Requires: libvirt-client-qemu = %{version}-%{release} %endif # We had UML driver, but we've removed it. Obsoletes: libvirt-daemon-driver-uml <= 5.0.0 @@ -268,21 +323,29 @@ Requires: libvirt-libs = %{version}-%{release} # All build-time requirements. Run-time requirements are # listed against each sub-RPM BuildRequires: python3-docutils -BuildRequires: gcc BuildRequires: meson >= 0.56.0 BuildRequires: ninja-build BuildRequires: git BuildRequires: perl-interpreter BuildRequires: python3 -%if %{with_libxl} +BuildRequires: python3-pytest +# For xmllint +BuildRequires: libxml2 +# For xsltproc +BuildRequires: libxslt +BuildRequires: gettext +BuildRequires: systemd-rpm-macros +# Fedora build root suckage +BuildRequires: gawk +%if %{with_native} +BuildRequires: gcc + %if %{with_libxl} BuildRequires: xen-devel -%endif + %endif BuildRequires: glib2-devel >= 2.56 BuildRequires: libxml2-devel -BuildRequires: libxslt BuildRequires: readline-devel -BuildRequires: bash-completion >= 2.0 -BuildRequires: gettext +BuildRequires: pkgconfig(bash-completion) >= 2.0 BuildRequires: libtasn1-devel BuildRequires: gnutls-devel BuildRequires: libattr-devel @@ -291,71 +354,72 @@ BuildRequires: libblkid-devel >= 2.17 # for augparse, optionally used in testing BuildRequires: augeas BuildRequires: systemd-devel >= 185 -BuildRequires: systemd-rpm-macros BuildRequires: libpciaccess-devel >= 0.10.9 BuildRequires: yajl-devel -%if %{with_sanlock} + %if %{with_sanlock} BuildRequires: sanlock-devel >= 2.4 -%endif + %endif BuildRequires: libpcap-devel >= 1.5.0 BuildRequires: libnl3-devel BuildRequires: libselinux-devel BuildRequires: iptables BuildRequires: ebtables -BuildRequires: module-init-tools +# For modprobe +BuildRequires: kmod BuildRequires: cyrus-sasl-devel BuildRequires: polkit >= 0.112 # For mount/umount in FS driver BuildRequires: util-linux -%if %{with_qemu} + %if %{with_qemu} # For managing ACLs BuildRequires: libacl-devel # From QEMU RPMs, used by virstoragetest BuildRequires: /usr/bin/qemu-img -%endif + %endif +# nbdkit support requires libnbd + %if %{with_nbdkit} +BuildRequires: libnbd-devel + %endif # For LVM drivers BuildRequires: lvm2 # For pool type=iscsi BuildRequires: iscsi-initiator-utils -%if %{with_storage_iscsi_direct} + %if %{with_storage_iscsi_direct} # For pool type=iscsi-direct BuildRequires: libiscsi-devel -%endif + %endif # For disk driver BuildRequires: parted-devel # For Multipath support BuildRequires: device-mapper-devel -%if %{with_storage_rbd} + %if %{with_storage_rbd} BuildRequires: librados-devel BuildRequires: librbd-devel -%endif -%if %{with_storage_gluster} + %endif + %if %{with_storage_gluster} BuildRequires: glusterfs-api-devel >= 3.4.1 BuildRequires: glusterfs-devel >= 3.4.1 -%endif -%if %{with_numactl} + %endif + %if %{with_numactl} # For QEMU/LXC numa info BuildRequires: numactl-devel -%endif + %endif BuildRequires: libcap-ng-devel >= 0.5.0 -%if %{with_fuse} + %if %{with_fuse} BuildRequires: fuse-devel >= 2.8.6 -%endif -%if %{with_libssh2} + %endif + %if %{with_libssh2} BuildRequires: libssh2-devel >= 1.3.0 -%endif -%if %{with_netcf} + %endif + %if %{with_netcf} BuildRequires: netcf-devel >= 0.2.2 -%endif -%if 0%{?fedora} || 0%{?rhel} >= 9 -BuildRequires: passt -%endif -%if %{with_esx} + %endif + %if %{with_esx} BuildRequires: libcurl-devel -%endif -%if %{with_hyperv} + %endif + %if %{with_hyperv} BuildRequires: libwsman-devel >= 2.6.3 -%endif + %endif BuildRequires: audit-libs-devel # we need /usr/sbin/dtrace BuildRequires: systemtap-sdt-devel @@ -363,33 +427,27 @@ BuildRequires: systemtap-sdt-devel BuildRequires: util-linux # For showmount in FS driver (netfs discovery) BuildRequires: nfs-utils -# Fedora build root suckage -BuildRequires: gawk -# For storage wiping with different algorithms -BuildRequires: scrub -%if %{with_numad} + %if %{with_numad} BuildRequires: numad -%endif -%if %{with_wireshark} + %endif + %if %{with_wireshark} BuildRequires: wireshark-devel -%endif -%if %{with_libssh} + %endif + %if %{with_libssh} BuildRequires: libssh-devel >= 0.8.1 -%endif -BuildRequires: rpcgen + %endif BuildRequires: libtirpc-devel + %if %{with_firewalld_zone} # Needed for the firewalld_reload macro -%if %{with_firewalld_zone} BuildRequires: firewalld-filesystem + %endif %endif -%if %{with_mingw} +%if %{with_mingw32} BuildRequires: mingw32-filesystem BuildRequires: mingw32-gcc BuildRequires: mingw32-binutils BuildRequires: mingw32-glib2 >= 2.48 -BuildRequires: mingw32-libgpg-error -BuildRequires: mingw32-libgcrypt BuildRequires: mingw32-gnutls BuildRequires: mingw32-gettext BuildRequires: mingw32-libxml2 @@ -397,12 +455,12 @@ BuildRequires: mingw32-portablexdr BuildRequires: mingw32-dlfcn BuildRequires: mingw32-libssh2 BuildRequires: mingw32-curl +%endif +%if %{with_mingw64} BuildRequires: mingw64-filesystem BuildRequires: mingw64-gcc BuildRequires: mingw64-binutils BuildRequires: mingw64-glib2 >= 2.48 -BuildRequires: mingw64-libgpg-error -BuildRequires: mingw64-libgcrypt BuildRequires: mingw64-gnutls BuildRequires: mingw64-gettext BuildRequires: mingw64-libxml2 @@ -417,6 +475,7 @@ Libvirt is a C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). The main package includes the libvirtd server exporting the virtualization support. +%if %{with_native} %package docs Summary: API reference and website documentation @@ -456,10 +515,10 @@ Requires: iproute # for /sbin/tc Requires: iproute-tc Requires: polkit >= 0.112 -%if %{with_dmidecode} + %if %{with_dmidecode} # For virConnectGetSysinfo Requires: dmidecode -%endif + %endif # For service management Requires(posttrans): /usr/bin/systemctl Requires(preun): /usr/bin/systemctl @@ -468,11 +527,11 @@ Requires: dbus # For uid creation during pre Requires(pre): shadow-utils # Needed by /usr/libexec/libvirt-guests.sh script. -%if 0%{?fedora} + %if 0%{?fedora} Requires: gettext-runtime -%else + %else Requires: gettext -%endif + %endif # Ensure smooth upgrades Obsoletes: libvirt-admin < 7.3.0 @@ -567,6 +626,7 @@ Requires: libvirt-libs = %{version}-%{release} # needed for device enumeration Requires: systemd >= 185 # For managing persistent mediated devices +# Note: for nodedev-update support at least mdevctl v1.3.0 is required Requires: mdevctl # for modprobe of pci devices Requires: module-init-tools @@ -580,9 +640,9 @@ capabilities. Summary: Interface driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-libs = %{version}-%{release} -%if %{with_netcf} + %if %{with_netcf} Requires: netcf-libs >= 0.2.2 -%endif + %endif %description daemon-driver-interface The interface driver plugin for the libvirtd daemon, providing @@ -604,13 +664,15 @@ Requires: libvirt-libs = %{version}-%{release} Requires: nfs-utils # For mkfs Requires: util-linux -%if %{with_qemu} +# For storage wiping with different algorithms +Requires: scrub + %if %{with_qemu} # From QEMU RPMs Requires: /usr/bin/qemu-img -%endif -%if !%{with_storage_rbd} + %endif + %if !%{with_storage_rbd} Obsoletes: libvirt-daemon-driver-storage-rbd < 5.2.0 -%endif + %endif Obsoletes: libvirt-daemon-driver-storage-sheepdog < 8.8.0 %description daemon-driver-storage-core @@ -658,7 +720,7 @@ Requires: iscsi-initiator-utils The storage driver backend adding implementation of the storage APIs for iscsi volumes using the host iscsi stack. -%if %{with_storage_iscsi_direct} + %if %{with_storage_iscsi_direct} %package daemon-driver-storage-iscsi-direct Summary: Storage driver plugin for iscsi-direct Requires: libvirt-daemon-driver-storage-core = %{version}-%{release} @@ -667,7 +729,7 @@ Requires: libvirt-libs = %{version}-%{release} %description daemon-driver-storage-iscsi-direct The storage driver backend adding implementation of the storage APIs for iscsi volumes using libiscsi direct connection. -%endif + %endif %package daemon-driver-storage-mpath Summary: Storage driver plugin for multipath volumes @@ -679,24 +741,24 @@ Requires: device-mapper The storage driver backend adding implementation of the storage APIs for multipath storage using device mapper. -%if %{with_storage_gluster} + %if %{with_storage_gluster} %package daemon-driver-storage-gluster Summary: Storage driver plugin for gluster Requires: libvirt-daemon-driver-storage-core = %{version}-%{release} Requires: libvirt-libs = %{version}-%{release} - %if 0%{?fedora} + %if 0%{?fedora} Requires: glusterfs-client >= 2.0.1 - %endif - %if 0%{?fedora} || 0%{?with_storage_gluster} + %endif + %if 0%{?fedora} || 0%{?with_storage_gluster} Requires: /usr/sbin/gluster - %endif + %endif %description daemon-driver-storage-gluster The storage driver backend adding implementation of the storage APIs for gluster volumes using libgfapi. -%endif + %endif -%if %{with_storage_rbd} + %if %{with_storage_rbd} %package daemon-driver-storage-rbd Summary: Storage driver plugin for rbd Requires: libvirt-daemon-driver-storage-core = %{version}-%{release} @@ -705,9 +767,9 @@ Requires: libvirt-libs = %{version}-%{release} %description daemon-driver-storage-rbd The storage driver backend adding implementation of the storage APIs for rbd volumes using the ceph protocol. -%endif + %endif -%if %{with_storage_zfs} + %if %{with_storage_zfs} %package daemon-driver-storage-zfs Summary: Storage driver plugin for ZFS Requires: libvirt-daemon-driver-storage-core = %{version}-%{release} @@ -719,7 +781,7 @@ Requires: /sbin/zpool %description daemon-driver-storage-zfs The storage driver backend adding implementation of the storage APIs for ZFS volumes. -%endif + %endif %package daemon-driver-storage Summary: Storage driver plugin including all backends for the libvirtd daemon @@ -729,25 +791,25 @@ Requires: libvirt-daemon-driver-storage-logical = %{version}-%{release} Requires: libvirt-daemon-driver-storage-scsi = %{version}-%{release} Requires: libvirt-daemon-driver-storage-iscsi = %{version}-%{release} Requires: libvirt-daemon-driver-storage-mpath = %{version}-%{release} -%if %{with_storage_iscsi_direct} + %if %{with_storage_iscsi_direct} Requires: libvirt-daemon-driver-storage-iscsi-direct = %{version}-%{release} -%endif -%if %{with_storage_gluster} + %endif + %if %{with_storage_gluster} Requires: libvirt-daemon-driver-storage-gluster = %{version}-%{release} -%endif -%if %{with_storage_rbd} + %endif + %if %{with_storage_rbd} Requires: libvirt-daemon-driver-storage-rbd = %{version}-%{release} -%endif -%if %{with_storage_zfs} + %endif + %if %{with_storage_zfs} Requires: libvirt-daemon-driver-storage-zfs = %{version}-%{release} -%endif + %endif %description daemon-driver-storage The storage driver plugin for the libvirtd daemon, providing an implementation of the storage APIs using LVM, iSCSI, parted and more. -%if %{with_qemu} + %if %{with_qemu} %package daemon-driver-qemu Summary: QEMU driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} @@ -761,21 +823,26 @@ Requires: lzop Requires: xz Requires: systemd-container Requires: swtpm-tools - %if %{with_numad} + %if %{with_numad} Requires: numad - %endif - %if 0%{?fedora} || 0%{?rhel} >= 9 + %endif + %if 0%{?fedora} || 0%{?rhel} >= 9 Recommends: passt Recommends: passt-selinux - %endif + %endif + %if %{with_nbdkit} +Recommends: nbdkit +Recommends: nbdkit-curl-plugin +Recommends: nbdkit-ssh-plugin + %endif %description daemon-driver-qemu The qemu driver plugin for the libvirtd daemon, providing an implementation of the hypervisor driver APIs using QEMU -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %package daemon-driver-lxc Summary: LXC driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} @@ -785,17 +852,17 @@ Requires: libvirt-daemon-driver-network = %{version}-%{release} Requires: systemd-container # for modprobe of nbd driver Requires: module-init-tools - %if %{with_numad} + %if %{with_numad} Requires: numad - %endif + %endif %description daemon-driver-lxc The LXC driver plugin for the libvirtd daemon, providing an implementation of the hypervisor driver APIs using the Linux kernel -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %package daemon-driver-vbox Summary: VirtualBox driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} @@ -805,9 +872,9 @@ Requires: libvirt-libs = %{version}-%{release} The vbox driver plugin for the libvirtd daemon, providing an implementation of the hypervisor driver APIs using VirtualBox -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %package daemon-driver-libxl Summary: Libxl driver plugin for the libvirtd daemon Requires: libvirt-daemon-common = %{version}-%{release} @@ -818,22 +885,22 @@ Obsoletes: libvirt-daemon-driver-xen < 4.3.0 The Libxl driver plugin for the libvirtd daemon, providing an implementation of the hypervisor driver APIs using Libxl -%endif + %endif -%if %{with_qemu_tcg} + %if %{with_qemu_tcg} %package daemon-qemu Summary: Server side daemon & driver required to run QEMU guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-log = %{version}-%{release} Requires: libvirt-daemon-lock = %{version}-%{release} Requires: libvirt-daemon-plugin-lockd = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-qemu = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -846,22 +913,22 @@ Requires: qemu %description daemon-qemu Server side daemon and driver required to manage the virtualization capabilities of the QEMU TCG emulators -%endif + %endif -%if %{with_qemu_kvm} + %if %{with_qemu_kvm} %package daemon-kvm Summary: Server side daemon & driver required to run KVM guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-log = %{version}-%{release} Requires: libvirt-daemon-lock = %{version}-%{release} Requires: libvirt-daemon-plugin-lockd = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-qemu = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -869,24 +936,30 @@ Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release} Requires: libvirt-daemon-driver-secret = %{version}-%{release} Requires: libvirt-daemon-driver-storage = %{version}-%{release} + +# relax requirement for qemu-kvm for fb builds +%if 0%{?facebook} +Recommends: qemu-kvm +%else Requires: qemu-kvm +%endif %description daemon-kvm Server side daemon and driver required to manage the virtualization capabilities of the KVM hypervisor -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %package daemon-lxc Summary: Server side daemon & driver required to run LXC guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-lxc = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -898,21 +971,21 @@ Requires: libvirt-daemon-driver-storage = %{version}-%{release} %description daemon-lxc Server side daemon and driver required to manage the virtualization capabilities of LXC -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %package daemon-xen Summary: Server side daemon & driver required to run XEN guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-lock = %{version}-%{release} Requires: libvirt-daemon-plugin-lockd = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-libxl = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -925,19 +998,19 @@ Requires: xen %description daemon-xen Server side daemon and driver required to manage the virtualization capabilities of XEN -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %package daemon-vbox Summary: Server side daemon & driver required to run VirtualBox guests - %if %{with_modular_daemons} + %if %{with_modular_daemons} Requires: libvirt-daemon-common = %{version}-%{release} Requires: libvirt-daemon-proxy = %{version}-%{release} Recommends: libvirt-daemon = %{version}-%{release} - %else + %else Requires: libvirt-daemon = %{version}-%{release} - %endif + %endif Requires: libvirt-daemon-driver-vbox = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} @@ -949,7 +1022,7 @@ Requires: libvirt-daemon-driver-storage = %{version}-%{release} %description daemon-vbox Server side daemon and driver required to manage the virtualization capabilities of VirtualBox -%endif + %endif %package client Summary: Client side utilities of the libvirt library @@ -986,7 +1059,7 @@ Requires: cyrus-sasl-gssapi %description libs Shared libraries for accessing the libvirt daemon. -%if %{with_wireshark} + %if %{with_wireshark} %package wireshark Summary: Wireshark dissector plugin for libvirt RPC transactions Requires: wireshark @@ -994,9 +1067,9 @@ Requires: libvirt-libs = %{version}-%{release} %description wireshark Wireshark dissector plugin for better analysis of libvirt RPC traffic. -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %package login-shell Summary: Login shell for connecting users to an LXC container Requires: libvirt-libs = %{version}-%{release} @@ -1005,7 +1078,7 @@ Requires: libvirt-libs = %{version}-%{release} Provides the set-uid virt-login-shell binary that is used to connect a user to an LXC container when they login, by switching namespaces. -%endif + %endif %package devel Summary: Libraries, includes, etc. to compile with the libvirt library @@ -1015,7 +1088,7 @@ Requires: pkgconfig %description devel Include header files & development libraries for the libvirt C library. -%if %{with_sanlock} + %if %{with_sanlock} %package daemon-plugin-sanlock Summary: Sanlock lock manager plugin for QEMU driver Requires: sanlock >= 2.4 @@ -1028,7 +1101,7 @@ Provides: libvirt-lock-sanlock = %{version}-%{release} %description daemon-plugin-sanlock Includes the Sanlock lock manager plugin for the QEMU driver -%endif + %endif %package nss Summary: Libvirt plugin for Name Service Switch @@ -1036,8 +1109,9 @@ Requires: libvirt-daemon-driver-network = %{version}-%{release} %description nss Libvirt plugin for NSS for translating domain names into IP addresses. +%endif -%if %{with_mingw} +%if %{with_mingw32} %package -n mingw32-libvirt Summary: %{summary} Obsoletes: mingw32-libvirt-static < 7.0.0 @@ -1046,6 +1120,10 @@ BuildArch: noarch %description -n mingw32-libvirt MinGW Windows libvirt virtualization library. +%{?mingw32_debug_package} +%endif + +%if %{with_mingw64} %package -n mingw64-libvirt Summary: %{summary} Obsoletes: mingw64-libvirt-static < 7.0.0 @@ -1054,7 +1132,7 @@ BuildArch: noarch %description -n mingw64-libvirt MinGW Windows libvirt virtualization library. -%{?mingw_debug_package} +%{?mingw64_debug_package} %endif %prep @@ -1152,6 +1230,18 @@ exit 1 %define arg_numad -Dnumad=disabled %endif +%if %{with_nbdkit} + %define arg_nbdkit -Dnbdkit=enabled +%else + %define arg_nbdkit -Dnbdkit=disabled +%endif + +%if %{with_nbdkit_config_default} + %define arg_nbdkit_config_default -Dnbdkit_config_default=enabled +%else + %define arg_nbdkit_config_default -Dnbdkit_config_default=disabled +%endif + %if %{with_fuse} %define arg_fuse -Dfuse=enabled %else @@ -1206,6 +1296,12 @@ exit 1 %define arg_remote_mode -Dremote_default_mode=legacy %endif +%if %{with_userfaultfd_sysctl} + %define arg_userfaultfd_sysctl -Duserfaultfd_sysctl=enabled +%else + %define arg_userfaultfd_sysctl -Duserfaultfd_sysctl=disabled +%endif + %define when %(date +"%%F-%%T") %define where %(hostname) %define who %{?packager}%{!?packager:Unknown} @@ -1217,6 +1313,7 @@ exit 1 export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) +%if %{with_native} %meson \ -Drunstatedir=%{_rundir} \ -Dinitconfdir=%{_sysconfdir}/sysconfig \ @@ -1255,6 +1352,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dcapng=enabled \ %{?arg_fuse} \ %{?arg_netcf} \ + -Dnls=enabled \ -Dselinux=enabled \ %{?arg_selinux_mount} \ -Dapparmor=disabled \ @@ -1264,6 +1362,8 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dyajl=enabled \ %{?arg_sanlock} \ -Dlibpcap=enabled \ + %{?arg_nbdkit} \ + %{?arg_nbdkit_config_default} \ -Dlibnl=enabled \ -Daudit=enabled \ -Ddtrace=enabled \ @@ -1281,6 +1381,8 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dqemu_moddir=%{qemu_moddir} \ -Dqemu_datadir=%{qemu_datadir} \ -Dtls_priority=%{tls_priority} \ + -Dsysctl_config=enabled \ + %{?arg_userfaultfd_sysctl} \ %{?enable_werror} \ -Dexpensive_tests=enabled \ -Dinit_script=systemd \ @@ -1290,8 +1392,9 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) %{?arg_login_shell} %meson_build +%endif -%if %{with_mingw} +%if %{with_mingw32} || %{with_mingw64} %mingw_meson \ --auto-features=enabled \ -Ddriver_remote=enabled \ @@ -1320,20 +1423,22 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Ddriver_vmware=disabled \ -Ddriver_vz=disabled \ -Ddtrace=disabled \ - -Dexpensive_tests=enabled \ + -Dexpensive_tests=disabled \ -Dfirewalld=disabled \ -Dfirewalld_zone=disabled \ -Dfuse=disabled \ -Dglusterfs=disabled \ -Dhost_validate=disabled \ -Dlibiscsi=disabled \ + -Dnbdkit=disabled \ + -Dnbdkit_config_default=disabled \ -Dlibnl=disabled \ -Dlibpcap=disabled \ -Dlibssh2=disabled \ -Dlibssh=disabled \ -Dlogin_shell=disabled \ -Dnetcf=disabled \ - -Dnls=disabled \ + -Dnls=enabled \ -Dnss=disabled \ -Dnumactl=disabled \ -Dnumad=disabled \ @@ -1361,11 +1466,12 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dstorage_vstorage=disabled \ -Dstorage_zfs=disabled \ -Dsysctl_config=disabled \ + -Duserfaultfd_sysctl=disabled \ -Dtests=disabled \ -Dudev=disabled \ -Dwireshark_dissector=disabled \ -Dyajl=disabled -%mingw_ninja + %mingw_ninja %endif %install @@ -1373,6 +1479,7 @@ rm -fr %{buildroot} export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) +%if %{with_native} %meson_install # We don't want to install /etc/libvirt/qemu/networks in the main %%files list @@ -1392,65 +1499,73 @@ cp -a $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml \ # libvirt saves these files with mode 600 chmod 600 $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml -%if ! %{with_qemu} + %if ! %{with_qemu} rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug -%endif +rm -f $RPM_BUILD_ROOT%{_sysusersdir}/libvirt-qemu.conf + %endif %find_lang %{name} -%if ! %{with_sanlock} + %if ! %{with_sanlock} rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirt_sanlock.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug -%endif + %endif -%if ! %{with_lxc} + %if ! %{with_lxc} rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug -%endif + %endif -%if ! %{with_qemu} + %if ! %{with_qemu} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu.conf rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu -%endif -%if ! %{with_lxc} + %endif + %if ! %{with_lxc} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/lxc.conf rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc -%endif -%if ! %{with_libxl} + %endif + %if ! %{with_libxl} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/libxl.conf rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.libxl rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_libxl.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug -%endif + %endif # Copied into libvirt-docs subpackage eventually mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt libvirt-docs -%ifarch %{arches_systemtap_64bit} + %ifarch %{arches_systemtap_64bit} mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes.stp \ $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes-64.stp - %if %{with_qemu} + %if %{with_qemu} mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \ $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes-64.stp + %endif %endif %endif -%if %{with_mingw} +%if %{with_mingw32} || %{with_mingw64} %mingw_ninja_install +%endif +%if %{with_mingw32} rm -rf $RPM_BUILD_ROOT%{mingw32_sysconfdir}/libvirt/nwfilter -rm -rf $RPM_BUILD_ROOT%{mingw64_sysconfdir}/libvirt/nwfilter rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/doc/* -rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/doc/* rm -rf $RPM_BUILD_ROOT%{mingw32_datadir}/gtk-doc/* -rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc/* - rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt_iohelper.exe -rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt_iohelper.exe rm -rf $RPM_BUILD_ROOT%{mingw32_libexecdir}/libvirt-guests.sh +%endif + +%if %{with_mingw64} +rm -rf $RPM_BUILD_ROOT%{mingw64_sysconfdir}/libvirt/nwfilter +rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/doc/* +rm -rf $RPM_BUILD_ROOT%{mingw64_datadir}/gtk-doc/* +rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt_iohelper.exe rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh +%endif +%if %{with_mingw32} || %{with_mingw64} %mingw_debug_install_post %mingw_find_lang %{name} @@ -1458,9 +1573,12 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh %endif %check + +%if %{with_native} # Building on slow archs, like emulated s390x in Fedora copr, requires # raising the test timeout VIR_TEST_DEBUG=1 %meson_test --no-suite syntax-check --timeout-multiplier 10 +%endif %define libvirt_rpmstatedir %{_localstatedir}/lib/rpm-state/libvirt @@ -1606,6 +1724,7 @@ VIR_TEST_DEBUG=1 %meson_test --no-suite syntax-check --timeout-multiplier 10 %define libvirt_systemd_config_pre() %libvirt_systemd_schedule_restart %1.service %define libvirt_systemd_config_posttrans() %libvirt_systemd_perform_restart %1.service +%if %{with_native} %pre daemon %libvirt_sysconfig_pre libvirtd %libvirt_systemd_inet_pre libvirtd @@ -1670,9 +1789,9 @@ exit 0 %libvirt_systemd_unix_pre virtnetworkd %post daemon-driver-network -%if %{with_firewalld_zone} + %if %{with_firewalld_zone} %firewalld_reload -%endif + %endif %posttrans daemon-driver-network %libvirt_sysconfig_posttrans virtnetworkd @@ -1682,9 +1801,9 @@ exit 0 %libvirt_systemd_unix_preun virtnetworkd %postun daemon-driver-network -%if %{with_firewalld_zone} + %if %{with_firewalld_zone} %firewalld_reload -%endif + %endif %pre daemon-driver-nwfilter %libvirt_sysconfig_pre virtnwfilterd @@ -1741,20 +1860,23 @@ exit 0 %preun daemon-driver-storage-core %libvirt_systemd_unix_preun virtstoraged -%if %{with_qemu} + %if %{with_qemu} %pre daemon-driver-qemu %libvirt_sysconfig_pre virtqemud %libvirt_systemd_unix_pre virtqemud + # We want soft static allocation of well-known ids, as disk images -# are commonly shared across NFS mounts by id rather than name; see -# https://fedoraproject.org/wiki/Packaging:UsersAndGroups -getent group kvm >/dev/null || groupadd -f -g 36 -r kvm -getent group qemu >/dev/null || groupadd -f -g 107 -r qemu -if ! getent passwd qemu >/dev/null; then - if ! getent passwd 107 >/dev/null; then - useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu +# are commonly shared across NFS mounts by id rather than name. +# See https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/ +# We can not use the sysusers_create_compat macro here as we want to keep the +# specfile standalone and not relying on additionnal files. +getent group 'kvm' >/dev/null || groupadd -f -g '36' -r 'kvm' || : +getent group 'qemu' >/dev/null || groupadd -f -g '107' -r 'qemu' || : +if ! getent passwd 'qemu' >/dev/null; then + if ! getent passwd '107' >/dev/null; then + useradd -r -u '107' -g 'qemu' -G 'kvm' -d '/' -s '/sbin/nologin' -c 'qemu user' 'qemu' || : else - useradd -r -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu + useradd -r -g 'qemu' -G 'kvm' -d '/' -s '/sbin/nologin' -c 'qemu user' 'qemu' || : fi fi exit 0 @@ -1765,9 +1887,9 @@ exit 0 %preun daemon-driver-qemu %libvirt_systemd_unix_preun virtqemud -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %pre daemon-driver-lxc %libvirt_sysconfig_pre virtlxcd %libvirt_systemd_unix_pre virtlxcd @@ -1778,9 +1900,9 @@ exit 0 %preun daemon-driver-lxc %libvirt_systemd_unix_preun virtlxcd -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %pre daemon-driver-vbox %libvirt_sysconfig_pre virtvboxd %libvirt_systemd_unix_pre virtvboxd @@ -1791,9 +1913,9 @@ exit 0 %preun daemon-driver-vbox %libvirt_systemd_unix_preun virtvboxd -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %pre daemon-driver-libxl %libvirt_sysconfig_pre virtxend %libvirt_systemd_unix_pre virtxend @@ -1804,7 +1926,7 @@ exit 0 %preun daemon-driver-libxl %libvirt_systemd_unix_preun virtxend -%endif + %endif %pre daemon-config-network %libvirt_systemd_config_pre libvirtd @@ -1869,12 +1991,14 @@ done %libvirt_systemd_config_posttrans libvirtd %libvirt_systemd_config_posttrans virtnwfilterd -%if %{with_lxc} + %if %{with_lxc} %pre login-shell getent group virtlogin >/dev/null || groupadd -r virtlogin exit 0 + %endif %endif +%if %{with_native} %files %files docs @@ -1935,9 +2059,9 @@ exit 0 %{_datadir}/augeas/lenses/virtlockd.aug %{_datadir}/augeas/lenses/tests/test_virtlockd.aug %{_datadir}/augeas/lenses/libvirt_lockd.aug -%if %{with_qemu} + %if %{with_qemu} %{_datadir}/augeas/lenses/tests/test_libvirt_lockd.aug -%endif + %endif %attr(0755, root, root) %{_sbindir}/virtlockd %{_mandir}/man8/virtlockd.8* @@ -2010,13 +2134,13 @@ exit 0 %attr(0755, root, root) %{_libexecdir}/libvirt_leaseshelper %{_libdir}/libvirt/connection-driver/libvirt_driver_network.so %{_mandir}/man8/virtnetworkd.8* -%if %{with_firewalld_zone} + %if %{with_firewalld_zone} %{_prefix}/lib/firewalld/zones/libvirt.xml %{_prefix}/lib/firewalld/zones/libvirt-routed.xml %{_prefix}/lib/firewalld/policies/libvirt-routed-in.xml %{_prefix}/lib/firewalld/policies/libvirt-routed-out.xml %{_prefix}/lib/firewalld/policies/libvirt-to-host.xml -%endif + %endif %files daemon-driver-nodedev %config(noreplace) %{_sysconfdir}/libvirt/virtnodedevd.conf @@ -2093,34 +2217,36 @@ exit 0 %files daemon-driver-storage-iscsi %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_iscsi.so -%if %{with_storage_iscsi_direct} + %if %{with_storage_iscsi_direct} %files daemon-driver-storage-iscsi-direct %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_iscsi-direct.so -%endif + %endif %files daemon-driver-storage-mpath %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_mpath.so -%if %{with_storage_gluster} + %if %{with_storage_gluster} %files daemon-driver-storage-gluster %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_gluster.so %{_libdir}/libvirt/storage-file/libvirt_storage_file_gluster.so -%endif + %endif -%if %{with_storage_rbd} + %if %{with_storage_rbd} %files daemon-driver-storage-rbd %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_rbd.so -%endif + %endif -%if %{with_storage_zfs} + %if %{with_storage_zfs} %files daemon-driver-storage-zfs %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_zfs.so -%endif + %endif -%if %{with_qemu} + %if %{with_qemu} %files daemon-driver-qemu %config(noreplace) %{_sysconfdir}/libvirt/virtqemud.conf + %if %{with_userfaultfd_sysctl} %config(noreplace) %{_prefix}/lib/sysctl.d/60-qemu-postcopy-migration.conf + %endif %{_datadir}/augeas/lenses/virtqemud.aug %{_datadir}/augeas/lenses/tests/test_virtqemud.aug %{_unitdir}/virtqemud.service @@ -2155,9 +2281,10 @@ exit 0 %{_bindir}/virt-qemu-run %{_mandir}/man1/virt-qemu-run.1* %{_mandir}/man8/virtqemud.8* -%endif +%{_sysusersdir}/libvirt-qemu.conf + %endif -%if %{with_lxc} + %if %{with_lxc} %files daemon-driver-lxc %config(noreplace) %{_sysconfdir}/libvirt/virtlxcd.conf %{_datadir}/augeas/lenses/virtlxcd.aug @@ -2179,9 +2306,9 @@ exit 0 %attr(0755, root, root) %{_libexecdir}/libvirt_lxc %{_libdir}/libvirt/connection-driver/libvirt_driver_lxc.so %{_mandir}/man8/virtlxcd.8* -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %files daemon-driver-libxl %config(noreplace) %{_sysconfdir}/libvirt/virtxend.conf %{_datadir}/augeas/lenses/virtxend.aug @@ -2207,9 +2334,9 @@ exit 0 %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/save/ %{_libdir}/libvirt/connection-driver/libvirt_driver_libxl.so %{_mandir}/man8/virtxend.8* -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %files daemon-driver-vbox %config(noreplace) %{_sysconfdir}/libvirt/virtvboxd.conf %{_datadir}/augeas/lenses/virtvboxd.aug @@ -2221,36 +2348,36 @@ exit 0 %attr(0755, root, root) %{_sbindir}/virtvboxd %{_libdir}/libvirt/connection-driver/libvirt_driver_vbox.so %{_mandir}/man8/virtvboxd.8* -%endif + %endif -%if %{with_qemu_tcg} + %if %{with_qemu_tcg} %files daemon-qemu -%endif + %endif -%if %{with_qemu_kvm} + %if %{with_qemu_kvm} %files daemon-kvm -%endif + %endif -%if %{with_lxc} + %if %{with_lxc} %files daemon-lxc -%endif + %endif -%if %{with_libxl} + %if %{with_libxl} %files daemon-xen -%endif + %endif -%if %{with_vbox} + %if %{with_vbox} %files daemon-vbox -%endif + %endif -%if %{with_sanlock} + %if %{with_sanlock} %files daemon-plugin-sanlock - %if %{with_qemu} + %if %{with_qemu} %config(noreplace) %{_sysconfdir}/libvirt/qemu-sanlock.conf - %endif - %if %{with_libxl} + %endif + %if %{with_libxl} %config(noreplace) %{_sysconfdir}/libvirt/libxl-sanlock.conf - %endif + %endif %dir %attr(0755, root, root) %{_libdir}/libvirt/lock-driver/ %attr(0755, root, root) %{_libdir}/libvirt/lock-driver/sanlock.so %{_datadir}/augeas/lenses/libvirt_sanlock.aug @@ -2259,7 +2386,7 @@ exit 0 %{_sbindir}/virt-sanlock-cleanup %{_mandir}/man8/virt-sanlock-cleanup.8* %attr(0755, root, root) %{_libexecdir}/libvirt_sanlock_helper -%endif + %endif %files client %{_mandir}/man1/virsh.1* @@ -2273,13 +2400,13 @@ exit 0 %{_bindir}/virt-pki-validate %{_datadir}/bash-completion/completions/virsh -%if %{with_qemu} + %if %{with_qemu} %files client-qemu %{_mandir}/man1/virt-qemu-qmp-proxy.1* %{_mandir}/man1/virt-qemu-sev-validate.1* %{_bindir}/virt-qemu-qmp-proxy %{_bindir}/virt-qemu-sev-validate -%endif + %endif %files libs -f %{name}.lang %license COPYING COPYING.LESSER @@ -2294,29 +2421,29 @@ exit 0 %dir %{_datadir}/libvirt/schemas/ %{_datadir}/systemtap/tapset/libvirt_probes*.stp %{_datadir}/systemtap/tapset/libvirt_functions.stp -%if %{with_qemu} + %if %{with_qemu} %{_datadir}/systemtap/tapset/libvirt_qemu_probes*.stp -%endif + %endif %{_datadir}/libvirt/schemas/*.rng %{_datadir}/libvirt/cpu_map/*.xml %{_datadir}/libvirt/test-screenshot.png -%if %{with_wireshark} + %if %{with_wireshark} %files wireshark %{wireshark_plugindir}/libvirt.so -%endif + %endif %files nss %{_libdir}/libnss_libvirt.so.2 %{_libdir}/libnss_libvirt_guest.so.2 -%if %{with_lxc} + %if %{with_lxc} %files login-shell %attr(4750, root, virtlogin) %{_bindir}/virt-login-shell %{_libexecdir}/virt-login-shell-helper %config(noreplace) %{_sysconfdir}/libvirt/virt-login-shell.conf %{_mandir}/man1/virt-login-shell.1* -%endif + %endif %files devel %{_libdir}/libvirt.so @@ -2351,8 +2478,9 @@ exit 0 %{_datadir}/libvirt/api/libvirt-admin-api.xml %{_datadir}/libvirt/api/libvirt-qemu-api.xml %{_datadir}/libvirt/api/libvirt-lxc-api.xml +%endif -%if %{with_mingw} +%if %{with_mingw32} %files -n mingw32-libvirt -f mingw32-libvirt.lang %dir %{mingw32_sysconfdir}/libvirt/ %config(noreplace) %{mingw32_sysconfdir}/libvirt/libvirt.conf @@ -2409,7 +2537,9 @@ exit 0 %{mingw32_mandir}/man1/virt-pki-query-dn.1* %{mingw32_mandir}/man1/virt-pki-validate.1* %{mingw32_mandir}/man7/virkey*.7* +%endif +%if %{with_mingw64} %files -n mingw64-libvirt -f mingw64-libvirt.lang %dir %{mingw64_sysconfdir}/libvirt/ %config(noreplace) %{mingw64_sysconfdir}/libvirt/libvirt.conf @@ -2470,6 +2600,49 @@ exit 0 %changelog +* Wed Mar 27 2024 Roberto Campesato - 10.1.0-1.1 +- Update to version 10.1.0 +- Relax dependency on qemu-kvm for facebook builds + +* Fri Mar 01 2024 Cole Robinson - 10.1.0-1 +- Update to version 10.1.0 + +* Mon Feb 19 2024 Cole Robinson - 10.0.0-4 +- Rebuild for wireshark soname bump + +* Thu Jan 25 2024 Fedora Release Engineering - 10.0.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 10.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Tue Jan 16 2024 Cole Robinson - 10.0.0-1 +- Update to version 10.0.0 + +* Wed Jan 03 2024 Jonathan Wright - 9.10.0-4 +- conf: fix regression for default input bus + +* Fri Dec 8 2023 Richard W.M. Jones - 9.10.0-3 +- Bump and rebuild for xen 4.18.0, third attempt + +* Tue Dec 05 2023 Adam Williamson - 9.10.0-2 +- Rebuild for xen 4.18.0 again + +* Sat Dec 02 2023 Cole Robinson - 9.10.0-1 +- Update to version 9.10.0 + +* Thu Nov 30 2023 Richard W.M. Jones - 9.9.0-3 +- Bump and rebuild for xen 4.18.0 + +* Mon Nov 06 2023 Cole Robinson - 9.9.0-2 +- Fix crash with snapshot restore (bz #2247754) + +* Wed Nov 01 2023 Cole Robinson - 9.9.0-1 +- Update to version 9.9.0 + +* Thu Oct 05 2023 Cole Robinson - 9.8.0-1 +- Update to version 9.8.0 + * Fri Sep 1 2023 Daniel P. Berrangé - 9.7.0-1 - Update to version 9.7.0 diff --git a/sources b/sources index 502c1a1..fa67790 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libvirt-9.7.0.tar.xz) = dd771822c0fa0861a32cab9d7f82235b101867fa0a4e8cf9a857ddfb2347e41b625b1e6f8791c4b3543fec836a1a23cae1fac4ce4b40debd51f2097bae46c949 +SHA512 (libvirt-10.1.0.tar.xz) = 08e73ae15de5681430b62db85ec9901242dca5e9a4ca9685614f4a67092c6e28f27f9187144b3ceb18ad6b40e6eb1a90b1a4b056b0888724d04a62002ee2bc48