Repository: mesos Updated Branches: refs/heads/master f50277163 -> 929417698
Passed slave's total resources to the ResourceEstimator and QoSController via Slave::usage(). Review: https://reviews.apache.org/r/36204 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/92941769 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/92941769 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/92941769 Branch: refs/heads/master Commit: 929417698331cde30921e80b5b3d2c0c04dbcfb2 Parents: f502771 Author: Bartek Plotka <[email protected]> Authored: Tue Jul 7 11:10:37 2015 -0700 Committer: Jie Yu <[email protected]> Committed: Tue Jul 7 11:10:38 2015 -0700 ---------------------------------------------------------------------- include/mesos/mesos.proto | 4 +++- src/slave/slave.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/92941769/include/mesos/mesos.proto ---------------------------------------------------------------------- diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto index 3dd4a5b..1763129 100644 --- a/include/mesos/mesos.proto +++ b/include/mesos/mesos.proto @@ -669,7 +669,9 @@ message ResourceUsage { repeated Executor executors = 1; - // TODO(jieyu): Include slave's total resources here. + // Slave's total resources including checkpointed dynamic + // reservations and persistent volumes. + repeated Resource total = 2; } http://git-wip-us.apache.org/repos/asf/mesos/blob/92941769/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index 008170f..2119b51 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -4375,6 +4375,17 @@ Future<ResourceUsage> Slave::usage() } } + Try<Resources> totalResources = applyCheckpointedResources( + info.resources(), + checkpointedResources); + + CHECK_SOME(totalResources) + << "Failed to apply checkpointed resources " + << checkpointedResources << " to slave's resources " + << info.resources(); + + usage->mutable_total()->CopyFrom(totalResources.get()); + return await(futures).then( [usage](const list<Future<ResourceStatistics>>& futures) { // NOTE: We add ResourceUsage::Executor to 'usage' the same
