Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0EF34200B2B for ; Tue, 14 Jun 2016 00:33:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0D669160A5B; Mon, 13 Jun 2016 22:33:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 56486160A3C for ; Tue, 14 Jun 2016 00:33:14 +0200 (CEST) Received: (qmail 7838 invoked by uid 500); 13 Jun 2016 22:33:13 -0000 Mailing-List: contact commits-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mesos.apache.org Delivered-To: mailing list commits@mesos.apache.org Received: (qmail 7829 invoked by uid 99); 13 Jun 2016 22:33:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2016 22:33:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 53392DFFAB; Mon, 13 Jun 2016 22:33:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bmahler@apache.org To: commits@mesos.apache.org Message-Id: <6efc50161ca94c989621d9d886f24356@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: mesos git commit: Fixed a regression in the creation of the isolator modules. Date: Mon, 13 Jun 2016 22:33:13 +0000 (UTC) archived-at: Mon, 13 Jun 2016 22:33:15 -0000 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 Authored: Mon Jun 13 13:59:18 2016 -0700 Committer: Benjamin Mahler 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::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(const Flags&)>>> creators = { @@ -326,13 +334,14 @@ Try MesosContainerizer::create( vector> isolators; const vector tokens = strings::tokenize(flags_.isolation, ","); - const set isolations(tokens.begin(), tokens.end()); + set 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 = creator.second(flags_); @@ -341,17 +350,24 @@ Try MesosContainerizer::create( isolator.error()); } isolators.emplace_back(isolator.get()); - } else if (ModuleManager::contains(creator.first)) { - Try isolator = ModuleManager::create(creator.first); + isolations.erase(creator.first); + } + } + + // Create the module isolators. + foreach (const string& isolation, isolations) { + if (ModuleManager::contains(isolation)) { + Try isolator = ModuleManager::create(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) + "'"); }