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