From 52d2571b5810f27cdbdaa84ff270f36f7bc92546 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 8 Jun 2021 09:17:52 +0200 Subject: [PATCH] virt-host-validate: Report an error if failed to detect CGroups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a part of its checks, virt-host-validate calls virCgroupNew() to detect CGroup controllers which are then printed out. However, virCgroupNew() can fail (with appropriate error message set). Let's print an error onto stderr if that happens. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko Reviewed-by: Fabiano Fidêncio --- tools/virt-host-validate-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c index 9412bb7514..c0cee43409 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -290,8 +290,11 @@ int virHostValidateCGroupControllers(const char *hvname, int ret = 0; size_t i; - if (virCgroupNew("/", -1, &group) < 0) + if (virCgroupNew("/", -1, &group) < 0) { + fprintf(stderr, "Unable to initialize cgroups: %s\n", + virGetLastErrorMessage()); return VIR_HOST_VALIDATE_FAILURE(level); + } for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { int flag = 1 << i;