render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
acda74
From a967747fcdf7d78425d218625ddb42606451c2ab Mon Sep 17 00:00:00 2001
acda74
Message-Id: <a967747fcdf7d78425d218625ddb42606451c2ab@dist-git>
acda74
From: Michal Privoznik <mprivozn@redhat.com>
acda74
Date: Wed, 18 Jan 2023 09:03:29 +0100
acda74
Subject: [PATCH] src: Don't use virReportSystemError() on
acda74
 virProcessGetStatInfo() failure
acda74
acda74
Firstly, the virProcessGetStatInfo() does not fail really. But
acda74
even if it did, it sets correct errno only sometimes (and even
acda74
that is done in a helper it's calling - virProcessGetStat() and
acda74
even there it's the case only in very few error paths).
acda74
acda74
Therefore, using virReportSystemError() to report errors is very
acda74
misleading. Use plain virReportError() instead. Luckily, there
acda74
are only two places where the former was used:
acda74
chDomainHelperGetVcpus() and qemuDomainHelperGetVcpus() (not a
acda74
big surprise since CH driver is heavily inspired by QEMU driver).
acda74
acda74
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
acda74
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
acda74
(cherry picked from commit 818c9717c53446ca7abbaa7b3fd7925e1c5ab663)
acda74
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2148266
acda74
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
acda74
---
acda74
 src/ch/ch_driver.c     | 4 ++--
acda74
 src/qemu/qemu_driver.c | 4 ++--
acda74
 2 files changed, 4 insertions(+), 4 deletions(-)
acda74
acda74
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
acda74
index db2a66d131..12fbe31c24 100644
acda74
--- a/src/ch/ch_driver.c
acda74
+++ b/src/ch/ch_driver.c
acda74
@@ -1079,8 +1079,8 @@ chDomainHelperGetVcpus(virDomainObj *vm,
acda74
                                       NULL, NULL,
acda74
                                       &vcpuinfo->cpu, NULL,
acda74
                                       vm->pid, vcpupid) < 0) {
acda74
-                virReportSystemError(errno, "%s",
acda74
-                                      _("cannot get vCPU placement & pCPU time"));
acda74
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
acda74
+                               _("cannot get vCPU placement & pCPU time"));
acda74
                 return -1;
acda74
             }
acda74
         }
acda74
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
acda74
index d6879175fe..c576c601ad 100644
acda74
--- a/src/qemu/qemu_driver.c
acda74
+++ b/src/qemu/qemu_driver.c
acda74
@@ -1355,8 +1355,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm,
acda74
                                       NULL, NULL,
acda74
                                       &vcpuinfo->cpu, NULL,
acda74
                                       vm->pid, vcpupid) < 0) {
acda74
-                virReportSystemError(errno, "%s",
acda74
-                                     _("cannot get vCPU placement & pCPU time"));
acda74
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
acda74
+                               _("cannot get vCPU placement & pCPU time"));
acda74
                 return -1;
acda74
             }
acda74
         }
acda74
-- 
acda74
2.39.1
acda74