Separated offer operations in Master::_accept. Review: https://reviews.apache.org/r/30283
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f8409a66 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f8409a66 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f8409a66 Branch: refs/heads/master Commit: f8409a668610f026f66a3f39fa63873e3c0ea3ee Parents: ca559f6 Author: Jie Yu <[email protected]> Authored: Mon Jan 26 12:24:08 2015 -0800 Committer: Jie Yu <[email protected]> Committed: Thu Jan 29 11:26:41 2015 -0800 ---------------------------------------------------------------------- src/master/master.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/f8409a66/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index 54f2690..f96bbc0 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -2803,14 +2803,34 @@ void Master::_accept( foreach (const Offer::Operation& operation, accept.operations()) { // TODO(jieyu): Validate each operation! switch (operation.type()) { - case Offer::Operation::RESERVE: - case Offer::Operation::UNRESERVE: - case Offer::Operation::CREATE: + case Offer::Operation::RESERVE: { + // TODO(jieyu): Provide implementation for RESERVE. + LOG(ERROR) << "Unsupported offer operation: " + << Offer::Operation::Type_Name(operation.type()); + break; + } + + case Offer::Operation::UNRESERVE: { + // TODO(jieyu): Provide implementation for UNRESERVE. + LOG(ERROR) << "Unsupported offer operation: " + << Offer::Operation::Type_Name(operation.type()); + break; + } + + case Offer::Operation::CREATE: { + // TODO(jieyu): Provide implementation for CREATE. + LOG(ERROR) << "Unsupported offer operation: " + << Offer::Operation::Type_Name(operation.type()); + break; + } + case Offer::Operation::DESTROY: { - // TODO(jieyu): Provide implementation for those operations. - LOG(ERROR) << "Unsupported offer operation" << operation.type(); + // TODO(jieyu): Provide implementation for DESTROY. + LOG(ERROR) << "Unsupported offer operation: " + << Offer::Operation::Type_Name(operation.type()); break; } + case Offer::Operation::LAUNCH: { foreach (const TaskInfo& task, operation.launch().task_infos()) { Future<bool> authorization = authorizations.front(); @@ -2913,10 +2933,10 @@ void Master::_accept( } break; } - default: { + + default: LOG(ERROR) << "Unsupported offer operation " << operation.type(); break; - } } }
