Github user jieyu commented on a diff in the pull request: https://github.com/apache/mesos/pull/263#discussion_r168600405 --- Diff: src/slave/containerizer/mesos/isolators/network/cni/cni.cpp --- @@ -570,10 +570,17 @@ Future<Option<ContainerLaunchInfo>> NetworkCniIsolatorProcess::prepare( return Failure("Container has already been prepared"); } + bool needsSeparateNs = false; + if ((containerConfig.has_container_info() && + containerConfig.container_info().network_infos().size() > 0) || + !containerId.has_parent()) { + needsSeparateNs = true; + } + hashmap<string, ContainerNetwork> containerNetworks; Option<string> hostname; - if (!containerId.has_parent()) { + if (needsSeparateNs) { const ExecutorInfo& executorInfo = containerConfig.executor_info(); --- End diff -- Not yours, but instead of relying on `containerConfig.executor_info().container()`, we should rely on `containerConfig.container_info()`. With standalone container being introduced, it's possible that the top level container does not have `ExecutorInfo`. This will also make the code more consistent with the new change you added above.
---