]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virt-host-validate: Report an error if failed to detect CGroups
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 8 Jun 2021 07:17:52 +0000 (09:17 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 9 Jun 2021 06:22:33 +0000 (08:22 +0200)
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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Fabiano Fidêncio <fabiano@fidencio.org>
tools/virt-host-validate-common.c

index 9412bb7514880a1562bfb10dd1114cf814cefd37..c0cee43409bf32ebc2a247f885bf4e211546bbcf 100644 (file)
@@ -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;