You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2011/11/24 08:04:00 UTC

svn commit: r1205738 - in /incubator/mesos/trunk: include/mesos/mesos.proto src/master/http.cpp src/slave/slave.cpp src/webui/master/framework.tpl src/webui/master/index.tpl

Author: andrew
Date: Thu Nov 24 07:03:59 2011
New Revision: 1205738

URL: http://svn.apache.org/viewvc?rev=1205738&view=rev
Log:
Fixes MESOS-33. Thanks to Sumedh Sawant for this patch!

Modified:
    incubator/mesos/trunk/include/mesos/mesos.proto
    incubator/mesos/trunk/src/master/http.cpp
    incubator/mesos/trunk/src/slave/slave.cpp
    incubator/mesos/trunk/src/webui/master/framework.tpl
    incubator/mesos/trunk/src/webui/master/index.tpl

Modified: incubator/mesos/trunk/include/mesos/mesos.proto
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/include/mesos/mesos.proto?rev=1205738&r1=1205737&r2=1205738&view=diff
==============================================================================
--- incubator/mesos/trunk/include/mesos/mesos.proto (original)
+++ incubator/mesos/trunk/include/mesos/mesos.proto Thu Nov 24 07:03:59 2011
@@ -155,10 +155,10 @@ message FrameworkInfo {
 
 message SlaveInfo {
   required string hostname = 1;
-  required string public_hostname = 2;
-  // TODO(benh): Send bound ports (direct and webui).
+  // TODO(benh,andyk): Send bound ports, not just hostname.
+  required string webui_hostname = 2;
+  optional int32 webui_port = 4 [default = 8081];
   repeated Resource resources = 3;
-//   repeated Attribute attribute = ;
 }
 
 

Modified: incubator/mesos/trunk/src/master/http.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master/http.cpp?rev=1205738&r1=1205737&r2=1205738&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master/http.cpp (original)
+++ incubator/mesos/trunk/src/master/http.cpp Thu Nov 24 07:03:59 2011
@@ -122,7 +122,8 @@ JSON::Object model(const Slave& slave)
   JSON::Object object;
   object.values["id"] = slave.id.value();
   object.values["hostname"] = slave.info.hostname();
-  object.values["web_ui_url"] = slave.info.public_hostname();
+  object.values["webui_hostname"] = slave.info.webui_hostname();
+  object.values["webui_port"] = slave.info.webui_port();
   object.values["registered_time"] = slave.registeredTime;
   object.values["resources"] = model(slave.info.resources());
   return object;

Modified: incubator/mesos/trunk/src/slave/slave.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/slave.cpp?rev=1205738&r1=1205737&r2=1205738&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/slave.cpp (original)
+++ incubator/mesos/trunk/src/slave/slave.cpp Thu Nov 24 07:03:59 2011
@@ -271,14 +271,15 @@ void Slave::operator () ()
   // this is our hostname, but on EC2 we look for the MESOS_PUBLIC_DNS
   // environment variable. This allows the master to display our
   // public name in its web UI.
-  string public_hostname = hostname;
+  string webui_hostname = hostname;
   if (getenv("MESOS_PUBLIC_DNS") != NULL) {
-    public_hostname = getenv("MESOS_PUBLIC_DNS");
+    webui_hostname = getenv("MESOS_PUBLIC_DNS");
   }
 
   // Initialize slave info.
+  info.set_webui_hostname(webui_hostname);
+  info.set_webui_port(conf.get<int>("webui_port", 8081));
   info.set_hostname(hostname);
-  info.set_public_hostname(public_hostname);
   info.mutable_resources()->MergeFrom(resources);
 
   // Spawn and initialize the isolation module.

Modified: incubator/mesos/trunk/src/webui/master/framework.tpl
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/master/framework.tpl?rev=1205738&r1=1205737&r2=1205738&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/master/framework.tpl (original)
+++ incubator/mesos/trunk/src/webui/master/framework.tpl Thu Nov 24 07:03:59 2011
@@ -70,7 +70,7 @@
     <td class="lists">{{task['state']}}</td>
     % if task['slave_id'] in slaves:
     %   slave = slaves[task['slave_id']]
-    <td class="lists"><a href="http://{{slave['web_ui_url']}}:8081/">{{slave['hostname']}}</a></td>
+    <td class="lists"><a href="http://{{slave['webui_hostname']}}:{{slave['webui_port']}}/">{{slave['hostname']}}</a></td>
     % else:
     <td class="lists">Slave {{task['slave_id']}} (disconnected)</td>
     % end
@@ -99,7 +99,7 @@
     <td class="lists">{{task['state']}}</td>
     % if task['slave_id'] in slaves:
     %   slave = slaves[task['slave_id']]
-    <td class="lists"><a href="http://{{slave['web_ui_url']}}:8081/">{{slave['hostname']}}</a></td>
+    <td class="lists"><a href="http://{{slave['webui_hostname']}}:{{slave['webui_port']}}/">{{slave['hostname']}}</a></td>
     % else:
     <td class="lists">Slave {{task['slave_id']}} (disconnected)</td>
     % end

Modified: incubator/mesos/trunk/src/webui/master/index.tpl
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/master/index.tpl?rev=1205738&r1=1205737&r2=1205738&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/master/index.tpl (original)
+++ incubator/mesos/trunk/src/webui/master/index.tpl Thu Nov 24 07:03:59 2011
@@ -205,7 +205,7 @@
   <tr>
     <td class="lists">{{slave['id']}}</td>
     <td class="lists">
-      <a href="http://{{slave['web_ui_url']}}:8081/">{{slave['hostname']}}</a>
+      <a href="http://{{slave['webui_hostname']}}:{{slave['webui_port']}}/">{{slave['hostname']}}</a>
     </td>
     <td class="lists">{{slave['resources']['cpus']}}</td>
     <td class="lists">{{format_mem(slave['resources']['mem'])}}</td>