mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
vircgroupbackend: Extend error messages in VIR_CGROUP_BACKEND_CALL()
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@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
edce157f11
commit
a0815484b1
@ -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",
|
||||
|
@ -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__); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user