Github user resmo commented on the pull request:
https://github.com/apache/cloudstack/pull/1045#issuecomment-158030442
Our test case on ACS 4.5.1:
# Before fix
## vanilla router deployed:
~~~
# related script
ae693b5ef2d9b1fed1307f6b38213823 /opt/cloud/bin/edithosts.sh
# see running VMs
$ cloudstack-cli server list --project stxt_integration --zone BIEL_CU01
--state running
Name Instance-Name State Offering Zone Project
IP's
web-eq-03 i-70-5871-VM Running 2cpu_2gb BIEL_CU01
STXT_INTEGRATION 10.101.65.183 10.101.192.50 10.101.128.50
web-eq-01 i-70-5870-VM Running 2cpu_2gb BIEL_CU01
STXT_INTEGRATION 10.101.65.69 10.101.192.49 10.101.128.49
jumphost-eq-01 i-70-5874-VM Running 1cpu_1gb BIEL_CU01
STXT_INTEGRATION 10.101.65.113 10.101.192.52 10.101.128.52
# hosts on router (note vm eq-01 is stopped)
root@r-6215-VM:~# cat /etc/hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.101.65.1 r-6215-VM
10.101.65.176 eb-eq-04
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.85 eq-01
10.101.65.1 r-6215-VM
10.101.65.1 data-server
10.101.65.1 r-6215-VM
10.101.65.69 web-eq-01
10.101.65.183 web-eq-03
10.101.65.113 jumphost-eq-01
# dhcp hosts no problems as eq-01 entry was made before others *eq-01
entries.
root@r-6215-VM:~# cat /etc/dhcphosts.txt
02:00:11:bb:03:53,set:10_101_65_176,10.101.65.176,eb-eq-04,infinite
02:00:6e:44:03:58,set:10_101_65_85,10.101.65.85,eq-01,infinite
02:00:4f:6d:03:4b,set:10_101_65_69,10.101.65.69,web-eq-01,infinite
02:00:6f:94:03:4c,set:10_101_65_183,10.101.65.183,web-eq-03,infinite
02:00:7a:76:03:4e,set:10_101_65_113,10.101.65.113,jumphost-eq-01,infinite
~~~
## start a VM named eq-01
~~~
############# start a VM named eq-01
$ cloudstack-cli server list --project stxt_integration --zone BIEL_CU01
--state running
Name Instance-Name State Offering Zone Project
IP's
web-eq-03 i-70-5871-VM Running 2cpu_2gb BIEL_CU01
STXT_INTEGRATION 10.101.65.183 10.101.192.50 10.101.128.50
web-eq-01 i-70-5870-VM Running 2cpu_2gb BIEL_CU01
STXT_INTEGRATION 10.101.65.69 10.101.192.49 10.101.128.49
eq-01 i-70-6216-VM Running 1cpu_1gb BIEL_CU01
STXT_INTEGRATION 10.101.65.85 10.101.192.76 10.101.128.76
jumphost-eq-01 i-70-5874-VM Running 1cpu_1gb BIEL_CU01
STXT_INTEGRATION 10.101.65.113 10.101.192.52 10.101.128.52
# hosts still looks "good"
root@r-6215-VM:~# cat /etc/hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.101.65.1 r-6215-VM
10.101.65.176 eb-eq-04
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 data-server
10.101.65.1 r-6215-VM
10.101.65.69 web-eq-01
10.101.65.183 web-eq-03
10.101.65.113 jumphost-eq-01
10.101.65.85 eq-01
# dhcp entries *eq-01 where removed... BAD!!!
root@r-6215-VM:~# cat /etc/dhcphosts.txt
02:00:11:bb:03:53,set:10_101_65_176,10.101.65.176,eb-eq-04,infinite
02:00:6f:94:03:4c,set:10_101_65_183,10.101.65.183,web-eq-03,infinite
02:00:6e:44:03:58,set:10_101_65_85,10.101.65.85,eq-01,infinite
~~~
# With fix applied!
## Reset test env: stop VM eq-01, apply fix, restart router
~~~
############### stop VM eq-01, apply fix, restart router
root@r-6215-VM:~# md5sum /opt/cloud/bin/edithosts.sh
a610c2dfb0248e6a74993d6452e14244 /opt/cloud/bin/edithosts.sh
# everything looks fine after reset again (just because eq-01 came earlier
then *eq-01)
root@r-6215-VM:~# cat /etc/dhcphosts.txt
02:00:11:bb:03:53,set:10_101_65_176,10.101.65.176,eb-eq-04,infinite
02:00:6e:44:03:58,set:10_101_65_85,10.101.65.85,eq-01,infinite
02:00:4f:6d:03:4b,set:10_101_65_69,10.101.65.69,web-eq-01,infinite
02:00:6f:94:03:4c,set:10_101_65_183,10.101.65.183,web-eq-03,infinite
02:00:7a:76:03:4e,set:10_101_65_113,10.101.65.113,jumphost-eq-01,infinite
root@r-6215-VM:~# cat /etc/hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.101.65.1 r-6215-VM
10.101.65.176 eb-eq-04
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.85 eq-01
10.101.65.1 r-6215-VM
10.101.65.1 data-server
10.101.65.1 r-6215-VM
10.101.65.69 web-eq-01
10.101.65.183 web-eq-03
10.101.65.113 jumphost-eq-01
~~~
## start VM eq-01
~~~
#### start VM eq-01
# hosts still look good here after the fix
root@r-6215-VM:~# cat /etc/hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
10.101.65.1 r-6215-VM
10.101.65.176 eb-eq-04
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 r-6215-VM
10.101.65.1 data-server
10.101.65.1 r-6215-VM
10.101.65.69 web-eq-01
10.101.65.183 web-eq-03
10.101.65.113 jumphost-eq-01
10.101.65.85 eq-01
# /etc/dhcphosts looks as it should!
root@r-6215-VM:~# cat /etc/dhcphosts.txt
02:00:11:bb:03:53,set:10_101_65_176,10.101.65.176,eb-eq-04,infinite
02:00:4f:6d:03:4b,set:10_101_65_69,10.101.65.69,web-eq-01,infinite
02:00:6f:94:03:4c,set:10_101_65_183,10.101.65.183,web-eq-03,infinite
02:00:7a:76:03:4e,set:10_101_65_113,10.101.65.113,jumphost-eq-01,infinite
02:00:6e:44:03:58,set:10_101_65_85,10.101.65.85,eq-01,infinite
~~~
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---