Repository: mesos Updated Branches: refs/heads/master 30d1bb7c3 -> 5f1195f8f
Maintenance primitives: Used JSON instead of protobuf for errors. Replaces `__.DebugString()` with `stringify(JSON::Protobuf(__))`, which looks nicer and matches the JSON expected by the HTTP endpoints. Review: https://reviews.apache.org/r/37969 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5f1195f8 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5f1195f8 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5f1195f8 Branch: refs/heads/master Commit: 5f1195f8f10dc6fff65cb62a4745088e23bdc262 Parents: 30d1bb7 Author: Joseph Wu <[email protected]> Authored: Fri Sep 18 12:44:03 2015 -0400 Committer: Joris Van Remoortere <[email protected]> Committed: Fri Sep 18 12:58:23 2015 -0400 ---------------------------------------------------------------------- src/master/http.cpp | 8 ++++---- src/master/maintenance.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/5f1195f8/src/master/http.cpp ---------------------------------------------------------------------- diff --git a/src/master/http.cpp b/src/master/http.cpp index f7ce9aa..8bde4c7 100644 --- a/src/master/http.cpp +++ b/src/master/http.cpp @@ -1575,13 +1575,13 @@ Future<Response> Master::Http::machineDown(const Request& request) const foreach (const MachineID& id, ids.values()) { if (!master->machines.contains(id)) { return BadRequest( - "Machine '" + id.DebugString() + + "Machine '" + stringify(JSON::Protobuf(id)) + "' is not part of a maintenance schedule"); } if (master->machines[id].info.mode() != MachineInfo::DRAINING) { return BadRequest( - "Machine '" + id.DebugString() + + "Machine '" + stringify(JSON::Protobuf(id)) + "' is not in DRAINING mode and cannot be brought down"); } } @@ -1676,13 +1676,13 @@ Future<Response> Master::Http::machineUp(const Request& request) const foreach (const MachineID& id, ids.values()) { if (!master->machines.contains(id)) { return BadRequest( - "Machine '" + id.DebugString() + + "Machine '" + stringify(JSON::Protobuf(id)) + "' is not part of a maintenance schedule"); } if (master->machines[id].info.mode() != MachineInfo::DOWN) { return BadRequest( - "Machine '" + id.DebugString() + + "Machine '" + stringify(JSON::Protobuf(id)) + "' is not in DOWN mode and cannot be brought up"); } } http://git-wip-us.apache.org/repos/asf/mesos/blob/5f1195f8/src/master/maintenance.cpp ---------------------------------------------------------------------- diff --git a/src/master/maintenance.cpp b/src/master/maintenance.cpp index 87308a6..7d7d40b 100644 --- a/src/master/maintenance.cpp +++ b/src/master/maintenance.cpp @@ -26,6 +26,7 @@ #include <stout/hashset.hpp> #include <stout/ip.hpp> #include <stout/nothing.hpp> +#include <stout/stringify.hpp> #include <stout/strings.hpp> #include "master/maintenance.hpp" @@ -229,7 +230,7 @@ Try<Nothing> schedule( // Check that the machine is unique. if (updated.contains(id)) { return Error( - "Machine '" + id.DebugString() + + "Machine '" + stringify(JSON::Protobuf(id)) + "' appears more than once in the schedule"); } @@ -241,7 +242,7 @@ Try<Nothing> schedule( foreachpair (const MachineID& id, const Machine& machine, machines) { if (machine.info.mode() == MachineInfo::DOWN && !updated.contains(id)) { return Error( - "Machine '" + id.DebugString() + + "Machine '" + stringify(JSON::Protobuf(id)) + "' is deactivated and cannot be removed from the schedule"); } } @@ -282,7 +283,7 @@ Try<Nothing> machines(const MachineIDs& ids) // Check machine uniqueness. if (uniques.contains(id)) { return Error( - "Machine '" + id.DebugString() + + "Machine '" + stringify(JSON::Protobuf(id)) + "' appears more than once in the schedule"); }
