From 6ecda8419be3c2fc81d9a14f430e032e1d01db89 Mon Sep 17 00:00:00 2001 From: yezengruan Date: Fri, 25 Nov 2022 19:41:00 +0800 Subject: [PATCH] sync some bugfix patches from upstream Signed-off-by: yezengruan (cherry picked from commit bab57abd85ef9c38dfa731bb6ae1cdfe9a9b63f4) --- Fix-allocation-of-virDomainFSDef.patch | 53 +++++++++++++ ...ompletion-fix-variable-leaks-of-word.patch | 31 ++++++++ checkpoint-Fix-a-typo-of-comments.patch | 34 +++++++++ libvirt.spec | 28 ++++++- ...crash-when-reattaching-mdevs-on-assi.patch | 51 +++++++++++++ node_device_udev.h-Drop-unused-macro.patch | 31 ++++++++ ...it-a-bit-longer-for-new-node-devices.patch | 45 +++++++++++ ...entation-for-qemuDomainNVRAMPathForm.patch | 51 +++++++++++++ ...ion-specifier-in-qemuBuildVsockDevPr.patch | 36 +++++++++ ...omain-start-with-corrupted-save-file.patch | 70 +++++++++++++++++ ...emleak-in-qemuDomainAttachDeviceLive.patch | 34 +++++++++ ...ring-specifier-argument-in-qemuDomai.patch | 56 ++++++++++++++ ...nSrcWaitForSpice-Remove-return-value.patch | 52 +++++++++++++ ...indentation-in-qemuDomainGetStatsVcp.patch | 32 ++++++++ util-Drop-pointless-NUL_TERMINATE-macro.patch | 30 ++++++++ util-fix-syslog-facility-value.patch | 58 ++++++++++++++ ...facility-when-opening-syslog-channel.patch | 38 ++++++++++ ...intCreateXML-Don-t-use-HTML-in-funct.patch | 36 +++++++++ ...null-string-specifier-argument-in-vi.patch | 51 +++++++++++++ ...ices-fix-counting-entries-in-BPF-map.patch | 40 ++++++++++ virsh-Fix-typo-of-metadata.patch | 30 ++++++++ ...emove-error-prefix-for-an-empty-line.patch | 76 +++++++++++++++++++ ...workName-for-bridged-and-custom-NICs.patch | 37 +++++++++ vshtabletest-Fix-potential-memleak.patch | 45 +++++++++++ 24 files changed, 1044 insertions(+), 1 deletion(-) create mode 100644 Fix-allocation-of-virDomainFSDef.patch create mode 100644 bash-completion-fix-variable-leaks-of-word.patch create mode 100644 checkpoint-Fix-a-typo-of-comments.patch create mode 100644 mdev-Fix-daemon-crash-when-reattaching-mdevs-on-assi.patch create mode 100644 node_device_udev.h-Drop-unused-macro.patch create mode 100644 nodedev-wait-a-bit-longer-for-new-node-devices.patch create mode 100644 qemu-fix-bad-indentation-for-qemuDomainNVRAMPathForm.patch create mode 100644 qemu-fix-conversion-specifier-in-qemuBuildVsockDevPr.patch create mode 100644 qemu-fix-domain-start-with-corrupted-save-file.patch create mode 100644 qemu-fix-memleak-in-qemuDomainAttachDeviceLive.patch create mode 100644 qemu-fix-null-string-specifier-argument-in-qemuDomai.patch create mode 100644 qemuMigrationSrcWaitForSpice-Remove-return-value.patch create mode 100644 qemu_driver-Fix-indentation-in-qemuDomainGetStatsVcp.patch create mode 100644 util-Drop-pointless-NUL_TERMINATE-macro.patch create mode 100644 util-fix-syslog-facility-value.patch create mode 100644 util-set-facility-when-opening-syslog-channel.patch create mode 100644 virDomainCheckpointCreateXML-Don-t-use-HTML-in-funct.patch create mode 100644 vircgroupv1-fix-null-string-specifier-argument-in-vi.patch create mode 100644 vircgroupv2devices-fix-counting-entries-in-BPF-map.patch create mode 100644 virsh-Fix-typo-of-metadata.patch create mode 100644 virsh-cmdBlock-Remove-error-prefix-for-an-empty-line.patch create mode 100644 vmx-Require-networkName-for-bridged-and-custom-NICs.patch create mode 100644 vshtabletest-Fix-potential-memleak.patch diff --git a/Fix-allocation-of-virDomainFSDef.patch b/Fix-allocation-of-virDomainFSDef.patch new file mode 100644 index 0000000..fb55fd5 --- /dev/null +++ b/Fix-allocation-of-virDomainFSDef.patch @@ -0,0 +1,53 @@ +From 805efc1e0446e84c4b9bf9984c92b9e05b6ced62 Mon Sep 17 00:00:00 2001 +From: tangbin +Date: Wed, 23 Nov 2022 16:00:29 +0200 +Subject: [PATCH 09/23] Fix allocation of virDomainFSDef +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some less commonly used drivers were omitted when we switched +the allocator from a plain VIR_ALLOC to virDomainFSDefNew. + +https://bugzilla.redhat.com/show_bug.cgi?id=1846450 + +Fixes: da665fbd4858890fbb3bbf5da2a7b6ca37bb3220 +Signed-off-by: Ján Tomko +Reviewed-by: Andrea Bolognani + +Signed-off-by: tangbin +(cherry-pick from ea3320048897f5279bc49cb49d26f8099706a834) +--- + src/openvz/openvz_conf.c | 2 +- + src/vbox/vbox_common.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c +index 78547b8b28..15e1e2ae9f 100644 +--- a/src/openvz/openvz_conf.c ++++ b/src/openvz/openvz_conf.c +@@ -357,7 +357,7 @@ openvzReadFSConf(virDomainDefPtr def, + goto error; + } + +- if (VIR_ALLOC(fs) < 0) ++ if (!(fs = virDomainFSDefNew(NULL))) + goto error; + + veid_str = g_strdup_printf("%d", veid); +diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c +index e98ae04ec0..d06a5f79ab 100644 +--- a/src/vbox/vbox_common.c ++++ b/src/vbox/vbox_common.c +@@ -3620,7 +3620,7 @@ vboxDumpSharedFolders(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine + char *hostPath = NULL; + PRBool writable = PR_FALSE; + +- if (VIR_ALLOC(def->fss[i]) < 0) ++ if (!(def->fss[i] = virDomainFSDefNew(data->xmlopt))) + goto cleanup; + + def->fss[i]->type = VIR_DOMAIN_FS_TYPE_MOUNT; +-- +2.27.0 + diff --git a/bash-completion-fix-variable-leaks-of-word.patch b/bash-completion-fix-variable-leaks-of-word.patch new file mode 100644 index 0000000..07ec5d3 --- /dev/null +++ b/bash-completion-fix-variable-leaks-of-word.patch @@ -0,0 +1,31 @@ +From 4bdf8aeb2e907b53cc71c07b3c6be8f82e3f1e4a Mon Sep 17 00:00:00 2001 +From: Xu Zheng +Date: Thu, 24 Nov 2022 17:58:28 +0800 +Subject: [PATCH 20/23] bash-completion: fix variable leaks of "word" + +cherry-pick from 097296c30b72f472bcf4e72cf8ab2aeb55903c49 + +Signed-off-by: Koichi Murase +Signed-off-by: Michal Privoznik +Reviewed-by: Michal Privoznik +Signed-off-by: Xu Zheng +--- + tools/bash-completion/vsh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/bash-completion/vsh b/tools/bash-completion/vsh +index 8493cad28b..363097c601 100644 +--- a/tools/bash-completion/vsh ++++ b/tools/bash-completion/vsh +@@ -21,7 +21,7 @@ _vsh_complete() + # See what URI is user trying to connect to and if they are + # connecting RO. Honour that. + while [ $c -le $COMP_CWORD ]; do +- word="${COMP_WORDS[c]}" ++ local word="${COMP_WORDS[c]}" + case "$word" in + -r|--readonly) RO=1 ;; + -c|--connect) c=$((++c)); URI=${COMP_WORDS[c]} ;; +-- +2.27.0 + diff --git a/checkpoint-Fix-a-typo-of-comments.patch b/checkpoint-Fix-a-typo-of-comments.patch new file mode 100644 index 0000000..31e7b36 --- /dev/null +++ b/checkpoint-Fix-a-typo-of-comments.patch @@ -0,0 +1,34 @@ +From 5d84740e04d99a8503f20b2281f3fd70fa1f69ab Mon Sep 17 00:00:00 2001 +From: jipengfei +Date: Thu, 24 Nov 2022 16:43:51 +0800 +Subject: [PATCH 16/23] checkpoint: Fix a typo of comments +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +cherry-pick from 75134a3a7d1ca6976dfc2af7cd53461cb0aee529 + +Signed-off-by: Han Han +Signed-off-by: jipengfei +Reviewed-by: Ján Tomko +Signed-off-by: Ján Tomko +--- + src/libvirt-domain-checkpoint.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libvirt-domain-checkpoint.c b/src/libvirt-domain-checkpoint.c +index 432c2d5a52..58668c391c 100644 +--- a/src/libvirt-domain-checkpoint.c ++++ b/src/libvirt-domain-checkpoint.c +@@ -236,7 +236,7 @@ virDomainCheckpointGetXMLDesc(virDomainCheckpointPtr checkpoint, + * @checkpoints: pointer to variable to store the array containing checkpoint + * object, or NULL if the list is not required (just returns + * number of checkpoints) +- * @flags: bitwise-OR of supported virDomainCheckpoinListFlags ++ * @flags: bitwise-OR of supported virDomainCheckpointListFlags + * + * Collect the list of domain checkpoints for the given domain and allocate + * an array to store those objects. +-- +2.27.0 + diff --git a/libvirt.spec b/libvirt.spec index eac8898..9a3bc99 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -101,7 +101,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.2.0 -Release: 45 +Release: 46 License: LGPLv2+ URL: https://libvirt.org/ @@ -368,6 +368,29 @@ Patch0255: migration-dirtyrate-Implement-qemuMonitorQueryDirtyR.patch Patch0256: migration-dirtyrate-Extend-dirtyrate-statistics-for-.patch Patch0257: migration-dirtyrate-Introduce-command-virsh-domstats.patch Patch0258: docs-Fix-template-matching-in-page.xsl.patch +Patch0259: vircgroupv1-fix-null-string-specifier-argument-in-vi.patch +Patch0260: qemu-fix-null-string-specifier-argument-in-qemuDomai.patch +Patch0261: qemu-fix-domain-start-with-corrupted-save-file.patch +Patch0262: qemu-fix-bad-indentation-for-qemuDomainNVRAMPathForm.patch +Patch0263: util-fix-syslog-facility-value.patch +Patch0264: util-set-facility-when-opening-syslog-channel.patch +Patch0265: qemu-fix-memleak-in-qemuDomainAttachDeviceLive.patch +Patch0266: mdev-Fix-daemon-crash-when-reattaching-mdevs-on-assi.patch +Patch0267: Fix-allocation-of-virDomainFSDef.patch +Patch0268: virsh-Fix-typo-of-metadata.patch +Patch0269: virsh-cmdBlock-Remove-error-prefix-for-an-empty-line.patch +Patch0270: vshtabletest-Fix-potential-memleak.patch +Patch0271: vircgroupv2devices-fix-counting-entries-in-BPF-map.patch +Patch0272: node_device_udev.h-Drop-unused-macro.patch +Patch0273: qemu-fix-conversion-specifier-in-qemuBuildVsockDevPr.patch +Patch0274: checkpoint-Fix-a-typo-of-comments.patch +Patch0275: qemu_driver-Fix-indentation-in-qemuDomainGetStatsVcp.patch +Patch0276: vmx-Require-networkName-for-bridged-and-custom-NICs.patch +Patch0277: nodedev-wait-a-bit-longer-for-new-node-devices.patch +Patch0278: bash-completion-fix-variable-leaks-of-word.patch +Patch0279: util-Drop-pointless-NUL_TERMINATE-macro.patch +Patch0280: virDomainCheckpointCreateXML-Don-t-use-HTML-in-funct.patch +Patch0281: qemuMigrationSrcWaitForSpice-Remove-return-value.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2102,6 +2125,9 @@ exit 0 %changelog +* Fri Nov 25 2022 yezengruan - 6.2.0-46 +- sync some bugfix patches from upstream + * Fri Nov 11 2022 yezengruan - 6.2.0-45 - docs: Fix template matching in page.xsl diff --git a/mdev-Fix-daemon-crash-when-reattaching-mdevs-on-assi.patch b/mdev-Fix-daemon-crash-when-reattaching-mdevs-on-assi.patch new file mode 100644 index 0000000..f248437 --- /dev/null +++ b/mdev-Fix-daemon-crash-when-reattaching-mdevs-on-assi.patch @@ -0,0 +1,51 @@ +From 69ea920668827c16ab27016d67a8e58e25f2aa55 Mon Sep 17 00:00:00 2001 +From: tangbinzy +Date: Wed, 23 Nov 2022 10:03:38 +0000 +Subject: [PATCH 08/23] mdev: Fix daemon crash when reattaching mdevs on + assignment conflict If there's a list of mdevs to be assigned to a domain, + but one of them (NOT the first) is already assigned to a different domain + we're going to crash in the qemuProcessStop phase in + virMediatedDeviceListFindIndex, because some of the pointers in + mgr->activeMediatedHostdevs are dangling. This is due to + virMediatedDeviceListMarkDevices using cleanup instead of rollback when we + find out that a device is already taken. + +Reproducer steps: +1. start vm1 with mdev1 +2. start vm2 with mdev2, mdev1 (the order is important!) + +Backtrace: + #0 0x0000ffffb8c36250 in strcmp + #1 0x0000ffffb9b80754 in virMediatedDeviceListFindIndex + #2 0x0000ffffb9b80870 in virMediatedDeviceListFind + #3 0x0000ffffb9c9e168 in virHostdevReAttachMediatedDevices + #4 0x0000ffff9949f724 in qemuHostdevReAttachMediatedDevices + #5 0x0000ffff9949f7f8 in qemuHostdevReAttachDomainDevices + #6 0x0000ffff994bcd70 in qemuProcessStop + #7 0x0000ffff994bf4e0 in qemuProcessStart + +Signed-off-by: Binfeng Wu +Reviewed-by: Erik Skultety + +Signed-off-by: tangbin +(cherry-pick from 8361d335ab77cb1f3b70a3fa92f7e2d0aaa31bac) +--- + src/util/virmdev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/util/virmdev.c b/src/util/virmdev.c +index bae4a7d2c1..a40d2f4fb5 100644 +--- a/src/util/virmdev.c ++++ b/src/util/virmdev.c +@@ -445,7 +445,7 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst, + + if (virMediatedDeviceIsUsed(mdev, dst) || + virMediatedDeviceSetUsedBy(mdev, drvname, domname) < 0) +- goto cleanup; ++ goto rollback; + + /* Copy mdev references to the driver list: + * - caller is responsible for NOT freeing devices in @src on success +-- +2.27.0 + diff --git a/node_device_udev.h-Drop-unused-macro.patch b/node_device_udev.h-Drop-unused-macro.patch new file mode 100644 index 0000000..de4a0bc --- /dev/null +++ b/node_device_udev.h-Drop-unused-macro.patch @@ -0,0 +1,31 @@ +From 4111ae4dcc2f9158a8e4e7a9a4787bcc39b3704b Mon Sep 17 00:00:00 2001 +From: Xu Zheng +Date: Thu, 24 Nov 2022 10:50:04 +0800 +Subject: [PATCH 14/23] node_device_udev.h: Drop unused macro + +The SYSFS_DATA_SIZE macro is Unused since its introduction in +v0.7.3~48. + +cherry-pick from 4a00efe9cb3b60c8729b4262440747db17356f32 + +Signed-off-by: Michal Privoznik +Signed-off-by: Xu Zheng +Reviewed-by: Jonathon Jongsma +--- + src/node_device/node_device_udev.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/node_device/node_device_udev.h b/src/node_device/node_device_udev.h +index 996677dfe0..6d796fb0dd 100644 +--- a/src/node_device/node_device_udev.h ++++ b/src/node_device/node_device_udev.h +@@ -22,6 +22,5 @@ + + #include + +-#define SYSFS_DATA_SIZE 4096 + #define DMI_DEVPATH "/sys/devices/virtual/dmi/id" + #define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id" +-- +2.27.0 + diff --git a/nodedev-wait-a-bit-longer-for-new-node-devices.patch b/nodedev-wait-a-bit-longer-for-new-node-devices.patch new file mode 100644 index 0000000..bf74dcc --- /dev/null +++ b/nodedev-wait-a-bit-longer-for-new-node-devices.patch @@ -0,0 +1,45 @@ +From 523320a7c4a457a90576c73539abf3b25466bb26 Mon Sep 17 00:00:00 2001 +From: jipengfei +Date: Thu, 24 Nov 2022 17:42:21 +0800 +Subject: [PATCH 19/23] nodedev: wait a bit longer for new node devices + +cherry-pick from e4f9682ebc442bb5dfee807ba618c8863355776d + +Openstack developers reported that newly-created mdevs were not +recognized by libvirt until after a libvirt daemon restart. The source +of the problem appears to be that when libvirt gets the udev 'add' +event, the sysfs tree for that device might not be ready and so libvirt +waits 100ms for it to appear (max 100 waits of 1ms each). But in the +OpenStack environment, the sysfs tree for new mediated devices was +taking closer to 250ms to appear and therefore libvirt gave up waiting +and didn't add these new devices to its list of nodedevs. + +By changing the wait time to 1 second (max 100 waits of 10ms each), this +should provide enough time to enable these deployments to recognize +newly-created mediated devices, but it shouldn't increase the delay for +more traditional deployments too much. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2109450 + +Signed-off-by: Jonathon Jongsma +Reviewed-by: Erik Skultety +--- + src/node_device/node_device_udev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c +index 94e8469dcb..a674380f19 100644 +--- a/src/node_device/node_device_udev.c ++++ b/src/node_device/node_device_udev.c +@@ -1030,7 +1030,7 @@ udevProcessMediatedDevice(struct udev_device *dev, + + linkpath = g_strdup_printf("%s/mdev_type", udev_device_get_syspath(dev)); + +- if (virFileWaitForExists(linkpath, 1, 100) < 0) { ++ if (virFileWaitForExists(linkpath, 10, 100) < 0) { + virReportSystemError(errno, + _("failed to wait for file '%s' to appear"), + linkpath); +-- +2.27.0 + diff --git a/qemu-fix-bad-indentation-for-qemuDomainNVRAMPathForm.patch b/qemu-fix-bad-indentation-for-qemuDomainNVRAMPathForm.patch new file mode 100644 index 0000000..a8f22d4 --- /dev/null +++ b/qemu-fix-bad-indentation-for-qemuDomainNVRAMPathForm.patch @@ -0,0 +1,51 @@ +From 0d04ea0e49ea1632a8991d24d03f044993047eaf Mon Sep 17 00:00:00 2001 +From: wangmeiyang +Date: Wed, 23 Nov 2022 17:08:11 +0800 +Subject: [PATCH 04/23] qemu: fix bad indentation for qemuDomainNVRAMPathFormat +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +cherry-pick from 7dd53b125a880e3d67403ac345589c37dd137f08 + +Signed-off-by: Daniel P. Berrangé +Signed-off-by: Meiyang Wang +Reviewed-by: Michal Privoznik +--- + src/qemu/qemu_domain.c | 4 ++-- + src/qemu/qemu_domain.h | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 834af89a1e..c315717c8a 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -16994,8 +16994,8 @@ qemuDomainDiskIsMissingLocalOptional(virDomainDiskDefPtr disk) + + void + qemuDomainNVRAMPathFormat(virQEMUDriverConfigPtr cfg, +- virDomainDefPtr def, +- char **path) ++ virDomainDefPtr def, ++ char **path) + { + *path = g_strdup_printf("%s/%s_VARS.fd", cfg->nvramDir, def->name); + } +diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h +index 678ddab624..164fb36f0c 100644 +--- a/src/qemu/qemu_domain.h ++++ b/src/qemu/qemu_domain.h +@@ -1260,8 +1260,8 @@ qemuDomainDiskIsMissingLocalOptional(virDomainDiskDefPtr disk); + + void + qemuDomainNVRAMPathFormat(virQEMUDriverConfigPtr cfg, +- virDomainDefPtr def, +- char **path); ++ virDomainDefPtr def, ++ char **path); + + void + qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg, +-- +2.27.0 + diff --git a/qemu-fix-conversion-specifier-in-qemuBuildVsockDevPr.patch b/qemu-fix-conversion-specifier-in-qemuBuildVsockDevPr.patch new file mode 100644 index 0000000..28cf111 --- /dev/null +++ b/qemu-fix-conversion-specifier-in-qemuBuildVsockDevPr.patch @@ -0,0 +1,36 @@ +From f80fccdd500f6d77bee4fe6e24cb61d3266f38da Mon Sep 17 00:00:00 2001 +From: Xu Zheng +Date: Thu, 24 Nov 2022 15:41:29 +0800 +Subject: [PATCH 15/23] qemu: fix conversion specifier in + qemuBuildVsockDevProps +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +vhostfd is a signed integer. + +cherry-pick from 045072ee3ad0643254c8cb55bd47c878ddbee084 + +Signed-off-by: Ján Tomko +Signed-off-by: Xu Zheng +Reviewed-by: Peter Krempa +--- + src/qemu/qemu_command.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 42f6e10b33..7bd24f042c 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -9882,7 +9882,7 @@ qemuBuildVsockDevStr(virDomainDefPtr def, + + virBufferAsprintf(&buf, ",id=%s", vsock->info.alias); + virBufferAsprintf(&buf, ",guest-cid=%u", vsock->guest_cid); +- virBufferAsprintf(&buf, ",vhostfd=%s%u", fdprefix, priv->vhostfd); ++ virBufferAsprintf(&buf, ",vhostfd=%s%d", fdprefix, priv->vhostfd); + if (qemuBuildDeviceAddressStr(&buf, def, &vsock->info, qemuCaps) < 0) + return NULL; + +-- +2.27.0 + diff --git a/qemu-fix-domain-start-with-corrupted-save-file.patch b/qemu-fix-domain-start-with-corrupted-save-file.patch new file mode 100644 index 0000000..b2354a0 --- /dev/null +++ b/qemu-fix-domain-start-with-corrupted-save-file.patch @@ -0,0 +1,70 @@ +From 8dcea1141c60ebc7c7a292b8112ca74a0ad56c46 Mon Sep 17 00:00:00 2001 +From: tangbin +Date: Wed, 23 Nov 2022 15:03:37 +0200 +Subject: [PATCH 03/23] qemu: fix domain start with corrupted save file +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 21ad56e932 introduced a regression where a VM with a corrupted +save image file would fail to start on the first attempt. This was +caused by returning a wrong return code as 'fd' was abused to also hold +the return code. + +Since it's easy to miss this nuance, introduce a 'ret' variable for the +return code and return it' value in the error section. + +https://bugzilla.redhat.com/show_bug.cgi?id=1791522 + +Signed-off-by: Peter Krempa +Reviewed-by: Ján Tomko +Reviewed-by: Pavel Mores + +Signed-off-by: tangbin +(cherry-pick from f76a57182046da59af5547a1c02094dc9d61ad88) +--- + src/qemu/qemu_driver.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index a3617b4d73..10ddbba325 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -6587,6 +6587,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, + bool unlink_corrupt) + { + int fd = -1; ++ int ret = -1; + virQEMUSaveDataPtr data = NULL; + virQEMUSaveHeaderPtr header; + virDomainDefPtr def = NULL; +@@ -6622,7 +6623,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, + _("cannot remove corrupt file: %s"), + path); + } else { +- fd = -3; ++ ret = -3; + } + } else { + virReportError(VIR_ERR_OPERATION_FAILED, +@@ -6643,7 +6644,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, + _("cannot remove corrupt file: %s"), + path); + } else { +- fd = -3; ++ ret = -3; + } + goto error; + } +@@ -6712,7 +6713,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, + virDomainDefFree(def); + virQEMUSaveDataFree(data); + VIR_FORCE_CLOSE(fd); +- return -1; ++ return ret; + } + + static int ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6) +-- +2.27.0 + diff --git a/qemu-fix-memleak-in-qemuDomainAttachDeviceLive.patch b/qemu-fix-memleak-in-qemuDomainAttachDeviceLive.patch new file mode 100644 index 0000000..a7bea08 --- /dev/null +++ b/qemu-fix-memleak-in-qemuDomainAttachDeviceLive.patch @@ -0,0 +1,34 @@ +From d1c3b60ebbfe0fad5372cf2940b366f00548a4fe Mon Sep 17 00:00:00 2001 +From: tangbinzy +Date: Wed, 23 Nov 2022 10:00:57 +0000 +Subject: [PATCH 07/23] qemu: fix memleak in qemuDomainAttachDeviceLive() + During disk hot plugging, qemuDomainAttachDeviceLive() adds the new disk to + the device list of the VM object. However, hot plugging cdroms and floppies + only updates the src variable of the original disk device, so the newly + generated disk object needs to be freed. + +Signed-off-by: Jin Yan +Signed-off-by: Michal Privoznik +Reviewed-by: Michal Privoznik + +Signed-off-by: tangbin +(cherry-pick from 2f470a4fb1edbe2da702e398314b9db201bb991e) +--- + src/qemu/qemu_hotplug.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c +index d7bcb6a99f..c9347bac04 100644 +--- a/src/qemu/qemu_hotplug.c ++++ b/src/qemu/qemu_hotplug.c +@@ -1115,6 +1115,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver, + return -1; + + disk->src = NULL; ++ virDomainDiskDefFree(disk); + return 0; + } + +-- +2.27.0 + diff --git a/qemu-fix-null-string-specifier-argument-in-qemuDomai.patch b/qemu-fix-null-string-specifier-argument-in-qemuDomai.patch new file mode 100644 index 0000000..5f1015d --- /dev/null +++ b/qemu-fix-null-string-specifier-argument-in-qemuDomai.patch @@ -0,0 +1,56 @@ +From be8bbeb7368db79f3a2e0502a772daf951089357 Mon Sep 17 00:00:00 2001 +From: wangmeiyang +Date: Wed, 23 Nov 2022 14:46:20 +0800 +Subject: [PATCH 02/23] qemu: fix null string specifier argument in + qemuDomainBlockJobAbort +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Detected by gcc 11 -Wformat-overflow: +../../src/qemu/qemu_driver.c: In function ‘qemuDomainBlockJobAbort’: +../../src/util/virerror.h:176:5: warning: ‘%s’ directive argument is null [-Wformat-overflow=] + 176 | virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 177 | __FUNCTION__, __LINE__, __VA_ARGS__) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../../src/qemu/qemu_driver.c:14475:17: note: in expansion of macro ‘virReportError’ +14475 | virReportError(VIR_ERR_OPERATION_FAILED, + | ^~~~~~~~~~~~~~ +../../src/qemu/qemu_driver.c:14476:73: note: format string is defined here +14476 | _("block job '%s' failed while pivoting: %s"), + | ^~ +cherry-pick from 8c6fa38efca52adabec48989fd6e4244a44859a5 + +Signed-off-by: Scott Davis +Signed-off-by: Meiyang Wang +Reviewed-by: Ján Tomko +--- + src/qemu/qemu_driver.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index a3617b4d73..167b74acfd 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -17590,13 +17590,13 @@ qemuDomainBlockJobAbort(virDomainPtr dom, + if (pivot && + job->state == QEMU_BLOCKJOB_STATE_FAILED) { + if (job->errmsg) { +- virReportError(VIR_ERR_OPERATION_FAILED, +- _("block job '%s' failed while pivoting"), +- job->name); +- } else { + virReportError(VIR_ERR_OPERATION_FAILED, + _("block job '%s' failed while pivoting: %s"), + job->name, job->errmsg); ++ } else { ++ virReportError(VIR_ERR_OPERATION_FAILED, ++ _("block job '%s' failed while pivoting"), ++ job->name); + } + + ret = -1; +-- +2.27.0 + diff --git a/qemuMigrationSrcWaitForSpice-Remove-return-value.patch b/qemuMigrationSrcWaitForSpice-Remove-return-value.patch new file mode 100644 index 0000000..3c69c95 --- /dev/null +++ b/qemuMigrationSrcWaitForSpice-Remove-return-value.patch @@ -0,0 +1,52 @@ +From bd8b565057cacc69a0c0c4b2463ffab6c0cf395e Mon Sep 17 00:00:00 2001 +From: jipengfei +Date: Fri, 25 Nov 2022 02:19:55 +0800 +Subject: [PATCH 23/23] qemuMigrationSrcWaitForSpice: Remove return value +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +cherry-pick from b76c58081c69a8775dd46b014611b28f6ed2a1b2 + +The only caller doesn't check the return value and actually doesn't have +one either. Remove the return value and adjust return statements. + +Signed-off-by: Peter Krempa +Signed-off-by: jipengfei +Reviewed-by: Erik Skultety +Reviewed-by: Ján Tomko +--- + src/qemu/qemu_migration.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index d86325881e..1c48138ce3 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -1426,20 +1426,19 @@ qemuMigrationAnyPostcopyFailed(virQEMUDriverPtr driver, + } + + +-static int ++static void + qemuMigrationSrcWaitForSpice(virDomainObjPtr vm) + { + qemuDomainObjPrivatePtr priv = vm->privateData; + + if (!priv->job.spiceMigration) +- return 0; ++ return; + + VIR_DEBUG("Waiting for SPICE to finish migration"); + while (!priv->job.spiceMigrated && !priv->job.abortJob) { + if (virDomainObjWait(vm) < 0) +- return -1; ++ return; + } +- return 0; + } + + +-- +2.27.0 + diff --git a/qemu_driver-Fix-indentation-in-qemuDomainGetStatsVcp.patch b/qemu_driver-Fix-indentation-in-qemuDomainGetStatsVcp.patch new file mode 100644 index 0000000..ca9cd38 --- /dev/null +++ b/qemu_driver-Fix-indentation-in-qemuDomainGetStatsVcp.patch @@ -0,0 +1,32 @@ +From 97fce13e1086431f9f16c976706ee30daf297d51 Mon Sep 17 00:00:00 2001 +From: Xu Zheng +Date: Thu, 24 Nov 2022 17:22:37 +0800 +Subject: [PATCH 17/23] qemu_driver: Fix indentation in qemuDomainGetStatsVcpu + +cherry-pick from d057b0bfc48e31f5c4d27830d2f91ed4f1d7180c +Signed-off-by: Martin Kletzander +Signed-off-by: Xu Zheng +--- + src/qemu/qemu_driver.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 1f70178c88..854b56a563 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -21043,9 +21043,9 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver, + + if (HAVE_JOB(privflags) && virDomainObjIsActive(dom) && + qemuDomainRefreshVcpuHalted(driver, dom, QEMU_ASYNC_JOB_NONE) < 0) { +- /* it's ok to be silent and go ahead, because halted vcpu info +- * wasn't here from the beginning */ +- virResetLastError(); ++ /* it's ok to be silent and go ahead, because halted vcpu info ++ * wasn't here from the beginning */ ++ virResetLastError(); + } + + if (qemuDomainHelperGetVcpus(dom, cpuinfo, cpuwait, +-- +2.27.0 + diff --git a/util-Drop-pointless-NUL_TERMINATE-macro.patch b/util-Drop-pointless-NUL_TERMINATE-macro.patch new file mode 100644 index 0000000..766ecf3 --- /dev/null +++ b/util-Drop-pointless-NUL_TERMINATE-macro.patch @@ -0,0 +1,30 @@ +From 28781bb30db71760da3c88a5c34903ee1387d20b Mon Sep 17 00:00:00 2001 +From: Xu Zheng +Date: Thu, 24 Nov 2022 18:12:49 +0800 +Subject: [PATCH 21/23] util: Drop pointless NUL_TERMINATE macro + +It's only used once and open coding it is at least as clear as using the +macro. + +Signed-off-by: Jiri Denemark +Reviewed-by: Peter Krempa +Signed-off-by: Xu Zheng +--- + src/internal.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/internal.h b/src/internal.h +index a1068eb63b..302fddba34 100644 +--- a/src/internal.h ++++ b/src/internal.h +@@ -87,7 +87,6 @@ + #define STREQ_NULLABLE(a, b) (g_strcmp0(a, b) == 0) + #define STRNEQ_NULLABLE(a, b) (g_strcmp0(a, b) != 0) + +-#define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0) + + #ifdef WIN32 + # ifndef O_CLOEXEC +-- +2.27.0 + diff --git a/util-fix-syslog-facility-value.patch b/util-fix-syslog-facility-value.patch new file mode 100644 index 0000000..1283d3c --- /dev/null +++ b/util-fix-syslog-facility-value.patch @@ -0,0 +1,58 @@ +From aaff56af24b3931e08b28a994a4953c1a0d1851b Mon Sep 17 00:00:00 2001 +From: wangmeiyang +Date: Wed, 23 Nov 2022 17:16:24 +0800 +Subject: [PATCH 05/23] util: fix syslog facility value +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We set SYSLOG_PRIORITY when sending to journald to avoid our +messages getting tagged with the default facility which is +used for the kernel. + +Unfortunately: + + commit fd00f0e6c75b00c3d97be8670afcd9094b823855 + Author: Guido Günther + Date: Mon Sep 21 20:06:55 2015 +0200 + + Use daemon log facility for journald + +used the LOG_nnn constants from the syslog header without realizing +that these values have a bit-shift applied. While Linux defines a +LOG_FAC() macros to undo the bit-shift this doesn't appear to be +standardized. So the safe thing is to just use the raw value since +these values are fixed by RFC 5424. + +cherry-pick from 017fa1e097769455c0cd8929760cf9ff52a556ec + +Signed-off-by: Daniel P. Berrangé +Signed-off-by: Meiyang Wang +Reviewed-by: Ján Tomko +--- + src/util/virlog.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/util/virlog.c b/src/util/virlog.c +index e4944d1258..07d4eb4123 100644 +--- a/src/util/virlog.c ++++ b/src/util/virlog.c +@@ -932,7 +932,14 @@ virLogOutputToJournald(virLogSourcePtr source, + journalAddString(&state, "MESSAGE", rawstr); + journalAddInt(&state, "PRIORITY", + virLogPrioritySyslog(priority)); +- journalAddInt(&state, "SYSLOG_FACILITY", LOG_DAEMON); ++ /* See RFC 5424 section 6.2.1 ++ * ++ * Don't use LOG_nnn constants as those have a bit-shift ++ * applied for use with syslog() API, while journald ++ * needs the raw value ++ */ ++ journalAddInt(&state, "SYSLOG_FACILITY", 3); ++ + journalAddString(&state, "LIBVIRT_SOURCE", source->name); + if (filename) + journalAddString(&state, "CODE_FILE", filename); +-- +2.27.0 + diff --git a/util-set-facility-when-opening-syslog-channel.patch b/util-set-facility-when-opening-syslog-channel.patch new file mode 100644 index 0000000..21e5a8b --- /dev/null +++ b/util-set-facility-when-opening-syslog-channel.patch @@ -0,0 +1,38 @@ +From 20d0e6064cf81240dac3cccc89c2bd299cca210d Mon Sep 17 00:00:00 2001 +From: wangmeiyang +Date: Wed, 23 Nov 2022 17:25:58 +0800 +Subject: [PATCH 06/23] util: set facility when opening syslog channel +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We're currently passing '0' which leaves the syslog facility +unset. Since we're passing an explicit facility for syslog +when using journald, it makes sense to be explicit when +using syslog directly too. + +cherry-pick from ab96031943d494010166875f399656a6c13aadf5 + +Signed-off-by: Daniel P. Berrangé +Signed-off-by: Meiyang Wang +Reviewed-by: Ján Tomko +--- + src/util/virlog.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/util/virlog.c b/src/util/virlog.c +index e4944d1258..1b510389da 100644 +--- a/src/util/virlog.c ++++ b/src/util/virlog.c +@@ -1411,7 +1411,7 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs) + tmp = g_strdup(outputs[id]->name); + VIR_FREE(current_ident); + current_ident = tmp; +- openlog(current_ident, 0, 0); ++ openlog(current_ident, 0, LOG_DAEMON); + } + #endif /* HAVE_SYSLOG_H */ + +-- +2.27.0 + diff --git a/virDomainCheckpointCreateXML-Don-t-use-HTML-in-funct.patch b/virDomainCheckpointCreateXML-Don-t-use-HTML-in-funct.patch new file mode 100644 index 0000000..58616e3 --- /dev/null +++ b/virDomainCheckpointCreateXML-Don-t-use-HTML-in-funct.patch @@ -0,0 +1,36 @@ +From b8b8276707d6bf8cba80f4f6359731f23db73ba6 Mon Sep 17 00:00:00 2001 +From: jipengfei +Date: Thu, 24 Nov 2022 18:03:56 +0800 +Subject: [PATCH 22/23] virDomainCheckpointCreateXML: Don't use HTML in + function docs and fix link + +cherry-pick from 35fc11139ec9f077a30e1c8b97effc28f8822e9b + +Fix the link target after the conversion of the XML description to RST +which renamed anchors and drop the tag from the C code comment. +Apart from not working properly in the .c file it didn't work in the +generated docs either as the brackets were escaped. + +Signed-off-by: Peter Krempa +Signed-off-by: jipengfei +Reviewed-by: Jonathon Jongsma +--- + src/libvirt-domain-checkpoint.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libvirt-domain-checkpoint.c b/src/libvirt-domain-checkpoint.c +index 432c2d5a52..64bf5b323b 100644 +--- a/src/libvirt-domain-checkpoint.c ++++ b/src/libvirt-domain-checkpoint.c +@@ -108,7 +108,7 @@ virDomainCheckpointGetConnect(virDomainCheckpointPtr checkpoint) + * kicking off a backup job with virDomainBackupBegin(); however, it + * is also possible to start a checkpoint without a backup. + * +- * See Checkpoint XML ++ * See https://www.libvirt.org/formatcheckpoint.html#checkpoint-xml + * for more details on @xmlDesc. In particular, some hypervisors may require + * particular disk formats, such as qcow2, in order to support this + * command; where @xmlDesc can be used to limit the checkpoint to a working +-- +2.27.0 + diff --git a/vircgroupv1-fix-null-string-specifier-argument-in-vi.patch b/vircgroupv1-fix-null-string-specifier-argument-in-vi.patch new file mode 100644 index 0000000..2960f6c --- /dev/null +++ b/vircgroupv1-fix-null-string-specifier-argument-in-vi.patch @@ -0,0 +1,51 @@ +From 164fb659e30346c7140bdda2bf9b47e59bdcebe9 Mon Sep 17 00:00:00 2001 +From: wangmeiyang +Date: Wed, 23 Nov 2022 10:28:49 +0800 +Subject: [PATCH 01/23] vircgroupv1: fix null string specifier argument in + virCgroupV1ValidatePlacement +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Detected by gcc 11 -Wformat-overflow: +../../src/util/vircgroupv1.c: In function ‘virCgroupV1ValidatePlacement’: +../../src/util/virerror.h:176:5: warning: ‘%s’ directive argument is null [-Wformat-overflow=] + 176 | virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 177 | __FUNCTION__, __LINE__, __VA_ARGS__) + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../../src/util/vircgroupv1.c:411:13: note: in expansion of macro ‘virReportError’ + 411 | virReportError(VIR_ERR_INTERNAL_ERROR, + | ^~~~~~~~~~~~~~ +../../src/util/vircgroupv1.c:412:80: note: format string is defined here + 412 | _("Could not find placement for v1 controller %s at %s"), + | ^~ + +cherry-pick from 8833b42f3b092c1b401109ddf174ea1dbb1eb8c6 + +Signed-off-by: Scott Davis +Signed-off-by: Meiyang Wang +Reviewed-by: Ján Tomko +--- + src/util/vircgroupv1.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c +index 5504441fa6..f5a96bd736 100644 +--- a/src/util/vircgroupv1.c ++++ b/src/util/vircgroupv1.c +@@ -376,9 +376,8 @@ virCgroupV1ValidatePlacement(virCgroupPtr group, + + if (!group->legacy[i].placement) { + virReportError(VIR_ERR_INTERNAL_ERROR, +- _("Could not find placement for v1 controller %s at %s"), +- virCgroupV1ControllerTypeToString(i), +- group->legacy[i].placement); ++ _("Could not find placement for v1 controller %s"), ++ virCgroupV1ControllerTypeToString(i)); + return -1; + } + +-- +2.27.0 + diff --git a/vircgroupv2devices-fix-counting-entries-in-BPF-map.patch b/vircgroupv2devices-fix-counting-entries-in-BPF-map.patch new file mode 100644 index 0000000..39bdddc --- /dev/null +++ b/vircgroupv2devices-fix-counting-entries-in-BPF-map.patch @@ -0,0 +1,40 @@ +From f268a97669b2871735fb0a2bb9cda275bf8c204f Mon Sep 17 00:00:00 2001 +From: tangbinzy +Date: Thu, 24 Nov 2022 02:45:01 +0000 +Subject: [PATCH 13/23] vircgroupv2devices: fix counting entries in BPF map + BPF syscall BPF_MAP_GET_NEXT_KEY returns -1 if something fails but it will + also return -1 if trying to get next key using the last key in the map with + errno set to ENOENT. + +If there are VMs running and libvirtd is restarted and user tries to +call some cgroup devices operation on a VM we need to get the count of +entries in BPF map and it fails which will result in error when trying +to attach/detech devices. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1833321 + +Signed-off-by: Pavel Hrdina +Reviewed-by: Erik Skultety + +Signed-off-by: tangbin +(cherry-pick from 7e574d1a079bd13aeeedb7024cc45f85b1843fcc) +--- + src/util/vircgroupv2devices.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c +index d62ee12a05..234e0f2278 100644 +--- a/src/util/vircgroupv2devices.c ++++ b/src/util/vircgroupv2devices.c +@@ -342,7 +342,7 @@ virCgroupV2DevicesCountMapEntries(int mapfd) + prevKey = key; + } + +- if (rc < 0) ++ if (rc < 0 && errno != ENOENT) + return -1; + + return ret; +-- +2.27.0 + diff --git a/virsh-Fix-typo-of-metadata.patch b/virsh-Fix-typo-of-metadata.patch new file mode 100644 index 0000000..d326a6f --- /dev/null +++ b/virsh-Fix-typo-of-metadata.patch @@ -0,0 +1,30 @@ +From ddd1504fd4b0e779e42ec72b49ad1b1c485021cd Mon Sep 17 00:00:00 2001 +From: tangbin +Date: Wed, 23 Nov 2022 16:00:29 +0200 +Subject: [PATCH 10/23] virsh: Fix typo of metadata + +Signed-off-by: Han Han +Reviewed-by: Michal Privoznik + +Signed-off-by: tangbin +(cherry-pick from f57a8cd3df0167d72b87fdd868a287608a741b73) +--- + tools/virsh-domain.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c +index 8db1362314..50568203aa 100644 +--- a/tools/virsh-domain.c ++++ b/tools/virsh-domain.c +@@ -13558,7 +13558,7 @@ virshEventMetadataChangePrint(virConnectPtr conn G_GNUC_UNUSED, + { + virBuffer buf = VIR_BUFFER_INITIALIZER; + +- virBufferAsprintf(&buf, _("event 'metdata-change' for domain %s: %s %s\n"), ++ virBufferAsprintf(&buf, _("event 'metadata-change' for domain %s: %s %s\n"), + virDomainGetName(dom), + UNKNOWNSTR(virshEventMetadataChangeTypeTypeToString(type)), + NULLSTR(nsuri)); +-- +2.27.0 + diff --git a/virsh-cmdBlock-Remove-error-prefix-for-an-empty-line.patch b/virsh-cmdBlock-Remove-error-prefix-for-an-empty-line.patch new file mode 100644 index 0000000..ed9d7e3 --- /dev/null +++ b/virsh-cmdBlock-Remove-error-prefix-for-an-empty-line.patch @@ -0,0 +1,76 @@ +From 72d16dabd48f8916e7296f19ec48ff3109a040c1 Mon Sep 17 00:00:00 2001 +From: tangbin +Date: Wed, 23 Nov 2022 16:00:29 +0200 +Subject: [PATCH 11/23] virsh: cmdBlock*: Remove 'error:' prefix for an empty + line + +When a block copy job fails prior to reaching the synchronized phase +while we are waiting for the job to finish virsh would print the +following: + + $ virsh blockcopy backup-test vda /tmp/dst.qcow2 --wait --reuse-external --transient-job + error: + Copy failed + +The above message looks like we've forgot to print the error message +itself as the line ends after 'error:'. Unfortunately with the current +API design clients have no way of actually getting the error message as +the VIR_DOMAIN_EVENT_ID_BLOCK_JOB(_2) event only reports the status but +not an error and the job then vanishes. + +Fix the expectations by using vshPrintExtra instead of vshError: + + $ virsh blockcopy backup-test vda /tmp/dst.qcow2 --wait --reuse-external --transient-job + + Copy failed + +Note that the newline is required to avoid printing the 'Copy failed' +message on the same line when printing the job progress percentage. + +Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=1847867 + +Fix the same issue also for block pull and block commit job + +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik + +Signed-off-by: tangbin +(cherry-pick from fc09f3d823aba430d38db0d5ba8cdc5b0a71b9e5) +--- + tools/virsh-domain.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c +index 50568203aa..7033232015 100644 +--- a/tools/virsh-domain.c ++++ b/tools/virsh-domain.c +@@ -2140,7 +2140,7 @@ cmdBlockcommit(vshControl *ctl, const vshCmd *cmd) + break; + + case VIR_DOMAIN_BLOCK_JOB_FAILED: +- vshError(ctl, "\n%s", _("Commit failed")); ++ vshPrintExtra(ctl, "\n%s", _("Commit failed")); + goto cleanup; + break; + +@@ -2457,7 +2457,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) + break; + + case VIR_DOMAIN_BLOCK_JOB_FAILED: +- vshError(ctl, "\n%s", _("Copy failed")); ++ vshPrintExtra(ctl, "\n%s", _("Copy failed")); + goto cleanup; + break; + +@@ -2865,7 +2865,7 @@ cmdBlockpull(vshControl *ctl, const vshCmd *cmd) + break; + + case VIR_DOMAIN_BLOCK_JOB_FAILED: +- vshError(ctl, "\n%s", _("Pull failed")); ++ vshPrintExtra(ctl, "\n%s", _("Pull failed")); + goto cleanup; + break; + +-- +2.27.0 + diff --git a/vmx-Require-networkName-for-bridged-and-custom-NICs.patch b/vmx-Require-networkName-for-bridged-and-custom-NICs.patch new file mode 100644 index 0000000..cad3b99 --- /dev/null +++ b/vmx-Require-networkName-for-bridged-and-custom-NICs.patch @@ -0,0 +1,37 @@ +From 6620c7cc62f11f1eda32c4b1c8006c0fdafb1c59 Mon Sep 17 00:00:00 2001 +From: jipengfei +Date: Thu, 24 Nov 2022 17:19:05 +0800 +Subject: [PATCH 18/23] vmx: Require networkName for bridged and custom NICs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +cherry-pick from db0564b4d34fb94fe59f04a4e411374ec1b6fc19 + +Commit 70768cda9740 marked this particular config string optional, but +forgot that two of the interface types still require this name to +exist. Mark it as optional only if there is no connectionType. + +Signed-off-by: Martin Kletzander +Signed-off-by: jipengfei +Reviewed-by: Reviewed-by: Ján Tomko +--- + src/vmx/vmx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c +index fbc8366f2b..5f2ada6630 100644 +--- a/src/vmx/vmx.c ++++ b/src/vmx/vmx.c +@@ -2667,7 +2667,7 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) + STRCASEEQ(connectionType, "bridged") || + STRCASEEQ(connectionType, "custom")) { + if (virVMXGetConfigString(conf, networkName_name, &networkName, +- true) < 0) ++ connectionType == NULL) < 0) + goto cleanup; + + if (!networkName) +-- +2.27.0 + diff --git a/vshtabletest-Fix-potential-memleak.patch b/vshtabletest-Fix-potential-memleak.patch new file mode 100644 index 0000000..b29ba29 --- /dev/null +++ b/vshtabletest-Fix-potential-memleak.patch @@ -0,0 +1,45 @@ +From e210025037fbd00c81e8faa0a5339dccdc0c75a1 Mon Sep 17 00:00:00 2001 +From: wangmeiyang +Date: Thu, 24 Nov 2022 09:10:25 +0800 +Subject: [PATCH 12/23] vshtabletest: Fix potential memleak +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In testVshTableNew() we test whether vshTableNew(NULL) allocates +a table. This is expected to fail (and return NULL), because +passing nothing but NULL to vshTableNew() is viewed as error. +Nevertheless, if vshTableNew() did not fail and returned an +allocated table it would be leaked. + +cherry-pick from eb9bbde7721af765d88086dc3055cff092436c58 + +Signed-off-by: Michal Privoznik +Signed-off-by: Meiyang Wang +Reviewed-by: Ján Tomko +--- + tests/vshtabletest.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/tests/vshtabletest.c b/tests/vshtabletest.c +index 15369d8eb2..348f525234 100644 +--- a/tests/vshtabletest.c ++++ b/tests/vshtabletest.c +@@ -33,11 +33,12 @@ + static int + testVshTableNew(const void *opaque G_GNUC_UNUSED) + { +- if (vshTableNew(NULL)) { ++ vshTablePtr table = vshTableNew(NULL); ++ if (table) { + fprintf(stderr, "expected failure when passing null to vshTableNew\n"); + return -1; + } +- ++ vshTableFree(table); + return 0; + } + +-- +2.27.0 + -- Gitee