| 8237 | |
| 8238 | |
| 8239 | void Master::updateOperationStatus(UpdateOperationStatusMessage&& update) |
| 8240 | { |
| 8241 | CHECK(update.has_slave_id()) |
| 8242 | << "External resource provider is not supported yet"; |
| 8243 | |
| 8244 | ++metrics->messages_operation_status_update; |
| 8245 | |
| 8246 | const SlaveID& slaveId = update.slave_id(); |
| 8247 | |
| 8248 | // While currently only frameworks can initiate operations which request |
| 8249 | // feedback, in some cases such as master/agent reconciliation, the framework |
| 8250 | // ID will not be set in the update message. |
| 8251 | Option<FrameworkID> frameworkId = update.has_framework_id() |
| 8252 | ? update.framework_id() |
| 8253 | : Option<FrameworkID>::none(); |
| 8254 | |
| 8255 | // If the operation UUID is not set, then this must be an update sent as a |
| 8256 | // result of a framework-inititated reconciliation which was forwarded to the |
| 8257 | // agent. Since the operation UUID is not known, there is nothing for the |
| 8258 | // master to do but forward the update to the framework and return. |
| 8259 | if (!update.has_operation_uuid()) { |
| 8260 | CHECK_SOME(frameworkId); |
| 8261 | |
| 8262 | // Forward the status update to the framework. |
| 8263 | Framework* framework = getFramework(frameworkId.get()); |
| 8264 | |
| 8265 | if (framework == nullptr || !framework->connected()) { |
| 8266 | LOG(WARNING) << "Received operation status update " << update |
| 8267 | << ", but the framework is " |
| 8268 | << (framework == nullptr ? "unknown" : "disconnected"); |
| 8269 | } else { |
| 8270 | LOG(INFO) << "Forwarding operation status update " << update; |
| 8271 | framework->send(update); |
| 8272 | } |
| 8273 | |
| 8274 | return; |
| 8275 | } |
| 8276 | |
| 8277 | Slave* slave = slaves.registered.get(slaveId); |
| 8278 | |
| 8279 | const UUID& uuid = update.operation_uuid(); |
| 8280 | |
| 8281 | // This is possible if the agent is marked as unreachable or gone, |
| 8282 | // or has initiated a graceful shutdown. In either of those cases, |
| 8283 | // ignore the operation status update. |
| 8284 | // |
| 8285 | // TODO(jieyu): If the agent is unreachable or has initiated a |
| 8286 | // graceful shutdown, we can still forward the update to the |
| 8287 | // framework so that the framework can get notified about the offer |
| 8288 | // operation early. However, the acknowledgement of the update won't |
| 8289 | // be able to reach the agent in those cases. If the agent is gone, |
| 8290 | // we cannot forward the update because the master might already |
| 8291 | // tell the framework that the operation is gone. |
| 8292 | if (slave == nullptr) { |
| 8293 | LOG(WARNING) << "Ignoring status update for operation '" |
| 8294 | << update.status().operation_id() |
| 8295 | << "' (uuid: " << uuid << ") for " |
| 8296 | << (frameworkId.isSome() |
nothing calls this directly
no test coverage detected