Added ACKNOWLEDGE event to the resource provider API. The new event is used to send offer operation status udpate acknowledgements to resource providers.
Review: https://reviews.apache.org/r/64143/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ecef069b Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ecef069b Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ecef069b Branch: refs/heads/master Commit: ecef069b8349cdb9d98b6267636d4cb66948da20 Parents: 641b716 Author: Greg Mann <g...@mesosphere.io> Authored: Thu Dec 7 11:36:14 2017 -0800 Committer: Greg Mann <gregorywm...@gmail.com> Committed: Thu Dec 7 11:38:28 2017 -0800 ---------------------------------------------------------------------- .../resource_provider/resource_provider.proto | 18 +++++++++++++++--- .../v1/resource_provider/resource_provider.proto | 18 +++++++++++++++--- src/resource_provider/storage/provider.cpp | 4 ++++ src/tests/mesos.hpp | 6 ++++++ 4 files changed, 40 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/ecef069b/include/mesos/resource_provider/resource_provider.proto ---------------------------------------------------------------------- diff --git a/include/mesos/resource_provider/resource_provider.proto b/include/mesos/resource_provider/resource_provider.proto index 2ce71f4..1784df2 100644 --- a/include/mesos/resource_provider/resource_provider.proto +++ b/include/mesos/resource_provider/resource_provider.proto @@ -32,9 +32,10 @@ message Event { // in a backwards-compatible way. See: MESOS-4997. UNKNOWN = 0; - SUBSCRIBED = 1; // See 'Subscribed' below. - OPERATION = 2; // See 'Operation' below. - PUBLISH = 3; // See 'Publish' below. + SUBSCRIBED = 1; // See 'Subscribed' below. + OPERATION = 2; // See 'Operation' below. + PUBLISH = 3; // See 'Publish' below. + ACKNOWLEDGE_OFFER_OPERATION = 4; // See 'AcknowledgeOfferOperation' below. } // First event received by the resource provider when it subscribes @@ -76,10 +77,21 @@ message Event { repeated Resource resources = 2; } + // Received when an offer operation status update is being acknowledged. + // Acknowledgements may be generated either by a framework or by the master. + message AcknowledgeOfferOperation { + // The UUID from the `OfferOperationStatus` being acknowledged. + required bytes status_uuid = 1; + + // The UUID from the relevant `OfferOperation`. + required bytes operation_uuid = 2; + } + optional Type type = 1; optional Subscribed subscribed = 2; optional Operation operation = 3; optional Publish publish = 4; + optional AcknowledgeOfferOperation acknowledge_offer_operation = 5; } http://git-wip-us.apache.org/repos/asf/mesos/blob/ecef069b/include/mesos/v1/resource_provider/resource_provider.proto ---------------------------------------------------------------------- diff --git a/include/mesos/v1/resource_provider/resource_provider.proto b/include/mesos/v1/resource_provider/resource_provider.proto index 465b11d..a13eed3 100644 --- a/include/mesos/v1/resource_provider/resource_provider.proto +++ b/include/mesos/v1/resource_provider/resource_provider.proto @@ -32,9 +32,10 @@ message Event { // in a backwards-compatible way. See: MESOS-4997. UNKNOWN = 0; - SUBSCRIBED = 1; // See 'Subscribed' below. - OPERATION = 2; // See 'Operation' below. - PUBLISH = 3; // See 'Publish' below. + SUBSCRIBED = 1; // See 'Subscribed' below. + OPERATION = 2; // See 'Operation' below. + PUBLISH = 3; // See 'Publish' below. + ACKNOWLEDGE_OFFER_OPERATION = 4; // See 'AcknowledgeOfferOperation' below. } // First event received by the resource provider when it subscribes @@ -76,10 +77,21 @@ message Event { repeated Resource resources = 2; } + // Received when an offer operation status update is being acknowledged. + // Acknowledgements may be generated either by a framework or by the master. + message AcknowledgeOfferOperation { + // The UUID from the `OfferOperationStatus` being acknowledged. + required bytes status_uuid = 1; + + // The UUID from the relevant `OfferOperation`. + required bytes operation_uuid = 2; + } + optional Type type = 1; optional Subscribed subscribed = 2; optional Operation operation = 3; optional Publish publish = 4; + optional AcknowledgeOfferOperation acknowledge_offer_operation = 5; } http://git-wip-us.apache.org/repos/asf/mesos/blob/ecef069b/src/resource_provider/storage/provider.cpp ---------------------------------------------------------------------- diff --git a/src/resource_provider/storage/provider.cpp b/src/resource_provider/storage/provider.cpp index d798742..b9eb4f8 100644 --- a/src/resource_provider/storage/provider.cpp +++ b/src/resource_provider/storage/provider.cpp @@ -423,6 +423,10 @@ void StorageLocalResourceProviderProcess::received(const Event& event) publish(event.publish()); break; } + case Event::ACKNOWLEDGE_OFFER_OPERATION: { + CHECK(event.has_acknowledge_offer_operation()); + break; + } case Event::UNKNOWN: { LOG(WARNING) << "Received an UNKNOWN event and ignored"; break; http://git-wip-us.apache.org/repos/asf/mesos/blob/ecef069b/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 3a9b1fb..9bfc184 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -2855,6 +2855,9 @@ public: MOCK_METHOD1_T(subscribed, void(const typename Event::Subscribed&)); MOCK_METHOD1_T(operation, void(const typename Event::Operation&)); MOCK_METHOD1_T(publish, void(const typename Event::Publish&)); + MOCK_METHOD1_T( + acknowledgeOfferOperation, + void(const typename Event::AcknowledgeOfferOperation&)); void events(std::queue<Event> events) { @@ -2872,6 +2875,9 @@ public: case Event::PUBLISH: publish(event.publish()); break; + case Event::ACKNOWLEDGE_OFFER_OPERATION: + acknowledgeOfferOperation(event.acknowledge_offer_operation()); + break; case Event::UNKNOWN: LOG(FATAL) << "Received unexpected UNKNOWN event"; break;