[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH OSSTEST] ts-xen-install: Rewrite /etc/hosts to comment out 127.0.1.1 entry
Debian creates an entry such as: 127.0.1.1 lace-bug.xs.citrite.net lace-bug This causes local lookups of the FQDN to get 127.0.1.1, which is unhelpful if you are looking for an address to bind to and were hoping to get the public IP address, as libvirt does on the target host for migration. Here we remove (actually, comment) any 127.0.1.1 line in /etc/hosts. This means that lookups of a hosts own name (fqdn or just dn) now rely on DNS, which may not be ideal. However for a host which uses DHCP I'm not aware of a way to keep /etc/hosts up to date with the actual IP address the machine has. In our infra the test host IP addresses are all static, but I don't think we want to rely on at any more that we already do. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- ts-xen-install | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ts-xen-install b/ts-xen-install index e039173..7c80a13 100755 --- a/ts-xen-install +++ b/ts-xen-install @@ -229,6 +229,24 @@ END target_cmd_root($ho, $cmd); } +sub hosts () { + # Debian installer generates a line like: + # + # 127.0.1.1 lace-bug.xs.citrite.net lace-bug + # + # Where xs.citrite.net is $c{TestHostDomain} and lace-bug is the + # hostname, this causes lookups of the hosts FQDN to result in + # 127.0.1.1 which is not useful if the reason for the lookup was + # to be able to bind to the externally accessible IP address. + target_editfile_root($ho, "/etc/hosts", "etc-hosts", sub { + my $hn = $ho->{Name}; + while (<EI>) { + s|^127.0.1.1|#$&|; + print EO; + } + }); +} + sub nodhcp () { target_editfile_root($ho, "/etc/network/interfaces", "etc-network-interfaces", sub { @@ -350,4 +368,5 @@ if ($checkmode) { setupboot(); setupinitd(); nodhcp(); + hosts(); } -- 2.5.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |