You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/01/27 05:15:54 UTC
[2/7] mesos git commit: Included reserved resources in stage 1 of
allocation.
Included reserved resources in stage 1 of allocation.
Review: https://reviews.apache.org/r/42741
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/77f003a1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/77f003a1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/77f003a1
Branch: refs/heads/master
Commit: 77f003a11b6523dd915cc8200de526adb95c12c7
Parents: 23d009e
Author: Michael Park <mp...@apache.org>
Authored: Mon Jan 25 12:26:31 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Tue Jan 26 20:06:28 2016 -0800
----------------------------------------------------------------------
src/master/allocator/mesos/hierarchical.cpp | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/77f003a1/src/master/allocator/mesos/hierarchical.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index 1e1c0b0..63de667 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -1210,12 +1210,24 @@ void HierarchicalAllocatorProcess::allocate(
continue;
}
- // Quota is satisfied from the available unreserved non-revocable
- // resources on the agent.
- //
- // TODO(alexr): Consider adding dynamically reserved resources.
+ // Calculate the currently available resources on the slave.
Resources available = slaves[slaveId].total - slaves[slaveId].allocated;
- Resources resources = available.unreserved().nonRevocable();
+
+ // The resources we offer are the unreserved resources as well as the
+ // reserved resources for this particular role. This is necessary to
+ // ensure that we don't offer resources that are reserved for another
+ // role.
+ //
+ // NOTE: Currently, frameworks are allowed to have '*' role.
+ // Calling reserved('*') returns an empty Resources object.
+ //
+ // Quota is satisfied from the available non-revocable resources on the
+ // agent. It's important that we include reserved resources here since
+ // reserved resources are accounted towards the quota guarantee. If we
+ // were to rely on stage 2 to offer them out, they would not be checked
+ // against the quota guarantee.
+ Resources resources =
+ (available.unreserved() + available.reserved(role)).nonRevocable();
// NOTE: The resources may not be allocatable here, but they can be
// accepted by one of the frameworks during the second allocation