Expose full reservation info in the agent's http endpoint.

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


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

Branch: refs/heads/master
Commit: 06eea5325a576083c567034438caeced76665928
Parents: 1a0a605
Author: Jiang Yan Xu <xuj...@apple.com>
Authored: Fri Sep 9 01:43:17 2016 -0700
Committer: Jiang Yan Xu <xuj...@apple.com>
Committed: Mon Sep 19 14:59:11 2016 -0700

----------------------------------------------------------------------
 src/slave/http.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/06eea532/src/slave/http.cpp
----------------------------------------------------------------------
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index 6746310..427072d 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -981,6 +981,21 @@ Future<Response> Slave::Http::state(
         writer->field("hostname", slave->info.hostname());
 
         writer->field("resources", Resources(slave->info.resources()));
+
+        writer->field(
+            "reserved_resources_full",
+            [this](JSON::ObjectWriter* writer) {
+              foreachpair (const string& role,
+                           const Resources& resources,
+                           slave->totalResources.reservations()) {
+                writer->field(role, [&resources](JSON::ArrayWriter* writer) {
+                  foreach (const Resource& resource, resources) {
+                    writer->element(JSON::Protobuf(resource));
+                  }
+                });
+              }
+            });
+
         writer->field("attributes", Attributes(slave->info.attributes()));
 
         if (slave->master.isSome()) {

Reply via email to