You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2014/08/26 18:33:16 UTC

git commit: Added logging when master/slaves/frameworks bind to loopback address.

Repository: mesos
Updated Branches:
  refs/heads/master 7de27508f -> 1ebe21469


Added logging when master/slaves/frameworks bind to loopback address.

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


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

Branch: refs/heads/master
Commit: 1ebe2146904d755e0651e50dbe3cb53dccc2d3c1
Parents: 7de2750
Author: Vinod Kone <vi...@gmail.com>
Authored: Mon Aug 25 19:47:33 2014 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Aug 26 09:32:09 2014 -0700

----------------------------------------------------------------------
 src/master/master.cpp       |  9 +++++++++
 src/sched/sched.cpp         | 10 ++++++++++
 src/scheduler/scheduler.cpp | 10 ++++++++++
 src/slave/slave.cpp         |  9 +++++++++
 4 files changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1ebe2146/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 18464ba..2508b38 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -286,6 +286,15 @@ void Master::initialize()
   LOG(INFO) << "Master " << info_.id() << " (" << info_.hostname() << ")"
             << " started on " << string(self()).substr(7);
 
+  if (stringify(net::IP(ntohl(self().ip))) == "127.0.0.1") {
+    LOG(WARNING) << "\n**************************************************\n"
+                 << "Master bound to loopback interface!"
+                 << " Cannot communicate with remote schedulers or slaves."
+                 << " You might want to set '--ip' flag to a routable"
+                 << " IP address.\n"
+                 << "**************************************************";
+  }
+
   // NOTE: We enforce a minimum slave re-register timeout because the
   // slave bounds its (re-)registration retries based on the minimum.
   if (flags.slave_reregister_timeout < MIN_SLAVE_REREGISTER_TIMEOUT) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/1ebe2146/src/sched/sched.cpp
----------------------------------------------------------------------
diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp
index 447b96f..a8c3fe6 100644
--- a/src/sched/sched.cpp
+++ b/src/sched/sched.cpp
@@ -53,6 +53,7 @@
 #include <stout/flags.hpp>
 #include <stout/hashmap.hpp>
 #include <stout/lambda.hpp>
+#include <stout/net.hpp>
 #include <stout/option.hpp>
 #include <stout/os.hpp>
 #include <stout/stopwatch.hpp>
@@ -1090,6 +1091,15 @@ void MesosSchedulerDriver::initialize() {
   // Initialize libprocess.
   process::initialize(schedulerId);
 
+  if (stringify(net::IP(ntohl(process::ip()))) == "127.0.0.1") {
+    LOG(WARNING) << "\n**************************************************\n"
+                 << "Scheduler driver bound to loopback interface!"
+                 << " Cannot communicate with remote master(s)."
+                 << " You might want to set 'LIBPROCESS_IP' environment"
+                 << " variable to use a routable IP address.\n"
+                 << "**************************************************";
+  }
+
   // Initialize logging.
   // TODO(benh): Replace whitespace in framework.name() with '_'?
   if (flags.initialize_driver_logging) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/1ebe2146/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index b7ce4de..1cee72d 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -47,6 +47,7 @@
 #include <stout/error.hpp>
 #include <stout/flags.hpp>
 #include <stout/lambda.hpp>
+#include <stout/net.hpp>
 #include <stout/nothing.hpp>
 #include <stout/option.hpp>
 #include <stout/os.hpp>
@@ -127,6 +128,15 @@ public:
     // want to use flags to initialize libprocess).
     process::initialize();
 
+    if (stringify(net::IP(ntohl(self().ip))) == "127.0.0.1") {
+      LOG(WARNING) << "\n**************************************************\n"
+                   << "Scheduler driver bound to loopback interface!"
+                   << " Cannot communicate with remote master(s)."
+                   << " You might want to set 'LIBPROCESS_IP' environment"
+                   << " variable to use a routable IP address.\n"
+                   << "**************************************************";
+    }
+
     // Initialize logging.
     if (flags.initialize_driver_logging) {
       logging::initialize("mesos", flags);

http://git-wip-us.apache.org/repos/asf/mesos/blob/1ebe2146/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 6253a5d..5c76dd1 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -166,6 +166,15 @@ void Slave::initialize()
 {
   LOG(INFO) << "Slave started on " << string(self()).substr(6);
 
+  if (stringify(net::IP(ntohl(self().ip))) == "127.0.0.1") {
+    LOG(WARNING) << "\n**************************************************\n"
+                 << "Slave bound to loopback interface!"
+                 << " Cannot communicate with remote master(s)."
+                 << " You might want to set '--ip' flag to a routable"
+                 << " IP address.\n"
+                 << "**************************************************";
+  }
+
 #ifdef __linux__
   // Move the slave into its own cgroup for each of the specified subsystems.
   // NOTE: Any subsystem configuration is inherited from the mesos root cgroup