|
|
908a2f |
From 105dace22cc7b5b18d72a4dcad4a2cf386ce5c99 Mon Sep 17 00:00:00 2001
|
|
|
908a2f |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
908a2f |
Date: Tue, 18 Jan 2022 12:40:09 +0100
|
|
|
908a2f |
Subject: [PATCH] Revert "report error when virProcessGetStatInfo() is unable
|
|
|
908a2f |
to parse data"
|
|
|
908a2f |
|
|
|
908a2f |
This reverts commit 938382b60ae5bd1f83b5cb09e1ce68b9a88f679a.
|
|
|
908a2f |
|
|
|
908a2f |
Turns out, the commit did more harm than good. It changed
|
|
|
908a2f |
semantics on some public APIs. For instance, while
|
|
|
908a2f |
qemuDomainGetInfo() previously did not returned an error it does
|
|
|
908a2f |
now. While the calls to virProcessGetStatInfo() is guarded with
|
|
|
908a2f |
virDomainObjIsActive() it doesn't necessarily mean that QEMU's
|
|
|
908a2f |
PID is still alive. QEMU might be gone but we just haven't
|
|
|
908a2f |
realized it (e.g. because the eof handler thread is waiting for a
|
|
|
908a2f |
job).
|
|
|
908a2f |
|
|
|
908a2f |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041610
|
|
|
908a2f |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
908a2f |
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
908a2f |
---
|
|
|
908a2f |
src/ch/ch_driver.c | 2 ++
|
|
|
908a2f |
src/qemu/qemu_driver.c | 7 ++++++-
|
|
|
908a2f |
src/util/virprocess.c | 8 ++------
|
|
|
908a2f |
3 files changed, 10 insertions(+), 7 deletions(-)
|
|
|
908a2f |
|
|
|
908a2f |
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
|
|
|
908a2f |
index 3cbc668489..53e0872207 100644
|
|
|
908a2f |
--- a/src/ch/ch_driver.c
|
|
|
908a2f |
+++ b/src/ch/ch_driver.c
|
|
|
908a2f |
@@ -1073,6 +1073,8 @@ chDomainHelperGetVcpus(virDomainObj *vm,
|
|
|
908a2f |
if (virProcessGetStatInfo(&vcpuinfo->cpuTime,
|
|
|
908a2f |
&vcpuinfo->cpu, NULL,
|
|
|
908a2f |
vm->pid, vcpupid) < 0) {
|
|
|
908a2f |
+ virReportSystemError(errno, "%s",
|
|
|
908a2f |
+ _("cannot get vCPU placement & pCPU time"));
|
|
|
908a2f |
return -1;
|
|
|
908a2f |
}
|
|
|
908a2f |
}
|
|
|
908a2f |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
908a2f |
index 83cc7a04ea..0a1ba74e65 100644
|
|
|
908a2f |
--- a/src/qemu/qemu_driver.c
|
|
|
908a2f |
+++ b/src/qemu/qemu_driver.c
|
|
|
908a2f |
@@ -1354,6 +1354,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm,
|
|
|
908a2f |
if (virProcessGetStatInfo(&vcpuinfo->cpuTime,
|
|
|
908a2f |
&vcpuinfo->cpu, NULL,
|
|
|
908a2f |
vm->pid, vcpupid) < 0) {
|
|
|
908a2f |
+ virReportSystemError(errno, "%s",
|
|
|
908a2f |
+ _("cannot get vCPU placement & pCPU time"));
|
|
|
908a2f |
return -1;
|
|
|
908a2f |
}
|
|
|
908a2f |
}
|
|
|
908a2f |
@@ -2514,6 +2516,8 @@ qemuDomainGetInfo(virDomainPtr dom,
|
|
|
908a2f |
if (virDomainObjIsActive(vm)) {
|
|
|
908a2f |
if (virProcessGetStatInfo(&(info->cpuTime), NULL, NULL,
|
|
|
908a2f |
vm->pid, 0) < 0) {
|
|
|
908a2f |
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
|
|
908a2f |
+ _("cannot read cputime for domain"));
|
|
|
908a2f |
goto cleanup;
|
|
|
908a2f |
}
|
|
|
908a2f |
}
|
|
|
908a2f |
@@ -10513,7 +10517,8 @@ qemuDomainMemoryStatsInternal(virQEMUDriver *driver,
|
|
|
908a2f |
}
|
|
|
908a2f |
|
|
|
908a2f |
if (virProcessGetStatInfo(NULL, NULL, &rss, vm->pid, 0) < 0) {
|
|
|
908a2f |
- virResetLastError();
|
|
|
908a2f |
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
|
|
908a2f |
+ _("cannot get RSS for domain"));
|
|
|
908a2f |
} else {
|
|
|
908a2f |
stats[ret].tag = VIR_DOMAIN_MEMORY_STAT_RSS;
|
|
|
908a2f |
stats[ret].val = rss;
|
|
|
908a2f |
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
|
|
|
908a2f |
index 85d8c8e747..b559a4257e 100644
|
|
|
908a2f |
--- a/src/util/virprocess.c
|
|
|
908a2f |
+++ b/src/util/virprocess.c
|
|
|
908a2f |
@@ -1784,10 +1784,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime,
|
|
|
908a2f |
virStrToLong_ullp(proc_stat[VIR_PROCESS_STAT_STIME], NULL, 10, &systime) < 0 ||
|
|
|
908a2f |
virStrToLong_l(proc_stat[VIR_PROCESS_STAT_RSS], NULL, 10, &rss) < 0 ||
|
|
|
908a2f |
virStrToLong_i(proc_stat[VIR_PROCESS_STAT_PROCESSOR], NULL, 10, &cpu) < 0) {
|
|
|
908a2f |
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
908a2f |
- _("cannot parse process status data for pid '%d/%d'"),
|
|
|
908a2f |
- (int) pid, (int) tid);
|
|
|
908a2f |
- return -1;
|
|
|
908a2f |
+ VIR_WARN("cannot parse process status data");
|
|
|
908a2f |
}
|
|
|
908a2f |
|
|
|
908a2f |
/* We got jiffies
|
|
|
908a2f |
@@ -1884,8 +1881,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime G_GNUC_UNUSED,
|
|
|
908a2f |
pid_t pid G_GNUC_UNUSED,
|
|
|
908a2f |
pid_t tid G_GNUC_UNUSED)
|
|
|
908a2f |
{
|
|
|
908a2f |
- virReportSystemError(ENOSYS, "%s",
|
|
|
908a2f |
- _("Process statistics data is not supported on this platform"));
|
|
|
908a2f |
+ errno = ENOSYS;
|
|
|
908a2f |
return -1;
|
|
|
908a2f |
}
|
|
|
908a2f |
|
|
|
908a2f |
--
|
|
|
908a2f |
2.35.1
|
|
|
908a2f |
|