mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bmah...@apache.org
Subject mesos git commit: Fixed a regression in the creation of the isolator modules.
Date Mon, 13 Jun 2016 22:33:13 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 2c9dfab98 -> 9dc9669d3


Fixed a regression in the creation of the isolator modules.

While refactoring the isolator creation in 6fb9c024, we introduced a
regression in that isolator modules were no longer being created via
the --isolation flag values.

Also, we need to re-establish the old semantics that allowed the
operator to control the isolator ordering. A TODO has been added
for this.

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


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

Branch: refs/heads/master
Commit: 9dc9669d3cf884cb96e2a0cb68d8fa55e203bde1
Parents: 2c9dfab
Author: Benjamin Mahler <bmahler@apache.org>
Authored: Mon Jun 13 13:59:18 2016 -0700
Committer: Benjamin Mahler <bmahler@apache.org>
Committed: Mon Jun 13 15:28:23 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 26 ++++++++++++++++----
 1 file changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9dc9669d/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 92c9898..e5a339d 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -272,6 +272,14 @@ Try<MesosContainerizer*> MesosContainerizer::create(
   //   (2) The Nvidia GPU isolator must come after the cgroups
   //       devices isolator, as it relies on the 'devices' cgroup
   //       being set up.
+  //
+  // TODO(bmahler): De-centralize the ordering enforcement so that
+  // each isolator is responsible for validating that it is
+  // ordered correctly within the --isolation flag. This gives the
+  // operator control over the isolator ordering. If the operator
+  // specifies an invalid ordering, it will produce an error
+  // during the creation of an isolator and we will inform the
+  // operator to adjust the --isolation flag accordingly.
 
   const vector<pair<string, lambda::function<Try<Isolator*>(const Flags&)>>>
     creators = {
@@ -326,13 +334,14 @@ Try<MesosContainerizer*> MesosContainerizer::create(
   vector<Owned<Isolator>> isolators;
 
   const vector<string> tokens = strings::tokenize(flags_.isolation, ",");
-  const set<string> isolations(tokens.begin(), tokens.end());
+  set<string> isolations(tokens.begin(), tokens.end());
 
   if (isolations.size() != tokens.size()) {
     return Error("Duplicate entries found in --isolation flag"
                  " '" + stringify(tokens) + "'");
   }
 
+  // Create the first class isolators.
   foreach (const auto& creator, creators) {
     if (isolations.count(creator.first) > 0) {
       Try<Isolator*> isolator = creator.second(flags_);
@@ -341,17 +350,24 @@ Try<MesosContainerizer*> MesosContainerizer::create(
                      isolator.error());
       }
       isolators.emplace_back(isolator.get());
-    } else if (ModuleManager::contains<Isolator>(creator.first)) {
-      Try<Isolator*> isolator = ModuleManager::create<Isolator>(creator.first);
+      isolations.erase(creator.first);
+    }
+  }
+
+  // Create the module isolators.
+  foreach (const string& isolation, isolations) {
+    if (ModuleManager::contains<Isolator>(isolation)) {
+      Try<Isolator*> isolator = ModuleManager::create<Isolator>(isolation);
       if (isolator.isError()) {
-        return Error("Could not create isolator '" + creator.first + "': " +
+        return Error("Failed to create isolator module '" + isolation + "': " +
                      isolator.error());
       }
       isolators.emplace_back(isolator.get());
+      isolations.erase(isolation);
     }
   }
 
-  if (isolations.empty()) {
+  if (!isolations.empty()) {
     return Error("Unknown --isolation entries '" + stringify(isolations) + "'");
   }
 


Mime
View raw message