From bf3e3feba02e381f94537443a20a46b5b70e447161f9238e5744c7556709a179 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Wed, 26 Jan 2022 19:17:52 +0000 Subject: [PATCH] - Revert commit 938382b60a since it changes semantics on some public APIs 105dace2-revert-virProcessGetStatInfo.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=920 --- ...stats-functions-from-the-qemu-driver.patch | 6 +- 105dace2-revert-virProcessGetStatInfo.patch | 92 +++++++++++++++++++ libvirt.changes | 7 ++ libvirt.spec | 1 + 4 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 105dace2-revert-virProcessGetStatInfo.patch diff --git a/0001-Extract-stats-functions-from-the-qemu-driver.patch b/0001-Extract-stats-functions-from-the-qemu-driver.patch index 4be7781..a543230 100644 --- a/0001-Extract-stats-functions-from-the-qemu-driver.patch +++ b/0001-Extract-stats-functions-from-the-qemu-driver.patch @@ -241,7 +241,7 @@ Index: libvirt-8.0.0/src/qemu/qemu_driver.c #include "domain_audit.h" #include "domain_cgroup.h" #include "domain_driver.h" -@@ -17407,13 +17408,7 @@ qemuDomainGetStatsState(virQEMUDriver *d +@@ -17412,13 +17413,7 @@ qemuDomainGetStatsState(virQEMUDriver *d virTypedParamList *params, unsigned int privflags G_GNUC_UNUSED) { @@ -256,7 +256,7 @@ Index: libvirt-8.0.0/src/qemu/qemu_driver.c } -@@ -17705,25 +17700,11 @@ qemuDomainGetStatsCpuCgroup(virDomainObj +@@ -17710,25 +17705,11 @@ qemuDomainGetStatsCpuCgroup(virDomainObj virTypedParamList *params) { qemuDomainObjPrivate *priv = dom->privateData; @@ -283,7 +283,7 @@ Index: libvirt-8.0.0/src/qemu/qemu_driver.c } static int -@@ -17916,76 +17897,15 @@ qemuDomainGetStatsVcpu(virQEMUDriver *dr +@@ -17921,76 +17902,15 @@ qemuDomainGetStatsVcpu(virQEMUDriver *dr return ret; } diff --git a/105dace2-revert-virProcessGetStatInfo.patch b/105dace2-revert-virProcessGetStatInfo.patch new file mode 100644 index 0000000..c4072a4 --- /dev/null +++ b/105dace2-revert-virProcessGetStatInfo.patch @@ -0,0 +1,92 @@ +commit 105dace22cc7b5b18d72a4dcad4a2cf386ce5c99 +Author: Michal Prívozník +Date: Tue Jan 18 12:40:09 2022 +0100 + + Revert "report error when virProcessGetStatInfo() is unable to parse data" + + This reverts commit 938382b60ae5bd1f83b5cb09e1ce68b9a88f679a. + + Turns out, the commit did more harm than good. It changed + semantics on some public APIs. For instance, while + qemuDomainGetInfo() previously did not returned an error it does + now. While the calls to virProcessGetStatInfo() is guarded with + virDomainObjIsActive() it doesn't necessarily mean that QEMU's + PID is still alive. QEMU might be gone but we just haven't + realized it (e.g. because the eof handler thread is waiting for a + job). + + Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041610 + Signed-off-by: Michal Privoznik + Reviewed-by: Andrea Bolognani + +Index: libvirt-8.0.0/src/ch/ch_driver.c +=================================================================== +--- libvirt-8.0.0.orig/src/ch/ch_driver.c ++++ libvirt-8.0.0/src/ch/ch_driver.c +@@ -1073,6 +1073,8 @@ chDomainHelperGetVcpus(virDomainObj *vm, + if (virProcessGetStatInfo(&vcpuinfo->cpuTime, + &vcpuinfo->cpu, NULL, + vm->pid, vcpupid) < 0) { ++ virReportSystemError(errno, "%s", ++ _("cannot get vCPU placement & pCPU time")); + return -1; + } + } +Index: libvirt-8.0.0/src/qemu/qemu_driver.c +=================================================================== +--- libvirt-8.0.0.orig/src/qemu/qemu_driver.c ++++ libvirt-8.0.0/src/qemu/qemu_driver.c +@@ -1359,6 +1359,8 @@ qemuDomainHelperGetVcpus(virDomainObj *v + if (virProcessGetStatInfo(&vcpuinfo->cpuTime, + &vcpuinfo->cpu, NULL, + vm->pid, vcpupid) < 0) { ++ virReportSystemError(errno, "%s", ++ _("cannot get vCPU placement & pCPU time")); + return -1; + } + } +@@ -2519,6 +2521,8 @@ qemuDomainGetInfo(virDomainPtr dom, + if (virDomainObjIsActive(vm)) { + if (virProcessGetStatInfo(&(info->cpuTime), NULL, NULL, + vm->pid, 0) < 0) { ++ virReportError(VIR_ERR_OPERATION_FAILED, "%s", ++ _("cannot read cputime for domain")); + goto cleanup; + } + } +@@ -10526,7 +10530,8 @@ qemuDomainMemoryStatsInternal(virQEMUDri + } + + if (virProcessGetStatInfo(NULL, NULL, &rss, vm->pid, 0) < 0) { +- virResetLastError(); ++ virReportError(VIR_ERR_OPERATION_FAILED, "%s", ++ _("cannot get RSS for domain")); + } else { + stats[ret].tag = VIR_DOMAIN_MEMORY_STAT_RSS; + stats[ret].val = rss; +Index: libvirt-8.0.0/src/util/virprocess.c +=================================================================== +--- libvirt-8.0.0.orig/src/util/virprocess.c ++++ libvirt-8.0.0/src/util/virprocess.c +@@ -1784,10 +1784,7 @@ virProcessGetStatInfo(unsigned long long + virStrToLong_ullp(proc_stat[VIR_PROCESS_STAT_STIME], NULL, 10, &systime) < 0 || + virStrToLong_l(proc_stat[VIR_PROCESS_STAT_RSS], NULL, 10, &rss) < 0 || + virStrToLong_i(proc_stat[VIR_PROCESS_STAT_PROCESSOR], NULL, 10, &cpu) < 0) { +- virReportError(VIR_ERR_INTERNAL_ERROR, +- _("cannot parse process status data for pid '%d/%d'"), +- (int) pid, (int) tid); +- return -1; ++ VIR_WARN("cannot parse process status data"); + } + + /* We got jiffies +@@ -1884,8 +1881,7 @@ virProcessGetStatInfo(unsigned long long + pid_t pid G_GNUC_UNUSED, + pid_t tid G_GNUC_UNUSED) + { +- virReportSystemError(ENOSYS, "%s", +- _("Process statistics data is not supported on this platform")); ++ errno = ENOSYS; + return -1; + } + diff --git a/libvirt.changes b/libvirt.changes index ff22956..6a41f5b 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Jan 26 19:13:24 UTC 2022 - James Fehlig + +- Revert commit 938382b60a since it changes semantics on some + public APIs + 105dace2-revert-virProcessGetStatInfo.patch + ------------------------------------------------------------------- Tue Jan 25 16:26:42 UTC 2022 - James Fehlig diff --git a/libvirt.spec b/libvirt.spec index 3288427..3d7afde 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -305,6 +305,7 @@ Patch0: 3be5ba11-libvirt-guests-install.patch Patch1: 16172741-libvirt-guests-manpage.patch Patch2: 8eb44616-remove-sysconfig-files.patch Patch3: 31e937fb-libxl-save-lock-indicator.patch +Patch4: 105dace2-revert-virProcessGetStatInfo.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch