]> xenbits.xensource.com Git - libvirt.git/commitdiff
Avoid spamming logs with cgroups warnings
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 27 Feb 2013 16:51:04 +0000 (16:51 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 27 Feb 2013 22:51:24 +0000 (22:51 +0000)
The code for putting the emulator threads in a separate cgroup
would spam the logs with warnings

2013-02-27 16:08:26.731+0000: 29624: warning : virCgroupMoveTask:887 : no vm cgroup in controller 3
2013-02-27 16:08:26.731+0000: 29624: warning : virCgroupMoveTask:887 : no vm cgroup in controller 4
2013-02-27 16:08:26.732+0000: 29624: warning : virCgroupMoveTask:887 : no vm cgroup in controller 6

This is because it has only created child cgroups for 3 of the
controllers, but was trying to move the processes from all the
controllers. The fix is to only try to move threads in the
controllers we actually created. Also remove the warning and
make it return a hard error to avoid such lazy callers in the
future.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_cgroup.c
src/util/vircgroup.c

index e65b486212e07bb7be9a3be557af5d7946ea996e..671d613a5163c839de2918ece29588781b3dd554 100644 (file)
@@ -692,6 +692,11 @@ int qemuSetupCgroupForEmulator(virQEMUDriverPtr driver,
     }
 
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
+        if (i != VIR_CGROUP_CONTROLLER_CPU &&
+            i != VIR_CGROUP_CONTROLLER_CPUACCT &&
+            i != VIR_CGROUP_CONTROLLER_CPUSET)
+            continue;
+
         if (!qemuCgroupControllerActive(driver, i))
             continue;
         rc = virCgroupMoveTask(cgroup, cgroup_emulator, i);
index 48cba93a19e9a36e6dc936ae826e3ba74056962a..532e70422e3611744291a2d0d7dec9b544460219 100644 (file)
@@ -884,8 +884,7 @@ int virCgroupMoveTask(virCgroupPtr src_group, virCgroupPtr dest_group,
 
     if (!src_group->controllers[controller].mountPoint ||
         !dest_group->controllers[controller].mountPoint) {
-        VIR_WARN("no vm cgroup in controller %d", controller);
-        return 0;
+        return -EINVAL;
     }
 
     rc = virCgroupGetValueStr(src_group, controller, "tasks", &content);