Updated Branches: refs/heads/master 4572bc068 -> 95df86e1e
Summary: Fix virtual router trying to resolve own host name Detail: Several virtual router configuration commands, such as iptables commands, run slowly due to attempting to do a name lookup on the virtual router's hostname and having to time out. This is seen in the agent logs when a virtual router command is run, as "unable to resolve host r-410-VM" or similar. This can make for very slow router configuration, especially as the number of network rules grows. This change simply sets the router's name to the localhost IP in /etc/hosts BUG-ID : NONE Reviewed-by: Marcus Sorensen Reported-by: Marcus Sorensen Signed-off-by: Marcus Sorensen <[email protected]> 1351659441 -0600 Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/95df86e1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/95df86e1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/95df86e1 Branch: refs/heads/master Commit: 95df86e1e030ab955ac09f145df37f3aef606c05 Parents: 4572bc0 Author: marcus <marcus@marcus-ubuntu.(none)> Authored: Tue Oct 30 22:57:21 2012 -0600 Committer: marcus <marcus@marcus-ubuntu.(none)> Committed: Tue Oct 30 22:57:21 2012 -0600 ---------------------------------------------------------------------- .../debian/config/etc/init.d/cloud-early-config | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/95df86e1/patches/systemvm/debian/config/etc/init.d/cloud-early-config ---------------------------------------------------------------------- diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index 7e58156..d4af3a9 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -814,9 +814,18 @@ change_password() { fi } +set_etc_hosts() { + if [ -f /etc/hosts ]; then + host=`hostname -s`; + grep -q $host /etc/hosts || echo "127.0.0.1 $host" >> /etc/hosts; + fi +} + start() { # Clear /tmp for file lock rm -f /tmp/*.lock + # fix lookups for our hostname (iptables, etc) + set_etc_hosts local hyp=$(hypervisor) [ $? -ne 0 ] && log_it "Failed to detect hypervisor type, bailing out of early init" && exit 10 log_it "Detected that we are running inside $hyp guest"
