Revision 36683bad

b/tools/vcluster-setup.in
30 30
readonly default_netdev=eth0
31 31
readonly default_initscript=@SYSCONFDIR@/init.d/ganeti
32 32
readonly cluster_name=cluster
33
readonly etc_hosts_filename=/etc/hosts
33 34

  
34 35
# IP address space:
35 36
# Cluster: .1
......
52 53
  echo '  -n  Network device for virtual IP addresses (defaults to'\
53 54
       "$default_netdev)"
54 55
  echo "  -I  Path to init script (defaults to $default_initscript)"
55
  echo '  -E  Do not modify /etc/hosts'
56
  echo "  -E  Do not modify $etc_hosts_filename"
56 57
  echo '  -N  Do not configure networking'
57 58
}
58 59

  
......
225 226
}
226 227

  
227 228
setup_etc_hosts() {
228
  echo 'Configuring /etc/hosts ...' >&2
229
  echo "Configuring $etc_hosts_filename ..." >&2
229 230
  (
230 231
    set -e -u
231
    local -r tmpfile=$(mktemp /etc/hosts.vcluster.XXXXX)
232
    local -r tmpfile=$(mktemp $etc_hosts_filename.vcluster.XXXXX)
232 233
    trap "rm -f $tmpfile" EXIT
233 234
    {
234
      egrep -v "^$netprefix.[[:digit:]]+[[:space:]]" /etc/hosts
235
      egrep -v "^$netprefix.[[:digit:]]+[[:space:]]" $etc_hosts_filename
235 236
      echo "$netprefix.1 $cluster_name"
236 237
      for ((i=0; i < nodecount; ++i)); do
237 238
        echo "$(node_ipaddr $i) $(node_hostname $i)"
......
241 242
      done
242 243
    } > $tmpfile && \
243 244
    chmod 0644 $tmpfile && \
244
    mv $tmpfile /etc/hosts && \
245
    mv $tmpfile $etc_hosts_filename && \
245 246
    trap - EXIT
246 247
  )
247 248
}

Also available in: Unified diff