mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject mesos git commit: Error out when root qdisc already exists in port mapping isolator.
Date Thu, 19 Nov 2015 23:51:43 GMT
Repository: mesos
Updated Branches:
  refs/heads/master bb5c44a7a -> dfd1c4c2e


Error out when root qdisc already exists in port mapping isolator.

When we enable --egress_unique_flow_per_container, we need to install an
fq_codel qdisc on root, but if a qdisc already exists on root, we need
to make sure it is an fq_codel qdisc.

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


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

Branch: refs/heads/master
Commit: dfd1c4c2e9e480e177b83a230ec904e07467d1fc
Parents: bb5c44a
Author: Cong Wang <cwang@twopensource.com>
Authored: Thu Nov 19 15:30:24 2015 -0800
Committer: Jie Yu <yujie.jay@gmail.com>
Committed: Thu Nov 19 15:51:34 2015 -0800

----------------------------------------------------------------------
 .../mesos/isolators/network/port_mapping.cpp    | 43 ++++++++++++++------
 1 file changed, 31 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dfd1c4c2/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp b/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
index cc0152c..e50616f 100644
--- a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
@@ -1387,19 +1387,38 @@ Try<Isolator*> PortMappingIsolatorProcess::create(const Flags&
flags)
   if (flags.egress_unique_flow_per_container) {
     // Prepare a fq_codel queueing discipline on host public interface
     // (eth0) for egress flow classification.
-    //
-    // TODO(cwang): Maybe we can continue when some other egress qdisc
-    // exists because this is not a necessary qdisc for network
-    // isolation, but we don't want inconsistency, so we just fail in
-    // this case. See details in MESOS-2370.
-    Try<bool> createHostEth0EgressQdisc = fq_codel::create(
-        eth0.get(),
-        EGRESS_ROOT,
-        HOST_TX_FQ_CODEL_HANDLE);
-    if (createHostEth0EgressQdisc.isError()) {
+    Try<bool> existHostEth0EgressFqCodel =
+      fq_codel::exists(eth0.get(), EGRESS_ROOT);
+
+    if (existHostEth0EgressFqCodel.isError()) {
       return Error(
-          "Failed to create the egress qdisc on " + eth0.get() +
-          ": " + createHostEth0EgressQdisc.error());
+          "Failed to check egress qdisc existence on " + eth0.get() +
+          ": " + existHostEth0EgressFqCodel.error());
+    }
+
+    if (existHostEth0EgressFqCodel.get()) {
+      // TODO(cwang): We don't know if this existed fq_codel qdisc is
+      // created by ourselves or someone else.
+      LOG(INFO) << "Using an existed egress qdisc on " << eth0.get();
+    } else {
+      // Either there is no qdisc at all, or there is some non-fq_codel
+      // qdisc at root. We try to create one to check which is true.
+      Try<bool> createHostEth0EgressQdisc = fq_codel::create(
+          eth0.get(),
+          EGRESS_ROOT,
+          HOST_TX_FQ_CODEL_HANDLE);
+
+      if (createHostEth0EgressQdisc.isError()) {
+        return Error(
+            "Failed to create the egress qdisc on " + eth0.get() +
+            ": " + createHostEth0EgressQdisc.error());
+      } else if (!createHostEth0EgressQdisc.get()) {
+        // TODO(cwang): Maybe we can continue when some other egress
+        // qdisc exists because this is not a necessary qdisc for
+        // network isolation, but we don't want inconsistency, so we
+        // just fail in this case. See details in MESOS-2370.
+        return Error("Egress qdisc already exists on " + eth0.get());
+      }
     }
 
     // TODO(cwang): Make sure DEFAULT_FLOWS is large enough so that


Mime
View raw message