Repository: mesos Updated Branches: refs/heads/master 99171a4c1 -> 4695ac0c2
Added a missing check for parent container has config recovered. This is necessary because before MESOS-6894, containers do not have ContainerConfig checkpointed. For the upgrade scenario, if any nested container is launched under an existing legacy container, the agent would fail due to an unguarded access to the parent legacy container's ContainerConfig. We need to add this check. Please see MESOS-8325 for details. Review: https://reviews.apache.org/r/64558/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4695ac0c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4695ac0c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4695ac0c Branch: refs/heads/master Commit: 4695ac0c23b732e18e794f7fe28834123e6586df Parents: 99171a4 Author: Zhitao Li <[email protected]> Authored: Wed Dec 13 14:13:00 2017 +0800 Committer: Gilbert Song <[email protected]> Committed: Wed Dec 13 15:05:57 2017 +0800 ---------------------------------------------------------------------- src/slave/containerizer/mesos/containerizer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/4695ac0c/src/slave/containerizer/mesos/containerizer.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp index a673117..7ab0b07 100644 --- a/src/slave/containerizer/mesos/containerizer.cpp +++ b/src/slave/containerizer/mesos/containerizer.cpp @@ -1713,7 +1713,16 @@ Future<Containerizer::LaunchResult> MesosContainerizerProcess::_launch( if (containers_[containerId.parent()]->launchInfo.isSome()) { // TODO(alexr): Remove this once we no longer support executorless // command tasks in favor of default executor. - if (containers_[containerId.parent()]->config->has_task_info()) { + // + // The `ContainerConfig` may not exist for the parent container. + // The check is necessary because before MESOS-6894, containers + // do not have `ContainerConfig` checkpointed. For the upgrade + // scenario, if any nested container is launched under an existing + // legacy container, the agent would fail due to an unguarded access + // to the parent legacy container's ContainerConfig. We need to add + // this check. Please see MESOS-8325 for details. + if (containers_[containerId.parent()]->config.isSome() && + containers_[containerId.parent()]->config->has_task_info()) { // For the command executor case, even if the task itself has a root // filesystem, the executor container still uses the host filesystem, // hence `ContainerLaunchInfo.working_directory`, which points to the
