mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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 <shadowsor@gmail.com> 1351659441 -0600
This commit is contained in:
parent
4572bc0685
commit
95df86e1e0
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user