Repository: mesos
Updated Branches:
  refs/heads/master 6e1041704 -> a41661420


Added --modules flag for Mesos slave.

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


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

Branch: refs/heads/master
Commit: a416614203849396aa47bd9e8b5b7ac9d4c5e069
Parents: 6e10417
Author: Kapil Arya <[email protected]>
Authored: Wed Oct 15 22:31:22 2014 +0200
Committer: Till Toenshoff <[email protected]>
Committed: Wed Oct 15 22:39:57 2014 +0200

----------------------------------------------------------------------
 src/slave/flags.hpp | 29 +++++++++++++++++++++++++++++
 src/slave/main.cpp  | 13 +++++++++++++
 2 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a4166142/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index 16f0cc2..159d4ef 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -26,8 +26,12 @@
 #include <stout/flags.hpp>
 #include <stout/option.hpp>
 
+#include "common/parse.hpp"
+
 #include "logging/flags.hpp"
 
+#include "messages/messages.hpp"
+
 #include "slave/constants.hpp"
 
 namespace mesos {
@@ -323,6 +327,30 @@ public:
         "impose no limits to containers' egress traffic throughput.\n"
         "This flag uses the Bytes type, defined in stout.");
 #endif // WITH_NETWORK_ISOLATOR
+
+    add(&Flags::modules,
+        "modules",
+        "List of modules to be loaded and be available to the internal\n"
+        "subsystems.\n"
+        "\n"
+        "Use --modules=filepath to specify the list of modules via a\n"
+        "file containing a JSON formatted string. 'filepath' can be\n"
+        "of the form 'file:///path/to/file' or '/path/to/file'.\n"
+        "\n"
+        "Use --modules=\"{...}\" to specify the list of modules inline.\n"
+        "\n"
+        "Example:\n"
+        "{\n"
+        "  \"libraries\": [\n"
+        "    {\n"
+        "      \"file\": \"/path/to/libfoo.so\",\n"
+        "      \"modules\": [\n"
+        "        \"org_apache_mesos_bar\",\n"
+        "        \"org_apache_mesos_baz\"\n"
+        "      ]\n"
+        "    }\n"
+        "  ]\n"
+        "}");
   }
 
   bool version;
@@ -370,6 +398,7 @@ public:
   Option<std::string> lo_name;
   Option<Bytes> egress_rate_limit_per_container;
 #endif
+  Option<Modules> modules;
 };
 
 } // namespace slave {

http://git-wip-us.apache.org/repos/asf/mesos/blob/a4166142/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index 1eafb35..b27cc32 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -33,6 +33,10 @@
 
 #include "logging/logging.hpp"
 
+#include "messages/messages.hpp"
+
+#include "module/manager.hpp"
+
 #include "slave/gc.hpp"
 #include "slave/slave.hpp"
 #include "slave/status_update_manager.hpp"
@@ -114,6 +118,15 @@ int main(int argc, char** argv)
     EXIT(1) << "Missing required option --master";
   }
 
+  // Initialize modules. Note that since other subsystems may depend
+  // upon modules, we should initialize modules before anything else.
+  if (flags.modules.isSome()) {
+    Try<Nothing> result = ModuleManager::load(flags.modules.get());
+    if (result.isError()) {
+      EXIT(1) << "Error loading modules: " << result.error();
+    }
+  }
+
   // Initialize libprocess.
   if (ip.isSome()) {
     os::setenv("LIBPROCESS_IP", ip.get());

Reply via email to