Repository: mesos
Updated Branches:
  refs/heads/master fd9b28331 -> 4556c3c93


Ignored no statistics condition for containers with no qdisc.

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


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

Branch: refs/heads/master
Commit: 4556c3c93e70816f26a9b82f3b620bc71d93bbf6
Parents: fd9b283
Author: Paul Brett <[email protected]>
Authored: Wed Aug 12 22:29:35 2015 -0700
Committer: Jie Yu <[email protected]>
Committed: Wed Aug 12 22:34:08 2015 -0700

----------------------------------------------------------------------
 .../isolators/network/port_mapping.cpp          | 24 +++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4556c3c9/src/slave/containerizer/isolators/network/port_mapping.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/isolators/network/port_mapping.cpp 
b/src/slave/containerizer/isolators/network/port_mapping.cpp
index 6d635d4..12b3ea7 100644
--- a/src/slave/containerizer/isolators/network/port_mapping.cpp
+++ b/src/slave/containerizer/isolators/network/port_mapping.cpp
@@ -885,9 +885,19 @@ int PortMappingStatistics::execute()
         NET_ISOLATOR_BW_LIMIT,
         statistics.get(),
         &result);
-  } else {
-    cerr << "Failed to get the network statistics for "
-         << "the htb qdisc on " << eth0 << endl;
+  } else if (statistics.isNone()) {
+    // Traffic control statistics are only available when the
+    // container is created on a slave when the egress rate limit is
+    // on (i.e., egress_rate_limit_per_container flag is set). We
+    // can't just test for that flag here however, since the slave may
+    // have been restarted with different flags since the container
+    // was created. It is also possible that isolator statistics are
+    // unavailable because we the container is in the process of being
+    // created or destroy. Hence we do not report a lack of network
+    // statistics as an error.
+  } else if (statistics.isError()) {
+    cerr << "Failed to get htb qdisc statistics on " << eth0
+         << " in namespace " << flags.pid.get() << endl;
   }
 
   // Drops due to the bandwidth limit should be reported at the leaf.
@@ -897,9 +907,11 @@ int PortMappingStatistics::execute()
         NET_ISOLATOR_BLOAT_REDUCTION,
         statistics.get(),
         &result);
-  } else {
-    cerr << "Failed to get the network statistics for "
-         << "the fq_codel qdisc on " << eth0 << endl;
+  } else if (statistics.isNone()) {
+    // See discussion on network isolator statistics above.
+  } else if (statistics.isError()) {
+    cerr << "Failed to get fq_codel qdisc statistics on " << eth0
+         << " in namespace " << flags.pid.get() << endl;
   }
 
   cout << stringify(JSON::Protobuf(result));

Reply via email to