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/07/06 18:34:15 UTC
[2/3] mesos git commit: Added filtering for orphaned executors in
`GET_EXECUTORS` operator API.
Added filtering for orphaned executors in `GET_EXECUTORS` operator API.
Review: https://reviews.apache.org/r/49685/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c1e0e4a4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c1e0e4a4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c1e0e4a4
Branch: refs/heads/master
Commit: c1e0e4a4a6c6031c818a1a91ef112beac5718030
Parents: 8775f81
Author: haosdent huang <ha...@gmail.com>
Authored: Wed Jul 6 13:33:55 2016 -0500
Committer: Vinod Kone <vi...@gmail.com>
Committed: Wed Jul 6 13:33:55 2016 -0500
----------------------------------------------------------------------
src/master/http.cpp | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1e0e4a4/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 4ecd5d4..9fed4de 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -1549,10 +1549,6 @@ Future<mesos::master::Response::GetExecutors> Master::Http::_getExecutors(
}
// Orphan executors.
- // TODO(haosdent): Need to filter these executors based on authorization!
- // This is currently not possible because we don't have `FrameworkInfo`
- // for these executors. We need to either store `FrameworkInfo` for orphan
- // executors or persist FrameworkInfo of all frameworks in the registry.
foreachvalue (const Slave* slave, master->slaves.registered) {
typedef hashmap<ExecutorID, ExecutorInfo> ExecutorMap;
foreachpair (const FrameworkID& frameworkId,
@@ -1560,6 +1556,25 @@ Future<mesos::master::Response::GetExecutors> Master::Http::_getExecutors(
slave->executors) {
foreachvalue (const ExecutorInfo& info, executors) {
if (!master->frameworks.registered.contains(frameworkId)) {
+ // TODO(haosdent): This logic should be simplified after
+ // a deprecation cycle starting with 1.0 as after that
+ // we can rely on `master->frameworks.recovered` containing
+ // all FrameworkInfos.
+ // Until then there are 3 cases:
+ // - No authorization enabled: show all orphaned executors.
+ // - Authorization enabled, but no FrameworkInfo present:
+ // do not show orphaned executors.
+ // - Authorization enabled, FrameworkInfo present: filter
+ // based on `approveViewExecutorInfo`.
+ if (master->authorizer.isSome() &&
+ (!master->frameworks.recovered.contains(frameworkId) ||
+ !approveViewExecutorInfo(
+ executorsApprover,
+ info,
+ master->frameworks.recovered[frameworkId]))) {
+ continue;
+ }
+
mesos::master::Response::GetExecutors::Executor* executor =
getExecutors.add_orphan_executors();