Cgroup refactoring.
The purpose of this CL is to restructure cgroups into a generally reusable
form for cros code. Specifically:
1) Move to a new, controlled mount point. This pathway isn't cbuildbot
specific, and gives us a change to enforce certain rules on it.
2) Via the new mount point, allow configuration to persist and influence
non-nested cbuildbot/cros_sdk invocations.
3) Refactor the API into a form that while usable for general script
consumption, also enables us to build out a cjobs tool for managing
namespaces, putting process that aren't cgroup aware into namespaces,
and in general abusing cgroups more.
4) Finally, refactor into a form making nested killing of a cgroup tree
far easier to implement.
Additionally, cros_build_lib._NoOpContextManager is promoted to public
consumption since it's generally useful, and this code needs it.
BUG=chromium-os:26913
TEST=run_tests.sh
TEST=cbuildbot x86-generic-full
Change-Id: Iabcc3cd4ce452cd14477caedb7ab5014edaa611d
Reviewed-on: https://gerrit.chromium.org/gerrit/16236
Commit-Ready: Brian Harring <ferringb@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 43bfb39..9deaa05 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -22,7 +22,7 @@
from chromite.buildbot import cbuildbot_config
from chromite.buildbot import cbuildbot_stages as stages
from chromite.buildbot import cbuildbot_results as results_lib
-from chromite.buildbot import cgroup
+from chromite.buildbot import cgroup as cgroups
from chromite.buildbot import constants
from chromite.buildbot import gerrit_helper
from chromite.buildbot import patch as cros_patch
@@ -931,7 +931,8 @@
% options.buildroot)
with sudo.SudoKeepAlive():
- with cros_lib.AllowDisabling(options.cgroups, cgroup.CGroup):
+ with cros_lib.AllowDisabling(options.cgroups,
+ cgroups.ContainChildren, 'cbuildbot'):
with cros_lib.AllowDisabling(options.timeout > 0,
cros_lib.Timeout, options.timeout):
if not options.buildbot: