Today i found a strange behaviour on a freshly deployed Powerpath vAPP.
Because the customer DNS server wasn’t ready at the time of the deployment, i had to use the local “/etc/hosts” file.
I opened the /etc/hosts file with my editor of choice and added the lines for all ESXi servers + the vCenter itself.
The reason for that is that if the Powerpath vAPP can’t resolve the names of the ESXi servers that have to be licensed, the ESXi servers show as unlicensed in the GUI.
vapp:~ # vi /etc/hosts 127.0.0.1 localhost.localdom localhost localhost.localdom localhost #ESXi and vCenter 10.77.77.20 vcenter vcenter.localdom.local 10.77.77.25 esx001 esx001.localdom.local 10.77.77.26 esx002 esx002.localdom.local 10.77.77.27 esx003 esx003.localdom.local 10.77.77.28 esx004 esx004.localdom.local 10.77.77.29 esx005 esx005.localdom.local 10.77.77.30 esx006 esx006.localdom.local
After rebooting the vAPP appliance, the “/etc/hosts” file is automically reset to default
vapp:~ # vi /etc/hosts 127.0.0.1 localhost.localdom localhost localhost.localdom localhost
Now this happens because the Powerpath vAPP is deployed as a Virtual Appliance, and this has an in‐guest management component called Virtual Appliance Management Infrastructure (VAMI).
VAMI places a lot of scripts in the vAPP located in the following directory:
#/opt/vmware/etc/isv
The script that is responsible for rewriting the hosts file is called
#subsequentboot
To prevent VAMI from resetting the host file:
– Open vi with the file “subsequentboot”
localhost:/ # vi /opt/vmware/etc/isv/subsequentboot
– Comment the following 2 lines in line 23/24:
#echo "127.0.0.1 localhost.localdom localhost" > /etc/hosts #echo "$HOSTADDR $FQDNADDR $SHORTHNAME" >> /etc/hosts
Edit the “/etc/hosts” file again and reboot…
Voilá…”/etc/hosts” file should still have all the entries that you put in