> On April 13, 2016, 5:16 a.m., Jie Yu wrote:
> > src/slave/containerizer/mesos/isolators/network/cni/cni.cpp, lines 716-717
> > <https://reviews.apache.org/r/45956/diff/4/?file=1342332#file1342332line716>
> >
> >     What if IP is not found? Should we use 127.0.0.1?
> 
> Avinash sridharan wrote:
>     If the container does not have any IP the hostname should resolve to 
> 169.254.x.y (which is a self assigned IP address). In fact I gave this a bit 
> more thought, and realized that we don't need to add and explicit resolution 
> for hostname in /etc/hosts file. If the hostname is not present in /etc/hosts 
> file the kernel will automatically pick the first, non-loopback IP, as the 
> resolution for the hostname, so explicitly setting the hostname to a an IP in 
> /etc/hosts doesn't help. I verified this on my Ubuntu 14.04 VM, hostnames are 
> not stored in /etc/hosts. According have gone ahead and removed the code to 
> pick an IP for the hostname and adding it to /etc/hosts. 
>     
>     We still need the /etc/hosts for resolving `localhost`.
> 
> Jie Yu wrote:
>     Sorry, I got confused, what happens if I do `ping <containerId>` in the 
> container without setting up /etc/hosts?

Looks like you are right, the behavior seems to be dependent on how 
nsswtich.conf is setup. It seems to be safer to leave the hostname in 
/etc/hosts. Bought back the loop that adds the hostname to /etc/hosts.


- Avinash


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45956/#review128609
-----------------------------------------------------------


On April 13, 2016, 7:18 a.m., Avinash sridharan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45956/
> -----------------------------------------------------------
> 
> (Updated April 13, 2016, 7:18 a.m.)
> 
> 
> Review request for mesos, Jie Yu and Qian Zhang.
> 
> 
> Bugs: MESOS-4922
>     https://issues.apache.org/jira/browse/MESOS-4922
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Once the `isolate` is successful, the `_isolate` method calls out the
> `mesos-cni-helper` to setup the /etc/hosts, /etc/hostname and
> /etc/resolv.conf for the container.
> 
> 
> Diffs
> -----
> 
>   src/slave/containerizer/mesos/isolators/network/cni/cni.hpp 
> 3f64bc2d5e114da63a76d93b6406e70891dd0242 
>   src/slave/containerizer/mesos/isolators/network/cni/cni.cpp 
> ac01abc29f0e1a145516d8ec7d373c6cedb33b38 
> 
> Diff: https://reviews.apache.org/r/45956/diff/
> 
> 
> Testing
> -------
> 
> make
> 
> *Ran mesos_execute with single master/slave setup to verify that containers 
> get the right hostname and network files when attached to a CNI network.
> 
> 
> Thanks,
> 
> Avinash sridharan
> 
>

Reply via email to