From e76266e39bc1396880caa86f5e232ef4538e3f5a Mon Sep 17 00:00:00 2001 From: ustcweizhou Date: Wed, 26 Jun 2019 12:56:05 +0200 Subject: [PATCH] systemvm: Fix hostname is localhost in some VRs (#3422) In some virtual routers, 'hostname -f' returns 'localhost'. The hostname is also 'localhost' in `/var/log/messages`. This change can fix the issue in new VRs. --- systemvm/debian/opt/cloud/bin/cs/CsDhcp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py b/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py index e7abb902046..56b44195f6d 100755 --- a/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py +++ b/systemvm/debian/opt/cloud/bin/cs/CsDhcp.py @@ -139,7 +139,8 @@ class CsDhcp(CsDataBag): logging.error("Caught error while trying to delete entries from dnsmasq.leases file: %s" % e) def preseed(self): - self.add_host("127.0.0.1", "localhost %s" % CsHelper.get_hostname()) + self.add_host("127.0.0.1", "localhost") + self.add_host("127.0.1.1", "%s" % CsHelper.get_hostname()) self.add_host("::1", "localhost ip6-localhost ip6-loopback") self.add_host("ff02::1", "ip6-allnodes") self.add_host("ff02::2", "ip6-allrouters")