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 2016/11/22 16:09:23 UTC
mesos git commit: Added `attach()` call to the Containerizer.
Repository: mesos
Updated Branches:
refs/heads/master 1a525d22d -> 6850435ff
Added `attach()` call to the Containerizer.
This is just an API change, there is no implementation yet.
Review: https://reviews.apache.org/r/53795/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6850435f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6850435f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6850435f
Branch: refs/heads/master
Commit: 6850435ff15ef7a85ed22ca40f86857b92772be5
Parents: 1a525d2
Author: Vinod Kone <vi...@gmail.com>
Authored: Tue Nov 22 08:09:06 2016 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Nov 22 08:09:06 2016 -0800
----------------------------------------------------------------------
src/slave/containerizer/composing.cpp | 20 +++++++++++++++++
src/slave/containerizer/composing.hpp | 4 ++++
src/slave/containerizer/containerizer.hpp | 9 ++++++++
src/slave/containerizer/mesos/containerizer.cpp | 19 ++++++++++++++++
src/slave/containerizer/mesos/containerizer.hpp | 7 ++++++
src/tests/containerizer.cpp | 23 ++++++++++++++++++++
src/tests/containerizer.hpp | 9 ++++++++
7 files changed, 91 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6850435f/src/slave/containerizer/composing.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/composing.cpp b/src/slave/containerizer/composing.cpp
index 10bb618..e0818bc 100644
--- a/src/slave/containerizer/composing.cpp
+++ b/src/slave/containerizer/composing.cpp
@@ -20,6 +20,7 @@
#include <process/collect.hpp>
#include <process/defer.hpp>
#include <process/dispatch.hpp>
+#include <process/http.hpp>
#include <process/id.hpp>
#include <stout/hashmap.hpp>
@@ -81,6 +82,9 @@ public:
const SlaveID& slaveId,
const Option<ContainerClass>& containerClass);
+ Future<http::Connection> attach(
+ const ContainerID& containerId);
+
Future<Nothing> update(
const ContainerID& containerId,
const Resources& resources);
@@ -229,6 +233,15 @@ Future<Nothing> ComposingContainerizer::update(
}
+Future<http::Connection> ComposingContainerizer::attach(
+ const ContainerID& containerId)
+{
+ return dispatch(process,
+ &ComposingContainerizerProcess::attach,
+ containerId);
+}
+
+
Future<ResourceStatistics> ComposingContainerizer::usage(
const ContainerID& containerId)
{
@@ -550,6 +563,13 @@ Future<bool> ComposingContainerizerProcess::_launch(
}
+Future<http::Connection> ComposingContainerizerProcess::attach(
+ const ContainerID& containerId)
+{
+ return Failure("Unsupported");
+}
+
+
Future<Nothing> ComposingContainerizerProcess::update(
const ContainerID& containerId,
const Resources& resources)
http://git-wip-us.apache.org/repos/asf/mesos/blob/6850435f/src/slave/containerizer/composing.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/composing.hpp b/src/slave/containerizer/composing.hpp
index 3a2c9b4..292374a 100644
--- a/src/slave/containerizer/composing.hpp
+++ b/src/slave/containerizer/composing.hpp
@@ -23,6 +23,7 @@
#include <mesos/resources.hpp>
#include <process/future.hpp>
+#include <process/http.hpp>
#include <process/process.hpp>
#include <stout/hashmap.hpp>
@@ -70,6 +71,9 @@ public:
const SlaveID& slaveId,
const Option<mesos::slave::ContainerClass>& containerClass = None());
+ virtual process::Future<process::http::Connection> attach(
+ const ContainerID& containerId);
+
virtual process::Future<Nothing> update(
const ContainerID& containerId,
const Resources& resources);
http://git-wip-us.apache.org/repos/asf/mesos/blob/6850435f/src/slave/containerizer/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/containerizer.hpp b/src/slave/containerizer/containerizer.hpp
index 73e74c9..f65a9b9 100644
--- a/src/slave/containerizer/containerizer.hpp
+++ b/src/slave/containerizer/containerizer.hpp
@@ -25,6 +25,7 @@
#include <mesos/slave/containerizer.hpp>
#include <process/future.hpp>
+#include <process/http.hpp>
#include <process/owned.hpp>
#include <process/process.hpp>
@@ -106,6 +107,14 @@ public:
return process::Failure("Unsupported");
}
+ // Create an HTTP connection that can be used to "attach" (i.e.,
+ // stream input to or stream output from) a container.
+ virtual process::Future<process::http::Connection> attach(
+ const ContainerID& containerId)
+ {
+ return process::Failure("Unsupported");
+ }
+
// Update the resources for a container.
virtual process::Future<Nothing> update(
const ContainerID& containerId,
http://git-wip-us.apache.org/repos/asf/mesos/blob/6850435f/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index ec4ae32..e47a120 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -23,6 +23,7 @@
#include <process/collect.hpp>
#include <process/defer.hpp>
+#include <process/http.hpp>
#include <process/io.hpp>
#include <process/owned.hpp>
#include <process/reap.hpp>
@@ -106,6 +107,8 @@ using process::Failure;
using process::Future;
using process::Owned;
+using process::http::Connection;
+
using std::list;
using std::map;
using std::set;
@@ -502,6 +505,15 @@ Future<bool> MesosContainerizer::launch(
}
+Future<Connection> MesosContainerizer::attach(
+ const ContainerID& containerId)
+{
+ return dispatch(process.get(),
+ &MesosContainerizerProcess::attach,
+ containerId);
+}
+
+
Future<Nothing> MesosContainerizer::update(
const ContainerID& containerId,
const Resources& resources)
@@ -1805,6 +1817,13 @@ Future<bool> MesosContainerizerProcess::launch(
}
+Future<Connection> MesosContainerizerProcess::attach(
+ const ContainerID& containerId)
+{
+ return Failure("Unsupported");
+}
+
+
Future<Option<ContainerTermination>> MesosContainerizerProcess::wait(
const ContainerID& containerId)
{
http://git-wip-us.apache.org/repos/asf/mesos/blob/6850435f/src/slave/containerizer/mesos/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.hpp b/src/slave/containerizer/mesos/containerizer.hpp
index 272052d..c8d43f9 100644
--- a/src/slave/containerizer/mesos/containerizer.hpp
+++ b/src/slave/containerizer/mesos/containerizer.hpp
@@ -21,6 +21,7 @@
#include <vector>
#include <process/id.hpp>
+#include <process/http.hpp>
#include <process/sequence.hpp>
#include <process/shared.hpp>
@@ -94,6 +95,9 @@ public:
const SlaveID& slaveId,
const Option<mesos::slave::ContainerClass>& containerClass = None());
+ virtual process::Future<process::http::Connection> attach(
+ const ContainerID& containerId);
+
virtual process::Future<Nothing> update(
const ContainerID& containerId,
const Resources& resources);
@@ -161,6 +165,9 @@ public:
const SlaveID& slaveId,
const Option<mesos::slave::ContainerClass>& containerClass);
+ virtual process::Future<process::http::Connection> attach(
+ const ContainerID& containerId);
+
virtual process::Future<Nothing> update(
const ContainerID& containerId,
const Resources& resources);
http://git-wip-us.apache.org/repos/asf/mesos/blob/6850435f/src/tests/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer.cpp b/src/tests/containerizer.cpp
index d1b4da4..548da3a 100644
--- a/src/tests/containerizer.cpp
+++ b/src/tests/containerizer.cpp
@@ -22,9 +22,12 @@
#include "tests/mesos.hpp"
+using process::Failure;
using process::Future;
using process::Owned;
+using process::http::Connection;
+
using std::map;
using std::shared_ptr;
using std::string;
@@ -217,6 +220,13 @@ public:
return Nothing();
}
+
+ Future<Connection> attach(
+ const ContainerID& containerId)
+ {
+ return Failure("Unsupported");
+ }
+
Future<ResourceStatistics> usage(
const ContainerID& containerId)
{
@@ -448,6 +458,9 @@ void TestContainerizer::setup()
EXPECT_CALL(*this, launch(_, _, _, _, _, _))
.WillRepeatedly(Invoke(this, _launchNested));
+ EXPECT_CALL(*this, attach(_))
+ .WillRepeatedly(Invoke(this, &TestContainerizer::_attach));
+
EXPECT_CALL(*this, wait(_))
.WillRepeatedly(Invoke(this, &TestContainerizer::_wait));
@@ -531,6 +544,16 @@ Future<bool> TestContainerizer::_launch(
}
+Future<Connection> TestContainerizer::_attach(
+ const ContainerID& containerId)
+{
+ return process::dispatch(
+ process.get(),
+ &TestContainerizerProcess::attach,
+ containerId);
+}
+
+
Future<Nothing> TestContainerizer::_update(
const ContainerID& containerId,
const Resources& resources)
http://git-wip-us.apache.org/repos/asf/mesos/blob/6850435f/src/tests/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer.hpp b/src/tests/containerizer.hpp
index d799285..9d99ac1 100644
--- a/src/tests/containerizer.hpp
+++ b/src/tests/containerizer.hpp
@@ -33,6 +33,7 @@
#include <process/dispatch.hpp>
#include <process/future.hpp>
#include <process/gmock.hpp>
+#include <process/http.hpp>
#include <process/pid.hpp>
#include <stout/hashmap.hpp>
@@ -103,6 +104,11 @@ public:
const SlaveID& slaveId,
const Option<mesos::slave::ContainerClass>& containerClass));
+ MOCK_METHOD1(
+ attach,
+ process::Future<process::http::Connection>(
+ const ContainerID& containerId));
+
MOCK_METHOD2(
update,
process::Future<Nothing>(const ContainerID&, const Resources&));
@@ -158,6 +164,9 @@ private:
const SlaveID& slaveId,
const Option<mesos::slave::ContainerClass>& containerClass = None());
+ process::Future<process::http::Connection> _attach(
+ const ContainerID& containerId);
+
process::Future<Nothing> _update(
const ContainerID& containerId,
const Resources& resources);