Introduced a 'UUID' type. Review: https://reviews.apache.org/r/64168/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/605b238d Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/605b238d Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/605b238d Branch: refs/heads/master Commit: 605b238d601b520c88143df9b9a3bcca1f705eca Parents: 23d76de Author: Jan Schlicht <[email protected]> Authored: Thu Dec 14 17:29:38 2017 +0100 Committer: Benjamin Bannier <[email protected]> Committed: Thu Dec 14 17:35:08 2017 +0100 ---------------------------------------------------------------------- include/mesos/mesos.proto | 12 ++++- .../resource_provider/resource_provider.proto | 18 +++---- include/mesos/type_utils.hpp | 12 +++++ include/mesos/v1/mesos.proto | 12 ++++- .../resource_provider/resource_provider.proto | 18 +++---- src/common/protobuf_utils.cpp | 13 ++--- src/common/type_utils.cpp | 17 +++++++ src/master/master.cpp | 52 ++++++++++---------- src/master/master.hpp | 6 ++- src/messages/messages.cpp | 6 +-- src/messages/messages.proto | 26 +++++----- src/resource_provider/manager.cpp | 44 ++++++++--------- src/resource_provider/message.hpp | 7 +-- src/slave/slave.cpp | 32 ++++++------ src/status_update_manager/offer_operation.cpp | 3 +- .../status_update_manager_process.hpp | 10 ++-- src/tests/mesos.hpp | 7 +-- ...er_operation_status_update_manager_tests.cpp | 4 +- src/tests/resource_provider_manager_tests.cpp | 17 ++++--- .../resource_provider_validation_tests.cpp | 5 +- src/tests/slave_tests.cpp | 13 +++-- 21 files changed, 190 insertions(+), 144 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/include/mesos/mesos.proto ---------------------------------------------------------------------- diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto index 9e4c669..ddb9d36 100644 --- a/include/mesos/mesos.proto +++ b/include/mesos/mesos.proto @@ -2249,6 +2249,14 @@ message TaskResourceLimitation { /** + * Describes a UUID. + */ +message UUID { + required bytes value = 1; +} + + +/** * Describes an offer operation, similar to `Offer.Operation`, with * some additional information. */ @@ -2266,7 +2274,7 @@ message OfferOperation { // This is the internal UUID for the operation, which is kept // independently from the framework-specified operation ID, which is // optional. - required bytes operation_uuid = 6; + required UUID operation_uuid = 6; } @@ -2311,7 +2319,7 @@ message OfferOperationStatus { // Statuses that are delivered reliably to the scheduler will // include a `status_uuid`. The status is considered delivered once // it is acknowledged by the scheduler. - optional bytes status_uuid = 5; + optional UUID status_uuid = 5; } http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/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 7ec6936..4534049 100644 --- a/include/mesos/resource_provider/resource_provider.proto +++ b/include/mesos/resource_provider/resource_provider.proto @@ -54,7 +54,7 @@ message Event { // This is the internal UUID for the operation, which is kept // independently from the framework-specified operation ID, which // is optional. - required bytes operation_uuid = 3; + required UUID operation_uuid = 3; // Used to establish the relationship between the operation and // the resources that the operation is operating on. Each resource @@ -68,13 +68,13 @@ message Event { // that it maintains, because this means the operation is // operating on resources that might have already been // invalidated. - required bytes resource_version_uuid = 4; + required UUID resource_version_uuid = 4; } // Received when the master wants to launch a task using resources // of this resource provider. message PublishResources { - required bytes uuid = 1; + required UUID uuid = 1; repeated Resource resources = 2; } @@ -82,10 +82,10 @@ message Event { // 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; + required UUID status_uuid = 1; // The UUID from the relevant `OfferOperation`. - required bytes operation_uuid = 2; + required UUID operation_uuid = 2; } // Received when the resource provider manager wants to reconcile its view of @@ -93,7 +93,7 @@ message Event { // generate offer operation status updates for any operation UUIDs in this // message which are unknown to the resource provider. message ReconcileOfferOperations { - repeated bytes operation_uuids = 1; + repeated UUID operation_uuids = 1; } optional Type type = 1; @@ -133,7 +133,7 @@ message Call { // This is the internal UUID for the operation, which is kept // independently from the framework-specified operation ID, which // is optional. - required bytes operation_uuid = 4; + required UUID operation_uuid = 4; } // Notify the master about the total resources and pending operations. @@ -157,7 +157,7 @@ message Call { // that it maintains, because this means the operation is // operating on resources that might have already been // invalidated. - required bytes resource_version_uuid = 3; + required UUID resource_version_uuid = 3; } message UpdatePublishResourcesStatus { @@ -167,7 +167,7 @@ message Call { FAILED = 2; } - required bytes uuid = 1; + required UUID uuid = 1; required Status status = 2; } http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/include/mesos/type_utils.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp index 1bcc521..4d012cc 100644 --- a/include/mesos/type_utils.hpp +++ b/include/mesos/type_utils.hpp @@ -81,6 +81,7 @@ bool operator==(const TaskGroupInfo& left, const TaskGroupInfo& right); bool operator==(const TaskInfo& left, const TaskInfo& right); bool operator==(const TaskStatus& left, const TaskStatus& right); bool operator==(const URL& left, const URL& right); +bool operator==(const UUID& left, const UUID& right); bool operator==(const Volume& left, const Volume& right); bool operator!=(const CheckStatusInfo& left, const CheckStatusInfo& right); @@ -300,6 +301,12 @@ inline bool operator!=(const TimeInfo& left, const TimeInfo& right) } +inline bool operator!=(const UUID& left, const UUID& right) +{ + return !(left == right); +} + + inline bool operator!=(const DurationInfo& left, const DurationInfo& right) { return !(left == right); @@ -441,6 +448,11 @@ std::ostream& operator<<(std::ostream& stream, const TaskInfo& task); std::ostream& operator<<(std::ostream& stream, const TaskState& state); +std::ostream& operator<<( + std::ostream& stream, + const UUID& uuid); + + std::ostream& operator<<(std::ostream& stream, const CheckInfo::Type& type); http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/include/mesos/v1/mesos.proto ---------------------------------------------------------------------- diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto index f1649bb..3090793 100644 --- a/include/mesos/v1/mesos.proto +++ b/include/mesos/v1/mesos.proto @@ -2230,6 +2230,14 @@ message TaskResourceLimitation { /** + * Describes a UUID. + */ +message UUID { + required bytes value = 1; +} + + +/** * Describes an offer operation, similar to `Offer.Operation`, with * some additional information. */ @@ -2247,7 +2255,7 @@ message OfferOperation { // This is the internal UUID for the operation, which is kept // independently from the framework-specified operation ID, which is // optional. - required bytes operation_uuid = 6; + required UUID operation_uuid = 6; } @@ -2292,7 +2300,7 @@ message OfferOperationStatus { // Statuses that are delivered reliably to the scheduler will // include a `status_uuid`. The status is considered delivered once // it is acknowledged by the scheduler. - optional bytes status_uuid = 5; + optional UUID status_uuid = 5; } http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/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 31e8954..beb9f17 100644 --- a/include/mesos/v1/resource_provider/resource_provider.proto +++ b/include/mesos/v1/resource_provider/resource_provider.proto @@ -54,7 +54,7 @@ message Event { // This is the internal UUID for the operation, which is kept // independently from the framework specified operation id, which is // optional. - required bytes operation_uuid = 3; + required UUID operation_uuid = 3; // Used to establish the relationship between the operation and // the resources that the operation is operating on. Each resource @@ -68,13 +68,13 @@ message Event { // that it maintains, because this means the operation is // operating on resources that might have already been // invalidated. - required bytes resource_version_uuid = 4; + required UUID resource_version_uuid = 4; } // Received when the master wants to launch a task using resources // of this resource provider. message PublishResources { - required bytes uuid = 1; + required UUID uuid = 1; repeated Resource resources = 2; } @@ -82,10 +82,10 @@ message Event { // 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; + required UUID status_uuid = 1; // The UUID from the relevant `OfferOperation`. - required bytes operation_uuid = 2; + required UUID operation_uuid = 2; } // Received when the resource provider manager wants to reconcile its view of @@ -93,7 +93,7 @@ message Event { // generate offer operation status updates for any operation UUIDs in this // message which are unknown to the resource provider. message ReconcileOfferOperations { - repeated bytes operation_uuids = 1; + repeated UUID operation_uuids = 1; } optional Type type = 1; @@ -133,7 +133,7 @@ message Call { // This is the internal UUID for the operation, which is kept // independently from the framework specified operation id, which is // optional. - required bytes operation_uuid = 4; + required UUID operation_uuid = 4; } // Notify the master about the total resources and pending operations. @@ -157,7 +157,7 @@ message Call { // that it maintains, because this means the operation is // operating on resources that might have already been // invalidated. - required bytes resource_version_uuid = 3; + required UUID resource_version_uuid = 3; } message UpdatePublishResourcesStatus { @@ -167,7 +167,7 @@ message Call { FAILED = 2; } - required bytes uuid = 1; + required UUID uuid = 1; required Status status = 2; } http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/common/protobuf_utils.cpp ---------------------------------------------------------------------- diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp index 3bd5bae..f4380e9 100644 --- a/src/common/protobuf_utils.cpp +++ b/src/common/protobuf_utils.cpp @@ -438,7 +438,7 @@ OfferOperationStatus createOfferOperationStatus( } if (statusUUID.isSome()) { - status.set_status_uuid(statusUUID->toBytes()); + status.mutable_status_uuid()->set_value(statusUUID->toBytes()); } return status; @@ -462,9 +462,9 @@ OfferOperation createOfferOperation( operation.mutable_info()->CopyFrom(info); operation.mutable_latest_status()->CopyFrom(latestStatus); if (operationUUID.isSome()) { - operation.set_operation_uuid(operationUUID->toBytes()); + operation.mutable_operation_uuid()->set_value(operationUUID->toBytes()); } else { - operation.set_operation_uuid(id::UUID::random().toBytes()); + operation.mutable_operation_uuid()->set_value(id::UUID::random().toBytes()); } return operation; @@ -489,7 +489,7 @@ OfferOperationStatusUpdate createOfferOperationStatusUpdate( if (latestStatus.isSome()) { update.mutable_latest_status()->CopyFrom(latestStatus.get()); } - update.set_operation_uuid(operationUUID.toBytes()); + update.mutable_operation_uuid()->set_value(operationUUID.toBytes()); return update; } @@ -869,7 +869,7 @@ RepeatedPtrField<ResourceVersionUUID> createResourceVersions( if (resourceProviderId.isSome()) { entry->mutable_resource_provider_id()->CopyFrom(resourceProviderId.get()); } - entry->set_uuid(uuid.toBytes()); + entry->mutable_uuid()->set_value(uuid.toBytes()); } return result; @@ -891,7 +891,8 @@ hashmap<Option<ResourceProviderID>, id::UUID> parseResourceVersions( CHECK(!result.contains(resourceProviderId)); - const Try<id::UUID> uuid = id::UUID::fromBytes(resourceVersionUUID.uuid()); + const Try<id::UUID> uuid = + id::UUID::fromBytes(resourceVersionUUID.uuid().value()); CHECK_SOME(uuid); result.insert({std::move(resourceProviderId), std::move(uuid.get())}); http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/common/type_utils.cpp ---------------------------------------------------------------------- diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp index 65586a5..2ba5302 100644 --- a/src/common/type_utils.cpp +++ b/src/common/type_utils.cpp @@ -196,6 +196,12 @@ bool operator==(const URL& left, const URL& right) } +bool operator==(const UUID& left, const UUID& right) +{ + return left.value() == right.value(); +} + + bool operator==( const ContainerInfo::DockerInfo::PortMapping& left, const ContainerInfo::DockerInfo::PortMapping& right) @@ -792,6 +798,17 @@ ostream& operator<<(ostream& stream, const TaskState& state) } +ostream& operator<<(ostream& stream, const UUID& uuid) +{ + Try<id::UUID> _uuid = id::UUID::fromBytes(uuid.value()); + if (_uuid.isError()) { + return stream << "INVALID UUID"; + } + + return stream << _uuid->toString(); +} + + ostream& operator<<(ostream& stream, const CheckInfo::Type& type) { return stream << CheckInfo::Type_Name(type); http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index a8353ab..e082da8 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -6300,7 +6300,7 @@ void Master::__registerSlave( Option<id::UUID> resourceVersion; if (registerSlaveMessage.has_resource_version_uuid()) { Try<id::UUID> uuid = id::UUID::fromBytes( - registerSlaveMessage.resource_version_uuid()); + registerSlaveMessage.resource_version_uuid().value()); CHECK_SOME(uuid); resourceVersion = uuid.get(); @@ -6853,7 +6853,7 @@ void Master::__reregisterSlave( Option<id::UUID> resourceVersion; if (reregisterSlaveMessage.has_resource_version_uuid()) { Try<id::UUID> uuid = id::UUID::fromBytes( - reregisterSlaveMessage.resource_version_uuid()); + reregisterSlaveMessage.resource_version_uuid().value()); CHECK_SOME(uuid); resourceVersion = uuid.get(); @@ -6997,7 +6997,7 @@ void Master::___reregisterSlave( Option<id::UUID> resourceVersion; if (reregisterSlaveMessage.has_resource_version_uuid()) { Try<id::UUID> uuid = id::UUID::fromBytes( - reregisterSlaveMessage.resource_version_uuid()); + reregisterSlaveMessage.resource_version_uuid().value()); CHECK_SOME(uuid); resourceVersion = uuid.get(); @@ -7302,7 +7302,7 @@ void Master::updateSlave(UpdateSlaveMessage&& message) hashmap<Option<ResourceProviderID>, id::UUID> resourceVersions; const Try<id::UUID> slaveResourceVersion = - id::UUID::fromBytes(message.resource_version_uuid()); + id::UUID::fromBytes(message.resource_version_uuid().value()); CHECK_SOME(slaveResourceVersion); resourceVersions.insert({None(), slaveResourceVersion.get()}); @@ -7315,7 +7315,7 @@ void Master::updateSlave(UpdateSlaveMessage&& message) } Try<id::UUID> resourceVersion = - id::UUID::fromBytes(resourceProvider.resource_version_uuid()); + id::UUID::fromBytes(resourceProvider.resource_version_uuid().value()); CHECK_SOME(resourceVersion); @@ -7340,7 +7340,7 @@ void Master::updateSlave(UpdateSlaveMessage&& message) const OfferOperation& operation, message.offer_operations().operations()) { Try<id::UUID> operationUuid = - id::UUID::fromBytes(operation.operation_uuid()); + id::UUID::fromBytes(operation.operation_uuid().value()); CHECK_SOME(operationUuid); receivedOfferOperations.insert(operationUuid.get()); } @@ -7353,7 +7353,7 @@ void Master::updateSlave(UpdateSlaveMessage&& message) const OfferOperation& operation, resourceProvider.operations().operations()) { Try<id::UUID> operationUuid = - id::UUID::fromBytes(operation.operation_uuid()); + id::UUID::fromBytes(operation.operation_uuid().value()); CHECK_SOME(operationUuid); receivedOfferOperations.insert(operationUuid.get()); } @@ -7448,7 +7448,8 @@ void Master::updateSlave(UpdateSlaveMessage&& message) foreach ( const OfferOperation& operation, message.offer_operations().operations()) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation.operation_uuid()); + Try<id::UUID> uuid = + id::UUID::fromBytes(operation.operation_uuid().value()); CHECK_SOME(uuid) << "Could not deserialize operation id when reconciling " "offer operations"; @@ -7477,7 +7478,8 @@ void Master::updateSlave(UpdateSlaveMessage&& message) foreach ( const OfferOperation& operation, resourceProvider.operations().operations()) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation.operation_uuid()); + Try<id::UUID> uuid = + id::UUID::fromBytes(operation.operation_uuid().value()); CHECK_SOME(uuid) << "Could not deserialize operation id when reconciling " "offer operations"; @@ -7660,7 +7662,8 @@ void Master::updateSlave(UpdateSlaveMessage&& message) ReconcileOfferOperationsMessage::Operation* reconcileOperation = reconcile.add_operations(); - reconcileOperation->set_operation_uuid(uuid.toBytes()); + reconcileOperation->mutable_operation_uuid()->set_value( + uuid.toBytes()); if (providerId.isSome()) { reconcileOperation->mutable_resource_provider_id() @@ -7942,7 +7945,7 @@ void Master::offerOperationStatusUpdate( ? update.framework_id() : Option<FrameworkID>::none(); - Try<id::UUID> uuid = id::UUID::fromBytes(update.operation_uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(update.operation_uuid().value()); if (uuid.isError()) { LOG(ERROR) << "Failed to parse offer operation UUID for operation " << "'" << update.status().operation_id() << "' for " @@ -8023,9 +8026,10 @@ void Master::offerOperationStatusUpdate( CHECK_SOME(resourceProviderId); OfferOperationUpdateAcknowledgementMessage acknowledgement; - acknowledgement.set_status_uuid( + acknowledgement.mutable_status_uuid()->CopyFrom( operation->statuses(operation->statuses_size() - 1).status_uuid()); - acknowledgement.set_operation_uuid(operation->operation_uuid()); + acknowledgement.mutable_operation_uuid()->CopyFrom( + operation->operation_uuid()); acknowledgement.mutable_resource_provider_id() ->CopyFrom(resourceProviderId.get()); @@ -10358,11 +10362,8 @@ void Master::updateOfferOperation( operation->add_statuses()->CopyFrom(status); - Try<id::UUID> uuid = id::UUID::fromBytes(update.operation_uuid()); - CHECK_SOME(uuid); - LOG(INFO) << "Updating the state of offer operation '" - << operation->info().id() << "' (uuid: " << uuid->toString() + << operation->info().id() << "' (uuid: " << update.operation_uuid() << ") of framework " << operation->framework_id() << " (latest state: " << operation->latest_status().state() << ", status update state: " << status.state() << ")"; @@ -10563,22 +10564,19 @@ void Master::_apply( message.mutable_framework_id()->CopyFrom(framework->id()); } message.mutable_operation_info()->CopyFrom(offerOperation->info()); - message.set_operation_uuid(offerOperation->operation_uuid()); + message.mutable_operation_uuid()->CopyFrom( + offerOperation->operation_uuid()); if (resourceProviderId.isSome()) { message.mutable_resource_version_uuid() ->mutable_resource_provider_id() ->CopyFrom(resourceProviderId.get()); } - message.mutable_resource_version_uuid() - ->set_uuid(resourceVersion->toBytes()); - - Try<id::UUID> operationUUID = - id::UUID::fromBytes(offerOperation->operation_uuid()); - CHECK_SOME(operationUUID); + message.mutable_resource_version_uuid()->mutable_uuid()->set_value( + resourceVersion->toBytes()); LOG(INFO) << "Sending offer operation '" << offerOperation->info().id() - << "' (uuid: " << operationUUID->toString() + << "' (uuid: " << offerOperation->operation_uuid() << ") to agent " << *slave; send(slave->pid, message); @@ -11482,7 +11480,7 @@ void Slave::removeTask(Task* task) void Slave::addOfferOperation(OfferOperation* operation) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid().value()); CHECK_SOME(uuid); offerOperations.put(uuid.get(), operation); @@ -11533,7 +11531,7 @@ void Slave::recoverResources(OfferOperation* operation) void Slave::removeOfferOperation(OfferOperation* operation) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid().value()); CHECK_SOME(uuid); CHECK(offerOperations.contains(uuid.get())) http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/master/master.hpp ---------------------------------------------------------------------- diff --git a/src/master/master.hpp b/src/master/master.hpp index 004be71..b800cda 100644 --- a/src/master/master.hpp +++ b/src/master/master.hpp @@ -2462,7 +2462,8 @@ struct Framework const FrameworkID& frameworkId = operation->framework_id(); - Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid()); + Try<id::UUID> uuid = + id::UUID::fromBytes(operation->operation_uuid().value()); CHECK_SOME(uuid); CHECK(!offerOperations.contains(uuid.get())) @@ -2549,7 +2550,8 @@ struct Framework void removeOfferOperation(OfferOperation* operation) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid()); + Try<id::UUID> uuid = + id::UUID::fromBytes(operation->operation_uuid().value()); CHECK_SOME(uuid); CHECK(offerOperations.contains(uuid.get())) http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/messages/messages.cpp ---------------------------------------------------------------------- diff --git a/src/messages/messages.cpp b/src/messages/messages.cpp index 9efbe7f..ac8f6c3 100644 --- a/src/messages/messages.cpp +++ b/src/messages/messages.cpp @@ -129,14 +129,12 @@ ostream& operator<<(ostream& stream, const OfferOperationStatusUpdate& update) stream << update.status().state(); if (update.status().has_status_uuid()) { - stream << " (Status UUID: " - << stringify( - id::UUID::fromBytes(update.status().status_uuid()).get()) + stream << " (Status UUID: " << stringify(update.status().status_uuid()) << ")"; } stream << " for operation UUID " - << stringify(id::UUID::fromBytes(update.operation_uuid()).get()); + << stringify(update.operation_uuid()); if (update.status().has_operation_id()) { stream << " (framework-supplied ID '" << update.status().operation_id() http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/messages/messages.proto ---------------------------------------------------------------------- diff --git a/src/messages/messages.proto b/src/messages/messages.proto index b8eb8fa..baefbe9 100644 --- a/src/messages/messages.proto +++ b/src/messages/messages.proto @@ -410,10 +410,10 @@ message StatusUpdateAcknowledgementMessage { */ message OfferOperationUpdateAcknowledgementMessage { // The UUID from the `OfferOperationStatus` being acknowledged. - required bytes status_uuid = 1; + required UUID status_uuid = 1; // The UUID from the relevant `OfferOperation`. - required bytes operation_uuid = 2; + required UUID operation_uuid = 2; optional ResourceProviderID resource_provider_id = 3; } @@ -466,7 +466,7 @@ message ReconcileTasksMessage { */ message ReconcileOfferOperationsMessage { message Operation { - required bytes operation_uuid = 1; + required UUID operation_uuid = 1; optional ResourceProviderID resource_provider_id = 2; } @@ -526,7 +526,7 @@ message RegisterSlaveMessage { // different resource version UUID than that it maintains, because // this means the operation is operating on resources that might // have already been invalidated. - optional bytes resource_version_uuid = 5; + optional UUID resource_version_uuid = 5; } @@ -585,7 +585,7 @@ message ReregisterSlaveMessage { // different resource version UUID than that it maintains, because // this means the operation is operating on resources that might // have already been invalidated. - optional bytes resource_version_uuid = 10; + optional UUID resource_version_uuid = 10; } @@ -704,7 +704,7 @@ message ResourceVersionUUID { // If not set, it represents resources directly from the agent (not // having a backing resource provider). optional ResourceProviderID resource_provider_id = 1; - required bytes uuid = 2; + required UUID uuid = 2; } @@ -752,14 +752,14 @@ message UpdateSlaveMessage { // should reject operations that have a different resource version // UUID than that it maintains, because this means the operation is // operating on resources that might have already been invalidated. - optional bytes resource_version_uuid = 7; + optional UUID resource_version_uuid = 7; // Describes an agent-local resource provider. message ResourceProvider { optional ResourceProviderInfo info = 1; repeated Resource total_resources = 2; required OfferOperations operations = 3; - required bytes resource_version_uuid = 4; + required UUID resource_version_uuid = 4; } message ResourceProviders { @@ -788,7 +788,7 @@ message OfferOperationStatusUpdate { // This is the internal UUID for the operation, which is kept // independently from the framework-specified operation ID, which is // optional. - required bytes operation_uuid = 5; + required UUID operation_uuid = 5; } @@ -809,7 +809,7 @@ message OfferOperationStatusUpdateRecord { optional OfferOperationStatusUpdate update = 2; // Required if type == ACK. - optional bytes uuid = 3; + optional UUID uuid = 3; } @@ -828,7 +828,7 @@ message ApplyOfferOperationMessage { // This is the internal UUID for the operation, which is kept // independently from the framework-specified operation ID, which is // optional. - required bytes operation_uuid = 3; + required UUID operation_uuid = 3; // Used to establish the relationship between the operation and the // resources that the operation is operating on. Each resource @@ -857,7 +857,7 @@ message ResourceProviderCallMessage { // resource provider ID hasn't been assigned yet. This 'uuid' will // be echoed back in the corresponding 'Subscribed' Event, allowing // the agent to tell which resource provider the Event is for. - optional bytes uuid = 2; + optional UUID uuid = 2; } @@ -871,7 +871,7 @@ message ResourceProviderEventMessage { required resource_provider.Event event = 2; // See the comments in 'ResourceProviderCallMessage'. - optional bytes uuid = 3; + optional UUID uuid = 3; } http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/resource_provider/manager.cpp ---------------------------------------------------------------------- diff --git a/src/resource_provider/manager.cpp b/src/resource_provider/manager.cpp index d9e0d25..2a167aa 100644 --- a/src/resource_provider/manager.cpp +++ b/src/resource_provider/manager.cpp @@ -349,21 +349,14 @@ void ResourceProviderManagerProcess::applyOfferOperation( { const Offer::Operation& operation = message.operation_info(); const FrameworkID& frameworkId = message.framework_id(); - - Try<id::UUID> uuid = id::UUID::fromBytes(message.operation_uuid()); - if (uuid.isError()) { - LOG(ERROR) << "Failed to parse offer operation UUID for operation " - << "'" << operation.id() << "' from framework " - << frameworkId << ": " << uuid.error(); - return; - } + const UUID& operationUUID = message.operation_uuid(); Result<ResourceProviderID> resourceProviderId = getResourceProviderId(operation); if (!resourceProviderId.isSome()) { LOG(ERROR) << "Failed to get the resource provider ID of operation " - << "'" << operation.id() << "' (uuid: " << uuid->toString() + << "'" << operation.id() << "' (uuid: " << operationUUID << ") from framework " << frameworkId << ": " << (resourceProviderId.isError() ? resourceProviderId.error() : "Not found"); @@ -372,7 +365,7 @@ void ResourceProviderManagerProcess::applyOfferOperation( if (!resourceProviders.subscribed.contains(resourceProviderId.get())) { LOG(WARNING) << "Dropping operation '" << operation.id() << "' (uuid: " - << uuid.get() << ") from framework " << frameworkId + << operationUUID << ") from framework " << frameworkId << " because resource provider " << resourceProviderId.get() << " is not subscribed"; return; @@ -396,13 +389,14 @@ void ResourceProviderManagerProcess::applyOfferOperation( ->mutable_framework_id()->CopyFrom(frameworkId); event.mutable_apply_offer_operation()->mutable_info()->CopyFrom(operation); event.mutable_apply_offer_operation() - ->set_operation_uuid(message.operation_uuid()); - event.mutable_apply_offer_operation()->set_resource_version_uuid( - message.resource_version_uuid().uuid()); + ->mutable_operation_uuid()->CopyFrom(message.operation_uuid()); + event.mutable_apply_offer_operation() + ->mutable_resource_version_uuid() + ->CopyFrom(message.resource_version_uuid().uuid()); if (!resourceProvider->http.send(event)) { LOG(WARNING) << "Failed to send operation '" << operation.id() << "' " - << "(uuid: " << uuid.get() << ") from framework " + << "(uuid: " << operationUUID << ") from framework " << frameworkId << " to resource provider " << resourceProviderId.get() << ": connection closed"; } @@ -429,9 +423,11 @@ void ResourceProviderManagerProcess::acknowledgeOfferOperationUpdate( Event event; event.set_type(Event::ACKNOWLEDGE_OFFER_OPERATION); event.mutable_acknowledge_offer_operation() - ->set_status_uuid(message.status_uuid()); + ->mutable_status_uuid() + ->CopyFrom(message.status_uuid()); event.mutable_acknowledge_offer_operation() - ->set_operation_uuid(message.operation_uuid()); + ->mutable_operation_uuid() + ->CopyFrom(message.operation_uuid()); if (!resourceProvider.http.send(event)) { LOG(WARNING) << "Failed to send offer operation update acknowledgement with" @@ -455,12 +451,12 @@ void ResourceProviderManagerProcess::reconcileOfferOperations( if (events.contains(resourceProviderId)) { events.at(resourceProviderId).mutable_reconcile_offer_operations() - ->add_operation_uuids(operation.operation_uuid()); + ->add_operation_uuids()->CopyFrom(operation.operation_uuid()); } else { Event event; event.set_type(Event::RECONCILE_OFFER_OPERATIONS); event.mutable_reconcile_offer_operations() - ->add_operation_uuids(operation.operation_uuid()); + ->add_operation_uuids()->CopyFrom(operation.operation_uuid()); events[resourceProviderId] = event; } @@ -538,7 +534,8 @@ Future<Nothing> ResourceProviderManagerProcess::publishResources( Event event; event.set_type(Event::PUBLISH_RESOURCES); - event.mutable_publish_resources()->set_uuid(uuid.toBytes()); + event.mutable_publish_resources() + ->mutable_uuid()->set_value(uuid.toBytes()); event.mutable_publish_resources()->mutable_resources()->CopyFrom(resources); ResourceProvider* resourceProvider = @@ -633,7 +630,7 @@ void ResourceProviderManagerProcess::updateOfferOperationStatus( ResourceProviderMessage::UpdateOfferOperationStatus body; body.update.mutable_framework_id()->CopyFrom(update.framework_id()); body.update.mutable_status()->CopyFrom(update.status()); - body.update.set_operation_uuid(update.operation_uuid()); + body.update.mutable_operation_uuid()->CopyFrom(update.operation_uuid()); if (update.has_latest_status()) { body.update.mutable_latest_status()->CopyFrom(update.latest_status()); } @@ -657,7 +654,7 @@ void ResourceProviderManagerProcess::updateState( // TODO(chhsiao): Report pending operations. Try<id::UUID> resourceVersion = - id::UUID::fromBytes(update.resource_version_uuid()); + id::UUID::fromBytes(update.resource_version_uuid().value()); CHECK_SOME(resourceVersion) << "Could not deserialize version of resource provider " @@ -665,7 +662,8 @@ void ResourceProviderManagerProcess::updateState( hashmap<id::UUID, OfferOperation> offerOperations; foreach (const OfferOperation &operation, update.operations()) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation.operation_uuid()); + Try<id::UUID> uuid = + id::UUID::fromBytes(operation.operation_uuid().value()); CHECK_SOME(uuid); offerOperations.put(uuid.get(), operation); @@ -693,7 +691,7 @@ void ResourceProviderManagerProcess::updatePublishResourcesStatus( ResourceProvider* resourceProvider, const Call::UpdatePublishResourcesStatus& update) { - Try<id::UUID> uuid = id::UUID::fromBytes(update.uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(update.uuid().value()); if (uuid.isError()) { LOG(ERROR) << "Invalid UUID in UpdatePublishResourcesStatus from resource" << " provider " << resourceProvider->info.id() http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/resource_provider/message.hpp ---------------------------------------------------------------------- diff --git a/src/resource_provider/message.hpp b/src/resource_provider/message.hpp index bac3ffb..6236693 100644 --- a/src/resource_provider/message.hpp +++ b/src/resource_provider/message.hpp @@ -95,12 +95,9 @@ inline std::ostream& operator<<( CHECK_SOME(updateOfferOperationStatus); - Try<id::UUID> operationUUID = id::UUID::fromBytes( - updateOfferOperationStatus->update.operation_uuid()); - CHECK_SOME(operationUUID); - return stream - << "UPDATE_OFFER_OPERATION_STATUS: (uuid: " << operationUUID.get() + << "UPDATE_OFFER_OPERATION_STATUS: (uuid: " + << updateOfferOperationStatus->update.operation_uuid() << ") for framework " << updateOfferOperationStatus->update.framework_id() << " (latest state: " http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index ba9f1f8..9d0e9de 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -1543,7 +1543,8 @@ void Slave::doReliableRegistration(Duration maxBackoff) // Include checkpointed resources. message.mutable_checkpointed_resources()->CopyFrom(checkpointedResources_); - message.set_resource_version_uuid(resourceVersion.toBytes()); + message.mutable_resource_version_uuid()->set_value( + resourceVersion.toBytes()); send(master.get(), message); } else { @@ -1557,7 +1558,8 @@ void Slave::doReliableRegistration(Duration maxBackoff) // Include checkpointed resources. message.mutable_checkpointed_resources()->CopyFrom(checkpointedResources_); - message.set_resource_version_uuid(resourceVersion.toBytes()); + message.mutable_resource_version_uuid()->set_value( + resourceVersion.toBytes()); message.mutable_slave()->CopyFrom(slaveInfo); @@ -3807,7 +3809,7 @@ void Slave::applyOfferOperation(const ApplyOfferOperationMessage& message) ? message.framework_id() : Option<FrameworkID>::none(); - Try<id::UUID> uuid = id::UUID::fromBytes(message.operation_uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(message.operation_uuid().value()); if (uuid.isError()) { LOG(ERROR) << "Failed to parse offer operation UUID for operation " << "'" << message.operation_info().id() << "' from " @@ -3906,7 +3908,7 @@ void Slave::reconcileOfferOperations( } Try<id::UUID> operationUuid = - id::UUID::fromBytes(operation.operation_uuid()); + id::UUID::fromBytes(operation.operation_uuid().value()); CHECK_SOME(operationUuid); // The master reconciles when it notices that an operation is missing from @@ -3991,7 +3993,7 @@ void Slave::offerOperationUpdateAcknowledgement( const OfferOperationUpdateAcknowledgementMessage& acknowledgement) { Try<id::UUID> operationUuid = - id::UUID::fromBytes(acknowledgement.operation_uuid()); + id::UUID::fromBytes(acknowledgement.operation_uuid().value()); CHECK_SOME(operationUuid); OfferOperation* operation = getOfferOperation(operationUuid.get()); @@ -7022,7 +7024,7 @@ UpdateSlaveMessage Slave::generateResourceProviderUpdate() const UpdateSlaveMessage message; message.mutable_slave_id()->CopyFrom(info.id()); message.set_update_oversubscribed_resources(false); - message.set_resource_version_uuid(resourceVersion.toBytes()); + message.mutable_resource_version_uuid()->set_value(resourceVersion.toBytes()); message.mutable_offer_operations(); foreachvalue (const OfferOperation* operation, offerOperations) { @@ -7043,7 +7045,7 @@ UpdateSlaveMessage Slave::generateResourceProviderUpdate() const resourceProvider->info); provider->mutable_total_resources()->CopyFrom( resourceProvider->totalResources); - provider->set_resource_version_uuid( + provider->mutable_resource_version_uuid()->set_value( resourceProvider->resourceVersion.toBytes()); provider->mutable_operations(); @@ -7228,7 +7230,7 @@ void Slave::handleResourceProviderMessage( message->updateOfferOperationStatus->update; Try<id::UUID> operationUUID = - id::UUID::fromBytes(update.operation_uuid()); + id::UUID::fromBytes(update.operation_uuid().value()); CHECK_SOME(operationUUID); OfferOperation* operation = getOfferOperation(operationUUID.get()); @@ -7352,7 +7354,7 @@ void Slave::handleResourceProviderMessage( void Slave::addOfferOperation(OfferOperation* operation) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid().value()); CHECK_SOME(uuid); offerOperations.put(uuid.get(), operation); @@ -7430,13 +7432,9 @@ void Slave::updateOfferOperation( operation->add_statuses()->CopyFrom(status); } - Try<id::UUID> operationUUID = - id::UUID::fromBytes(operation->operation_uuid()); - CHECK_SOME(operationUUID); - LOG(INFO) << "Updating the state of offer operation '" << operation->info().id() - << "' (uuid: " << operationUUID.get() + << "' (uuid: " << operation->operation_uuid() << ") of framework " << operation->framework_id() << " (latest state: " << operation->latest_status().state() << ", status update state: " << status.state() << ")"; @@ -7491,7 +7489,7 @@ void Slave::updateOfferOperation( void Slave::removeOfferOperation(OfferOperation* operation) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid().value()); CHECK_SOME(uuid); Result<ResourceProviderID> resourceProviderId = @@ -9167,7 +9165,7 @@ Resources Executor::allocatedResources() const void ResourceProvider::addOfferOperation(OfferOperation* operation) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid().value()); CHECK_SOME(uuid); CHECK(!offerOperations.contains(uuid.get())) @@ -9179,7 +9177,7 @@ void ResourceProvider::addOfferOperation(OfferOperation* operation) void ResourceProvider::removeOfferOperation(OfferOperation* operation) { - Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid()); + Try<id::UUID> uuid = id::UUID::fromBytes(operation->operation_uuid().value()); CHECK_SOME(uuid); CHECK(offerOperations.contains(uuid.get())) http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/status_update_manager/offer_operation.cpp ---------------------------------------------------------------------- diff --git a/src/status_update_manager/offer_operation.cpp b/src/status_update_manager/offer_operation.cpp index f27571f..9df4973 100644 --- a/src/status_update_manager/offer_operation.cpp +++ b/src/status_update_manager/offer_operation.cpp @@ -72,7 +72,8 @@ Future<Nothing> OfferOperationStatusUpdateManager::update( const OfferOperationStatusUpdate& update, bool checkpoint) { - Try<id::UUID> operationUuid = id::UUID::fromBytes(update.operation_uuid()); + Try<id::UUID> operationUuid = + id::UUID::fromBytes(update.operation_uuid().value()); CHECK_SOME(operationUuid); return dispatch( http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/status_update_manager/status_update_manager_process.hpp ---------------------------------------------------------------------- diff --git a/src/status_update_manager/status_update_manager_process.hpp b/src/status_update_manager/status_update_manager_process.hpp index 6953852..e575d8c 100644 --- a/src/status_update_manager/status_update_manager_process.hpp +++ b/src/status_update_manager/status_update_manager_process.hpp @@ -702,7 +702,7 @@ private: if (update.isNone()) { return Error( "Unexpected " + statusUpdateType + " acknowledgment" - " (UUID: " + id::UUID::fromBytes(record->uuid())->toString() + + " (UUID: " + stringify(record->uuid()) + ") for stream " + stringify(streamId)); } stream->_handle(update.get(), record->type()); @@ -785,7 +785,7 @@ private: return Error("Status update is missing 'status_uuid'"); } Try<id::UUID> statusUuid = - id::UUID::fromBytes(update.status().status_uuid()); + id::UUID::fromBytes(update.status().status_uuid().value()); CHECK_SOME(statusUuid); // Check that this status update has not already been acknowledged. @@ -849,7 +849,7 @@ private: // make the `TaskStatusUpdateManager` use this process, we should avoid // depending on identical field names. Try<id::UUID> updateStatusUuid = - id::UUID::fromBytes(update.status().status_uuid()); + id::UUID::fromBytes(update.status().status_uuid().value()); CHECK_SOME(updateStatusUuid); // This might happen if we retried a status update and got back @@ -940,7 +940,7 @@ private: // field containing the status update uuid has a different name. // In order to make the `TaskStatusUpdateManager` use this process, // we should avoid depending on identical field names. - record.set_uuid(update.status().status_uuid()); + record.mutable_uuid()->CopyFrom(update.status().status_uuid()); break; } @@ -971,7 +971,7 @@ private: // make the `TaskStatusUpdateManager` use this process, we should avoid // depending on identical field names. Try<id::UUID> statusUuid = - id::UUID::fromBytes(update.status().status_uuid()); + id::UUID::fromBytes(update.status().status_uuid().value()); CHECK_SOME(statusUuid); switch (type) { http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 821cce3..6207d62 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -2996,7 +2996,8 @@ public: typename Call::UpdateState* update = call.mutable_update_state(); update->mutable_resources()->CopyFrom(injected); - update->set_resource_version_uuid(id::UUID::random().toBytes()); + update->mutable_resource_version_uuid()->set_value( + id::UUID::random().toBytes()); driver->send(call); } @@ -3013,7 +3014,7 @@ public: typename Call::UpdateOfferOperationStatus* update = call.mutable_update_offer_operation_status(); update->mutable_framework_id()->CopyFrom(operation.framework_id()); - update->set_operation_uuid(operation.operation_uuid()); + update->mutable_operation_uuid()->CopyFrom(operation.operation_uuid()); update->mutable_status()->set_state( OfferOperationState::OFFER_OPERATION_FINISHED); @@ -3089,7 +3090,7 @@ public: typename Call::UpdatePublishResourcesStatus* update = call.mutable_update_publish_resources_status(); - update->set_uuid(publish.uuid()); + update->mutable_uuid()->CopyFrom(publish.uuid()); update->set_status(Call::UpdatePublishResourcesStatus::OK); driver->send(call); http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/tests/offer_operation_status_update_manager_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/offer_operation_status_update_manager_tests.cpp b/src/tests/offer_operation_status_update_manager_tests.cpp index 4c92e86..cb71bc1 100644 --- a/src/tests/offer_operation_status_update_manager_tests.cpp +++ b/src/tests/offer_operation_status_update_manager_tests.cpp @@ -95,7 +95,7 @@ protected: { OfferOperationStatusUpdate statusUpdate; - statusUpdate.set_operation_uuid(operationUuid.toBytes()); + statusUpdate.mutable_operation_uuid()->set_value(operationUuid.toBytes()); if (frameworkId.isSome()) { statusUpdate.mutable_framework_id()->CopyFrom(frameworkId.get()); @@ -103,7 +103,7 @@ protected: OfferOperationStatus* status = statusUpdate.mutable_status(); status->set_state(state); - status->set_status_uuid(statusUuid.toBytes()); + status->mutable_status_uuid()->set_value(statusUuid.toBytes()); return statusUpdate; } http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/tests/resource_provider_manager_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/resource_provider_manager_tests.cpp b/src/tests/resource_provider_manager_tests.cpp index b5edc6d..4e86016 100644 --- a/src/tests/resource_provider_manager_tests.cpp +++ b/src/tests/resource_provider_manager_tests.cpp @@ -319,7 +319,8 @@ TEST_P(ResourceProviderManagerHttpApiTest, UpdateState) Call::UpdateState* updateState = call.mutable_update_state(); updateState->mutable_resources()->CopyFrom(v1::Resources(resources)); - updateState->set_resource_version_uuid(id::UUID::random().toBytes()); + updateState->mutable_resource_version_uuid()->set_value( + id::UUID::random().toBytes()); http::Request request; request.method = "POST"; @@ -418,7 +419,8 @@ TEST_P(ResourceProviderManagerHttpApiTest, UpdateOfferOperationStatus) mesos::v1::OfferOperationStatus status; status.set_state(mesos::v1::OfferOperationState::OFFER_OPERATION_FINISHED); - id::UUID operationUUID = id::UUID::random(); + mesos::v1::UUID operationUUID; + operationUUID.set_value(id::UUID::random().toBytes()); Call call; call.set_type(Call::UPDATE_OFFER_OPERATION_STATUS); @@ -428,7 +430,8 @@ TEST_P(ResourceProviderManagerHttpApiTest, UpdateOfferOperationStatus) call.mutable_update_offer_operation_status(); updateOfferOperationStatus->mutable_framework_id()->CopyFrom(frameworkId); updateOfferOperationStatus->mutable_status()->CopyFrom(status); - updateOfferOperationStatus->set_operation_uuid(operationUUID.toBytes()); + updateOfferOperationStatus->mutable_operation_uuid()->CopyFrom( + operationUUID); http::Request request; request.method = "POST"; @@ -458,8 +461,8 @@ TEST_P(ResourceProviderManagerHttpApiTest, UpdateOfferOperationStatus) devolve(status).state(), message->updateOfferOperationStatus->update.status().state()); EXPECT_EQ( - operationUUID.toBytes(), - message->updateOfferOperationStatus->update.operation_uuid()); + operationUUID.value(), + message->updateOfferOperationStatus->update.operation_uuid().value()); } } @@ -550,7 +553,7 @@ TEST_P(ResourceProviderManagerHttpApiTest, PublishResourcesSuccess) Call::UpdatePublishResourcesStatus* update = call.mutable_update_publish_resources_status(); - update->set_uuid(event->get().publish_resources().uuid()); + update->mutable_uuid()->CopyFrom(event->get().publish_resources().uuid()); update->set_status(Call::UpdatePublishResourcesStatus::OK); http::Request request; @@ -657,7 +660,7 @@ TEST_P(ResourceProviderManagerHttpApiTest, PublishResourcesFailure) Call::UpdatePublishResourcesStatus* update = call.mutable_update_publish_resources_status(); - update->set_uuid(event->get().publish_resources().uuid()); + update->mutable_uuid()->CopyFrom(event->get().publish_resources().uuid()); update->set_status(Call::UpdatePublishResourcesStatus::FAILED); http::Request request; http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/tests/resource_provider_validation_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/resource_provider_validation_tests.cpp b/src/tests/resource_provider_validation_tests.cpp index 22c7742..db7b431 100644 --- a/src/tests/resource_provider_validation_tests.cpp +++ b/src/tests/resource_provider_validation_tests.cpp @@ -74,7 +74,7 @@ TEST(ResourceProviderCallValidationTest, UpdateOfferOperationStatus) call.mutable_update_offer_operation_status(); update->mutable_framework_id()->set_value(id::UUID::random().toString()); - update->set_operation_uuid(id::UUID::random().toBytes()); + update->mutable_operation_uuid()->set_value(id::UUID::random().toBytes()); OfferOperationStatus* status = update->mutable_status(); status->mutable_operation_id()->set_value(id::UUID::random().toString()); @@ -102,7 +102,8 @@ TEST(ResourceProviderCallValidationTest, UpdateState) EXPECT_SOME(error); Call::UpdateState* updateState = call.mutable_update_state(); - updateState->set_resource_version_uuid(id::UUID::random().toBytes()); + updateState->mutable_resource_version_uuid()->set_value( + id::UUID::random().toBytes()); error = call::validate(call); EXPECT_NONE(error); http://git-wip-us.apache.org/repos/asf/mesos/blob/605b238d/src/tests/slave_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp index 122f42d..b87015d 100644 --- a/src/tests/slave_tests.cpp +++ b/src/tests/slave_tests.cpp @@ -8765,7 +8765,8 @@ TEST_F(SlaveTest, ResourceProviderSubscribe) updateState->mutable_resources()->CopyFrom( v1::Resources(resourceProviderResources)); - updateState->set_resource_version_uuid(resourceVersionUuid); + updateState->mutable_resource_version_uuid()->set_value( + resourceVersionUuid); resourceProvider.send(call); } @@ -8784,7 +8785,7 @@ TEST_F(SlaveTest, ResourceProviderSubscribe) EXPECT_EQ( resourceVersionUuid, - receivedResourceProvider.resource_version_uuid()); + receivedResourceProvider.resource_version_uuid().value()); } @@ -9283,13 +9284,14 @@ TEST_F(SlaveTest, ResourceProviderReconciliation) v1::resource_provider::Call::UpdateState* updateState = call.mutable_update_state(); - updateState->set_resource_version_uuid(resourceVersionUuid.toBytes()); + updateState->mutable_resource_version_uuid()->set_value( + resourceVersionUuid.toBytes()); updateState->mutable_resources()->CopyFrom(resourceProviderResources_); mesos::v1::OfferOperation* _operation = updateState->add_operations(); _operation->mutable_framework_id()->CopyFrom(operation->framework_id()); _operation->mutable_info()->CopyFrom(operation->info()); - _operation->set_operation_uuid(operation->operation_uuid()); + _operation->mutable_operation_uuid()->CopyFrom(operation->operation_uuid()); mesos::v1::OfferOperationStatus* lastStatus = _operation->mutable_latest_status(); @@ -9451,7 +9453,8 @@ TEST_F(SlaveTest, RunTaskResourceVersions) v1::resource_provider::Call::UpdateState* updateState = call.mutable_update_state(); - updateState->set_resource_version_uuid(id::UUID::random().toBytes()); + updateState->mutable_resource_version_uuid()->set_value( + id::UUID::random().toBytes()); updateState->mutable_resources()->CopyFrom(resourceProviderResources_); AWAIT_READY(resourceProvider.send(call));
