You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/08/18 18:54:09 UTC
[2/9] mesos git commit: Stored subscribed resources in resource
provider manager.
Stored subscribed resources in resource provider manager.
In order to be able to always communicate the aggregated total
resources available on all subscribed resource providers, a resource
provider manager needs to keep track of the resources of all
subscribed resource providers. This commit adds a field for that the
manager's internal data structures for that purpose.
To make assigned 'ResourceProviderID's opaque to users of managers, the
manager assigns provider ids to all resources added.
Review: https://reviews.apache.org/r/61181/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f9ffc24a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f9ffc24a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f9ffc24a
Branch: refs/heads/master
Commit: f9ffc24aefee64ef91b50ec48258a15bb99600e5
Parents: f19cc63
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Fri Aug 18 10:00:10 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Aug 18 11:43:56 2017 -0700
----------------------------------------------------------------------
src/resource_provider/manager.cpp | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/f9ffc24a/src/resource_provider/manager.cpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/manager.cpp b/src/resource_provider/manager.cpp
index df5ddf3..7072c36 100644
--- a/src/resource_provider/manager.cpp
+++ b/src/resource_provider/manager.cpp
@@ -120,11 +120,15 @@ struct ResourceProvider
{
ResourceProvider(
const ResourceProviderInfo& _info,
- const HttpConnection& _http)
- : info(_info), http(_http) {}
+ const HttpConnection& _http,
+ const Resources& _resources)
+ : info(_info),
+ http(_http),
+ resources(_resources) {}
ResourceProviderInfo info;
HttpConnection http;
+ Resources resources;
};
@@ -297,7 +301,14 @@ void ResourceProviderManagerProcess::subscribe(
subscribe.resource_provider_info();
resourceProviderInfo.mutable_id()->CopyFrom(newResourceProviderId());
- ResourceProvider resourceProvider(resourceProviderInfo, http);
+ // Inject the `ResourceProviderID` for all subscribed resources.
+ Resources resources;
+ foreach (Resource resource, subscribe.resources()) {
+ resource.mutable_provider_id()->CopyFrom(resourceProviderInfo.id());
+ resources += resource;
+ }
+
+ ResourceProvider resourceProvider(resourceProviderInfo, http, resources);
Event event;
event.set_type(Event::SUBSCRIBED);