Removed check for nested cgroup support in `cgroups::prepare()`.

Previously, we were checking for nested cgroup support while trying to
create a linux launcher. This was necessary to make sure that the
kernel supports creating nested cgroups. As we don't support old
kernel versions which don't support nested cgroups, this check can be
safely removed.

Review: https://reviews.apache.org/r/66404/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/950ae66a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/950ae66a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/950ae66a

Branch: refs/heads/master
Commit: 950ae66a741142cc188b820c5a66c34e14867bb5
Parents: 1f20119
Author: Andrei Budnik <abud...@mesosphere.com>
Authored: Tue Apr 10 23:40:47 2018 -0700
Committer: Gilbert Song <songzihao1...@gmail.com>
Committed: Tue Apr 10 23:43:58 2018 -0700

----------------------------------------------------------------------
 src/linux/cgroups.cpp | 29 -----------------------------
 1 file changed, 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/950ae66a/src/linux/cgroups.cpp
----------------------------------------------------------------------
diff --git a/src/linux/cgroups.cpp b/src/linux/cgroups.cpp
index 682b288..847f116 100644
--- a/src/linux/cgroups.cpp
+++ b/src/linux/cgroups.cpp
@@ -458,35 +458,6 @@ Try<string> prepare(
     }
   }
 
-  // Test for nested cgroup support.
-  // TODO(jieyu): Consider doing this test only once.
-  const string& testCgroup = path::join(cgroup, "test");
-
-  // Create a nested test cgroup if it doesn't exist.
-  exists = cgroups::exists(hierarchy.get(), testCgroup);
-  if (exists.isError()) {
-    return Error(
-        "Failed to check existence of the nested test cgroup " +
-        path::join(hierarchy.get(), testCgroup) +
-        ": " + exists.error());
-  }
-
-  if (!exists.get()) {
-    // Make sure this kernel supports creating nested cgroups.
-    Try<Nothing> create = cgroups::create(hierarchy.get(), testCgroup);
-    if (create.isError()) {
-      return Error(
-          "Your kernel might be too old to support nested cgroup: " +
-          create.error());
-    }
-  }
-
-  // Remove the nested 'test' cgroup.
-  Try<Nothing> remove = cgroups::remove(hierarchy.get(), testCgroup);
-  if (remove.isError()) {
-    return Error("Failed to remove the nested test cgroup: " + remove.error());
-  }
-
   return hierarchy.get();
 }
 

Reply via email to