Updated Branches:
  refs/heads/master 8a79d3193 -> acee3fec1

Changed master and slave to get the default hostname based on the ip.

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


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

Branch: refs/heads/master
Commit: 6f4a21f0efc8dce2e50934cb3fe53e4219306a8a
Parents: e4a1b29
Author: Vinod Kone <[email protected]>
Authored: Thu Jan 30 14:33:04 2014 -0800
Committer: Vinod Kone <[email protected]>
Committed: Mon Feb 10 22:34:06 2014 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 6 +++---
 src/slave/slave.cpp   | 5 ++++-
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6f4a21f0/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 6827852..1af4558 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -301,7 +301,7 @@ void Master::initialize()
   string hostname;
 
   if (flags.hostname.isNone()) {
-    Try<string> result = os::hostname();
+    Try<string> result = net::getHostname(self().ip);
 
     if (result.isError()) {
       LOG(FATAL) << "Failed to get hostname: " << result.error();
@@ -314,8 +314,8 @@ void Master::initialize()
 
   info.set_hostname(hostname);
 
-  LOG(INFO) << "Master ID: '" << info.id()
-            << "' Hostname: '" << info.hostname() << "'";
+  LOG(INFO) << "Master ID: " << info.id()
+            << " Hostname: " << info.hostname();
 
   if (flags.authenticate) {
     LOG(INFO) << "Master only allowing authenticated frameworks to register!";

http://git-wip-us.apache.org/repos/asf/mesos/blob/6f4a21f0/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 1c0502e..5bb7a0c 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -219,7 +219,7 @@ void Slave::initialize()
   string hostname;
 
   if (flags.hostname.isNone()) {
-    Try<string> result = os::hostname();
+    Try<string> result = net::getHostname(self().ip);
 
     if (result.isError()) {
       LOG(FATAL) << "Failed to get hostname: " << result.error();
@@ -237,6 +237,9 @@ void Slave::initialize()
   info.mutable_attributes()->MergeFrom(attributes);
   info.set_checkpoint(flags.checkpoint);
 
+  LOG(INFO) << "Slave hostname: " << info.hostname();
+  LOG(INFO) << "Slave checkpoint: " << stringify(flags.checkpoint);
+
   // The required 'webui_hostname' field has been deprecated and
   // changed to optional for now, but we still need to set it for
   // interoperating with code that expects it to be required (e.g., an

Reply via email to