> On Oct. 22, 2013, 10:25 p.m., Benjamin Hindman wrote: > > src/slave/slave.cpp, line 226 > > <https://reviews.apache.org/r/14847/diff/1/?file=369207#file369207line226> > > > > Can we check that this is a valid hostname? I.e., does this hostname > > resolve to one of the available IP addresses on this box and/or the IP > > address that we've bound to? That will save someone a lot of pain when > > they've by accidentally made a typo and you can't get to the slave from the > > web UI. > > Niklas Nielsen wrote: > We should be able to - we can try to resolve it up front by: > > if(getaddrinfo(hostname, NULL, &hints, &res) != 0) { > // Not ok > } else { > // Hostname ok! Works for both ips and hostnames > } > > Works on linux and mac os x. Do you think this belongs in stout? > > Niklas Nielsen wrote: > I have an example which use getaddrinfo to resolve the hostname (or ip) > and tries to bind on a port to verify whether the hostname is local: > https://gist.github.com/nqn/7110345 > We could pick a probe port from the port range in the slave resources. We > need to ensure that we close the port when we are done testing.
I chatted with Niklas about this and we decided that it's entirely possible that an operator might want to use a hostname for a slave that it can't bind to but that remotely will map to it's IP address. This is possible with certain VPN setups. So, let's not do the validation just yet. We'll add validation in the future and print out a big WARNING if someone uses a hostname that they can't bind to. - Benjamin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/14847/#review27337 ----------------------------------------------------------- On Oct. 22, 2013, 5:41 p.m., Niklas Nielsen wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/14847/ > ----------------------------------------------------------- > > (Updated Oct. 22, 2013, 5:41 p.m.) > > > Review request for mesos and Benjamin Hindman. > > > Repository: mesos-git > > > Description > ------- > > A slave can be started with --hostname which explicitly sets hostname instead > of usual system hostname. > This is necessary in situations where system hostname resolves to internal > names which cannot be accessed from the web ui. > > > Diffs > ----- > > include/mesos/mesos.proto fe1d82b > src/common/type_utils.hpp c48411f > src/slave/flags.hpp db777e3 > src/slave/slave.cpp debb2f4 > src/tests/script.cpp e6a935f > src/tests/state_tests.cpp f39dee5 > > Diff: https://reviews.apache.org/r/14847/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Niklas Nielsen > >
