> On Sept. 7, 2016, 1 a.m., Joseph Wu wrote: > > src/slave/containerizer/mesos/isolators/network/cni/cni.cpp, lines 1540-1542 > > <https://reviews.apache.org/r/51643/diff/2/?file=1491981#file1491981line1540> > > > > Given that this case is very specific for systems without a dependency > > on `/etc/hosts` or `/etc/hostname`, would it make sense to create the files > > in the agent's work directory? i.e. to avoid polluting the host? > > Avinash sridharan wrote: > We create these files in the agents work directory as well (a directory > specific to the `network/cni` isolator). The reason we create these files > specifically in the host fs is for the `executor` and containers that don't > have their own images. Reason being that both these entities see the host > file system, albiet with a different mount name space. Also, since the > hostname and IP address is different from the hosts IP and hostname, we need > to give them a different view of the /etc/hosts and /etc/hostname files. We > do this by bind mounting the files from the containers work dir on to these > target mount points on the host file system. > > We do the same operation below for the containers rootfs as well. > However, in case of the containers rootfs we are guaranteed that these mount > points exist (if not we can create them).
Modified the comments to clarify this point. - Avinash ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/51643/#review147956 ----------------------------------------------------------- On Sept. 7, 2016, 7:02 p.m., Avinash sridharan wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/51643/ > ----------------------------------------------------------- > > (Updated Sept. 7, 2016, 7:02 p.m.) > > > Review request for mesos, Gilbert Song, Jie Yu, Joseph Wu, and Qian Zhang. > > > Bugs: MESOS-6052 > https://issues.apache.org/jira/browse/MESOS-6052 > > > Repository: mesos > > > Description > ------- > > In case /etc/hosts and /etc/hostname files are not present in the host > filesystem, we were ignoring these files and assuming that they would > not be required by the executor when it is launched in a new network > namespace. This assumption is incorrect, since the executor needs > /etc/hosts in the new network namespace to resolve its hostname. > Hence, we are explicitly creating these files in the host file system > in case they are not present, so that containers /etc/hosts and > /etc/hostname can be mounted on these mount points. This solves the > problem in distributions such as CoreOS that don't have /etc/hosts in > their host filesystem. > > > Diffs > ----- > > src/slave/containerizer/mesos/isolators/network/cni/cni.cpp > d17a45fe17bb74cbf9ae421dc8a492e5dc5f1a00 > > Diff: https://reviews.apache.org/r/51643/diff/ > > > Testing > ------- > > make check > > Also, build an open DC/OS image with this patch to run on CoreOS and tried > launch a unified containerizer through Marathon using dcos-cli to test this > patch on CoreOS. > > > Thanks, > > Avinash sridharan > >