You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2019/07/23 05:44:24 UTC
[mesos] branch master updated: Fixed devolution of
'max_grace_period' field in DRAIN_AGENT call.
This is an automated email from the ASF dual-hosted git repository.
grag 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 ff8c9a9 Fixed devolution of 'max_grace_period' field in DRAIN_AGENT call.
ff8c9a9 is described below
commit ff8c9a96be6ae1ee47faf9d5b80a518dfb4a3db0
Author: Greg Mann <gr...@gmail.com>
AuthorDate: Mon Jul 22 18:48:56 2019 -0700
Fixed devolution of 'max_grace_period' field in DRAIN_AGENT call.
Review: https://reviews.apache.org/r/71140
---
src/internal/devolve.cpp | 14 +++++++++++++-
src/tests/api_tests.cpp | 2 ++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/internal/devolve.cpp b/src/internal/devolve.cpp
index 2809c25..4527c52 100644
--- a/src/internal/devolve.cpp
+++ b/src/internal/devolve.cpp
@@ -280,7 +280,19 @@ mesos::agent::Response devolve(const v1::agent::Response& response)
mesos::master::Call devolve(const v1::master::Call& call)
{
- return devolve<mesos::master::Call>(call);
+ mesos::master::Call _call = devolve<mesos::master::Call>(call);
+
+ // The `google.protobuf.Duration` field in the `DrainAgent` call does not get
+ // devolved automatically with the templated helper, so we devolve it
+ // explicitly here.
+ if (call.type() == v1::master::Call::DRAIN_AGENT &&
+ call.has_drain_agent() &&
+ call.drain_agent().has_max_grace_period()) {
+ *_call.mutable_drain_agent()->mutable_max_grace_period() =
+ devolve(call.drain_agent().max_grace_period());
+ }
+
+ return _call;
}
} // namespace internal {
diff --git a/src/tests/api_tests.cpp b/src/tests/api_tests.cpp
index 3479ed3..641eb15 100644
--- a/src/tests/api_tests.cpp
+++ b/src/tests/api_tests.cpp
@@ -5588,6 +5588,7 @@ TEST_P(MasterAPITest, DrainAgent)
{
v1::master::Call::DrainAgent drainAgent;
drainAgent.mutable_agent_id()->CopyFrom(agentId);
+ drainAgent.mutable_max_grace_period()->set_seconds(0);
v1::master::Call call;
call.set_type(v1::master::Call::DRAIN_AGENT);
@@ -5605,6 +5606,7 @@ TEST_P(MasterAPITest, DrainAgent)
mesos::v1::DrainInfo drainInfo;
drainInfo.set_state(mesos::v1::DRAINED);
drainInfo.mutable_config()->set_mark_gone(false);
+ drainInfo.mutable_config()->mutable_max_grace_period()->set_nanoseconds(0);
// Ensure that the agent's drain info is reflected in the master's
// GET_AGENTS response.