| 5143 | |
| 5144 | |
| 5145 | void Slave::operationStatusAcknowledgement( |
| 5146 | const UPID& from, |
| 5147 | const AcknowledgeOperationStatusMessage& acknowledgement) |
| 5148 | { |
| 5149 | Operation* operation = getOperation(acknowledgement.operation_uuid()); |
| 5150 | |
| 5151 | if (operation == nullptr) { |
| 5152 | LOG(WARNING) << "Dropping operation update acknowledgement with" |
| 5153 | << " status_uuid " << acknowledgement.status_uuid() << " and" |
| 5154 | << " operation_uuid " << acknowledgement.operation_uuid() |
| 5155 | << " because the operation was not found"; |
| 5156 | |
| 5157 | return; |
| 5158 | } |
| 5159 | |
| 5160 | // If the operation was on resource provider resources forward the |
| 5161 | // acknowledgement to the resource provider manager as well. |
| 5162 | Result<ResourceProviderID> resourceProviderId = |
| 5163 | getResourceProviderId(operation->info()); |
| 5164 | |
| 5165 | CHECK(!resourceProviderId.isError()) |
| 5166 | << "Could not determine resource provider of operation " << operation |
| 5167 | << ": " << resourceProviderId.error(); |
| 5168 | |
| 5169 | if (resourceProviderId.isSome()) { |
| 5170 | CHECK_NOTNULL(resourceProviderManager.get()) |
| 5171 | ->acknowledgeOperationStatus(acknowledgement); |
| 5172 | |
| 5173 | CHECK(operation->statuses_size() > 0); |
| 5174 | if (protobuf::isTerminalState( |
| 5175 | operation->statuses(operation->statuses_size() - 1).state())) { |
| 5176 | // Note that if this acknowledgement is dropped due to resource provider |
| 5177 | // disconnection, the resource provider will inform the agent about the |
| 5178 | // operation via an UPDATE_STATE call after it reregisters, which will |
| 5179 | // cause the agent to add the operation back. |
| 5180 | removeOperation(operation); |
| 5181 | } |
| 5182 | |
| 5183 | return; |
| 5184 | } |
| 5185 | |
| 5186 | // Acknowledgement was for an operation on the agent's default resources. |
| 5187 | auto statusUuid = id::UUID::fromBytes( |
| 5188 | acknowledgement.status_uuid().value()); |
| 5189 | |
| 5190 | auto operationUuid = id::UUID::fromBytes( |
| 5191 | acknowledgement.operation_uuid().value()); |
| 5192 | |
| 5193 | if (operationUuid.isError() || statusUuid.isError()) { |
| 5194 | LOG(WARNING) << "Dropping acknowledgement for operation " << operation |
| 5195 | << " with provided operation uuid " |
| 5196 | << acknowledgement.operation_uuid().value() |
| 5197 | << " and status uuid " |
| 5198 | << acknowledgement.status_uuid().value() << "."; |
| 5199 | return; |
| 5200 | } |
| 5201 | |
| 5202 | auto err = [](const id::UUID& uuid, const string& message) { |
nothing calls this directly
no test coverage detected