Github user jieyu commented on a diff in the pull request: https://github.com/apache/mesos/pull/263#discussion_r168651591 --- 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(); if (!executorInfo.has_container()) { --- End diff -- not yours, but let's remove this short circuit here. We should defer the decision to below.
---