This is an automated email from the ASF dual-hosted git repository.
bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new d81b9df Made using validateFrameworkSubscription() in
UPDATE_FRAMEWORK possible.
d81b9df is described below
commit d81b9dfad83b76bdc90c585d05dfb1e85b69222f
Author: Andrei Sekretenko <[email protected]>
AuthorDate: Thu May 9 18:00:06 2019 -0400
Made using validateFrameworkSubscription() in UPDATE_FRAMEWORK possible.
This patch replaces the `Call:Subscribe` message in the arguments of
`Master::validateFrameworkSubscription()` with its constituents:
the `FrameworkInfo` and the list of suppressed roles.
The motivation behind this change is to help keep the new
UPDATE_FRAMEWORK call (being introduced in MESOS-7258) consistent with
re-subscribing the framework by using the same
`Master::validateFrameworkSubscription()` method to validate both
SUBSCRIBE and UPDATE_FRAMEWORK calls.
Review: https://reviews.apache.org/r/70531/
---
src/master/master.cpp | 10 +++++-----
src/master/master.hpp | 6 ++++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/master/master.cpp b/src/master/master.cpp
index b16ce8a..c72b926 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -2553,9 +2553,9 @@ void Master::reregisterFramework(
Option<Error> Master::validateFrameworkSubscription(
- const scheduler::Call::Subscribe& subscribe) const
+ const FrameworkInfo& frameworkInfo,
+ const google::protobuf::RepeatedPtrField<std::string>& suppressedRoles) const
{
- const FrameworkInfo& frameworkInfo = subscribe.framework_info();
Option<Error> validationError =
validation::framework::validate(frameworkInfo);
@@ -2622,7 +2622,7 @@ Option<Error> Master::validateFrameworkSubscription(
set<string> frameworkRoles = protobuf::framework::getRoles(frameworkInfo);
// The suppressed roles must be contained within the list of all
// roles for the framwork.
- foreach (const string& role, subscribe.suppressed_roles()) {
+ foreach (const string& role, suppressedRoles) {
if (!frameworkRoles.count(role)) {
return Error("Suppressed role '" + role +
"' is not contained in the list of roles");
@@ -2673,7 +2673,7 @@ void Master::subscribe(
<< " HTTP framework '" << frameworkInfo.name() << "'";
Option<Error> validationError =
- validateFrameworkSubscription(subscribe);
+ validateFrameworkSubscription(frameworkInfo, subscribe.suppressed_roles());
if (validationError.isSome()) {
LOG(INFO) << "Refusing subscription of framework"
@@ -2876,7 +2876,7 @@ void Master::subscribe(
}
Option<Error> validationError =
- validateFrameworkSubscription(subscribe);
+ validateFrameworkSubscription(frameworkInfo, subscribe.suppressed_roles());
// Note that re-authentication errors are already handled above.
if (validationError.isNone()) {
diff --git a/src/master/master.hpp b/src/master/master.hpp
index c5ee179..c523c93 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -1140,10 +1140,12 @@ private:
*/
bool isWhitelistedRole(const std::string& name) const;
- // Validates subscription prerequisites common
+ // Validates (re)subscription prerequisites common
// both for HTTP and driver-based frameworks.
Option<Error> validateFrameworkSubscription(
- const scheduler::Call::Subscribe&) const;
+ const FrameworkInfo&,
+ const google::protobuf::RepeatedPtrField<std::string>& suppressedRoles)
+ const;
/**
* Inner class used to namespace the handling of quota requests.