xcat2 / xcat-core

Code repo for xCAT core packages
Eclipse Public License 1.0
368 stars 172 forks source link

makehosts does not warn about duplicate IP addresses #4080

Open mattaezell opened 7 years ago

mattaezell commented 7 years ago

Our xCAT tables have a regex that overlaps with another node that we defined. I would expect this to generate a warning if the same line was modified multiple times in the same invocation (to help identify duplicates).

# makehosts
# egrep a01n01\|batch1 /etc/hosts
10.10.0.41 a01n01
# makehosts batch1
# egrep a01n01\|batch1 /etc/hosts
10.10.0.41 batch1
# makehosts a01n01 batch1
# egrep a01n01\|batch1 /etc/hosts
10.10.0.41 a01n01 
# makehosts batch1 a01n01
# egrep a01n01\|batch1 /etc/hosts
10.10.0.41 batch1 
mattaezell commented 7 years ago

Thanks for taking this one @bybai. Maybe this should be a separate issue, but the current algorithm is quite slow when you have a lot of hosts. addnode cycles through every line in the hosts file for every node defined in xCAT, for a computational complexity of O(n^2). If you end up re-working how addnode works, please consider using a hash to improve performance.

bybai commented 7 years ago

hi @mattaezell , thanks your feedback, I open #4082 to trace improve performance for makehosts.