| 6238 | |
| 6239 | |
| 6240 | void Slave::_statusUpdate( |
| 6241 | StatusUpdate update, |
| 6242 | const Option<process::UPID>& pid, |
| 6243 | const ExecutorID& executorId, |
| 6244 | const Option<Future<ContainerStatus>>& containerStatus) |
| 6245 | { |
| 6246 | // There can be cases where a container is already removed from the |
| 6247 | // containerizer before the `status` call is dispatched to the |
| 6248 | // containerizer, leading to the failure of the returned `Future`. |
| 6249 | // In such a case we should simply not update the `ContainerStatus` |
| 6250 | // with the return `Future` but continue processing the |
| 6251 | // `StatusUpdate`. |
| 6252 | if (containerStatus.isSome() && containerStatus->isReady()) { |
| 6253 | ContainerStatus* status = |
| 6254 | update.mutable_status()->mutable_container_status(); |
| 6255 | |
| 6256 | status->MergeFrom(containerStatus->get()); |
| 6257 | |
| 6258 | // Fill in the container IP address with the IP from the agent |
| 6259 | // PID, if not already filled in. |
| 6260 | // |
| 6261 | // TODO(karya): Fill in the IP address by looking up the executor PID. |
| 6262 | if (status->network_infos().size() == 0) { |
| 6263 | NetworkInfo* networkInfo = status->add_network_infos(); |
| 6264 | NetworkInfo::IPAddress* ipAddress = networkInfo->add_ip_addresses(); |
| 6265 | |
| 6266 | // Set up IPv4 address. |
| 6267 | // |
| 6268 | // NOTE: By default the protocol is set to IPv4 and therefore we |
| 6269 | // don't explicitly set the protocol here. |
| 6270 | ipAddress->set_ip_address(stringify(self().address.ip)); |
| 6271 | |
| 6272 | // Set up IPv6 address. |
| 6273 | if (self().addresses.v6.isSome()) { |
| 6274 | ipAddress = networkInfo->add_ip_addresses(); |
| 6275 | ipAddress->set_ip_address(stringify(self().addresses.v6->ip)); |
| 6276 | ipAddress->set_protocol(NetworkInfo::IPv6); |
| 6277 | } |
| 6278 | } |
| 6279 | } |
| 6280 | |
| 6281 | const TaskStatus& status = update.status(); |
| 6282 | |
| 6283 | Executor* executor = getExecutor(update.framework_id(), executorId); |
| 6284 | if (executor == nullptr) { |
| 6285 | LOG(WARNING) << "Ignoring container status update for framework " |
| 6286 | << update.framework_id() |
| 6287 | << "for a non-existent executor"; |
| 6288 | return; |
| 6289 | } |
| 6290 | |
| 6291 | // We set the latest state of the task here so that the slave can |
| 6292 | // inform the master about the latest state (via status update or |
| 6293 | // ReregisterSlaveMessage message) as soon as possible. Master can use |
| 6294 | // this information, for example, to release resources as soon as the |
| 6295 | // latest state of the task reaches a terminal state. This is |
| 6296 | // important because task status update manager queues updates and |
| 6297 | // only sends one update per task at a time; the next update for a |
nothing calls this directly
no test coverage detected