[PATCH 2/3] vircgroupbackend: Extend error messages in VIR_CGROUP_BACKEND_CALL()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The VIR_CGROUP_BACKEND_CALL() macro gets a backend for controller
and calls corresponding callback in it. If either is NULL then an
error message is printed out. However, the error message contains
only the intended callback func and not controller or backend
found.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/util/vircgroupbackend.c | 1 -
 src/util/vircgroupbackend.h | 8 ++++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/util/vircgroupbackend.c b/src/util/vircgroupbackend.c
index 53184cd060..6d6f82cbb1 100644
--- a/src/util/vircgroupbackend.c
+++ b/src/util/vircgroupbackend.c
@@ -29,7 +29,6 @@
 
 #define VIR_FROM_THIS VIR_FROM_CGROUP
 
-VIR_ENUM_DECL(virCgroupBackend);
 VIR_ENUM_IMPL(virCgroupBackend,
               VIR_CGROUP_BACKEND_TYPE_LAST,
               "cgroup V2",
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
index c7f5708b86..c4d56896b0 100644
--- a/src/util/vircgroupbackend.h
+++ b/src/util/vircgroupbackend.h
@@ -58,6 +58,8 @@ typedef enum {
     VIR_CGROUP_BACKEND_TYPE_LAST,
 } virCgroupBackendType;
 
+VIR_ENUM_DECL(virCgroupBackend);
+
 typedef bool
 (*virCgroupAvailableCB)(void);
 
@@ -464,12 +466,14 @@ virCgroupBackendForController(virCgroup *group,
         virCgroupBackend *backend = virCgroupBackendForController(group, controller); \
         if (!backend) { \
             virReportError(VIR_ERR_INTERNAL_ERROR, \
-                           _("failed to get cgroup backend for '%s'"), #func); \
+                           _("failed to get cgroup backend for '%s' controller '%u'"), \
+                           #func, controller); \
             return ret; \
         } \
         if (!backend->func) { \
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
-                           _("operation '%s' not supported"), #func); \
+                           _("operation '%s' not supported for backend '%s'"), \
+                           #func, virCgroupBackendTypeToString(backend->type)); \
             return ret; \
         } \
         return backend->func(group, ##__VA_ARGS__); \
-- 
2.26.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux