You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/04/05 19:34:49 UTC

mesos git commit: Added checks to verify that `rootDir` and `pluginDir` `isSome.

Repository: mesos
Updated Branches:
  refs/heads/master 7c6fb3728 -> 29dc72c10


Added checks to verify that `rootDir` and `pluginDir` `isSome.

`rootDir` and `pluginDir` can be `None` in case the operator does not
specify the network cni flags. In this case invoking `recover` on the
isolator without checking the `rootDir` and `pluginDir` for `isSome`
will cause the Agent to crash.

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


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

Branch: refs/heads/master
Commit: 29dc72c10f71f8548e63684e6f22fa970450a648
Parents: 7c6fb37
Author: Avinash sridharan <av...@mesosphere.io>
Authored: Tue Apr 5 10:34:40 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Apr 5 10:34:40 2016 -0700

----------------------------------------------------------------------
 .../mesos/isolators/network/cni/cni.cpp           | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/29dc72c1/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
index 5640f4b..57ec6b6 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
@@ -316,6 +316,16 @@ Future<Nothing> NetworkCniIsolatorProcess::recover(
     const list<ContainerState>& states,
     const hashset<ContainerID>& orphans)
 {
+  // If the `network/cni` isolator is providing network isolation to a
+  // container its `rootDir`should always be set.  This property of
+  // the isolator will not be set only if the operator does not
+  // specify the '--network_cni_plugins_dir' and
+  // '--network_cni_config_dir' flags at Agent startup. In this
+  // particular case the `network/cni` isolator should be a no-op.
+  if (rootDir.isNone()) {
+    return Nothing();
+  }
+
   foreach (const ContainerState& state, states) {
     const ContainerID& containerId = state.container_id();
 
@@ -568,6 +578,14 @@ Future<Nothing> NetworkCniIsolatorProcess::isolate(
     return Nothing();
   }
 
+  // If the `network/cni` isolator is providing network isolation to a
+  // container its `rootDir` and `pluginDir` should always be set.
+  // These properties of the isolator will not be set only if the
+  // operator does not specify the '--network_cni_plugins_dir' and
+  // '--network_cni_config_dir' flags at Agent startup.
+  CHECK_SOME(rootDir);
+  CHECK_SOME(pluginDir);
+
   // Create the container directory.
   const string containerDir =
       paths::getContainerDir(rootDir.get(), containerId.value());