From 908a2f2a46bc6f637790f35265947a6a4f386865 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 22 Feb 2022 18:56:30 +0000 Subject: [PATCH] Include upstream patch which fixes virt-install bug. --- ...ror-when-virProcessGetStatInfo-is-un.patch | 100 ++++++++++++++++++ libvirt.spec | 10 +- 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 0001-Revert-report-error-when-virProcessGetStatInfo-is-un.patch diff --git a/0001-Revert-report-error-when-virProcessGetStatInfo-is-un.patch b/0001-Revert-report-error-when-virProcessGetStatInfo-is-un.patch new file mode 100644 index 0000000..8dbc070 --- /dev/null +++ b/0001-Revert-report-error-when-virProcessGetStatInfo-is-un.patch @@ -0,0 +1,100 @@ +From 105dace22cc7b5b18d72a4dcad4a2cf386ce5c99 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 18 Jan 2022 12:40:09 +0100 +Subject: [PATCH] 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 +--- + src/ch/ch_driver.c | 2 ++ + src/qemu/qemu_driver.c | 7 ++++++- + src/util/virprocess.c | 8 ++------ + 3 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c +index 3cbc668489..53e0872207 100644 +--- a/src/ch/ch_driver.c ++++ b/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; + } + } +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 83cc7a04ea..0a1ba74e65 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -1354,6 +1354,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm, + if (virProcessGetStatInfo(&vcpuinfo->cpuTime, + &vcpuinfo->cpu, NULL, + vm->pid, vcpupid) < 0) { ++ virReportSystemError(errno, "%s", ++ _("cannot get vCPU placement & pCPU time")); + return -1; + } + } +@@ -2514,6 +2516,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; + } + } +@@ -10513,7 +10517,8 @@ qemuDomainMemoryStatsInternal(virQEMUDriver *driver, + } + + 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; +diff --git a/src/util/virprocess.c b/src/util/virprocess.c +index 85d8c8e747..b559a4257e 100644 +--- a/src/util/virprocess.c ++++ b/src/util/virprocess.c +@@ -1784,10 +1784,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime, + 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 *cpuTime G_GNUC_UNUSED, + 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; + } + +-- +2.35.1 + diff --git a/libvirt.spec b/libvirt.spec index 786f9b1..a8fa378 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -210,7 +210,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 8.0.0 -Release: 2%{?dist} +Release: 3%{?dist} License: LGPLv2+ URL: https://libvirt.org/ @@ -219,6 +219,11 @@ URL: https://libvirt.org/ %endif Source: https://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.xz +# Fix virt-install bug: +# ERROR internal error: cannot parse process status data for pid +# Upstream commit 105dace22cc7b5 +Patch1: 0001-Revert-report-error-when-virProcessGetStatInfo-is-un.patch + Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} @@ -2070,6 +2075,9 @@ exit 0 %changelog +* Tue Feb 22 2022 Richard W.M. Jones - 8.0.0-3 +- Include upstream patch which fixes virt-install bug. + * Thu Jan 20 2022 Fedora Release Engineering - 8.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild