Revision a744b676 lib/bootstrap.py

b/lib/bootstrap.py
40 40
from ganeti import serializer
41 41
from ganeti import hypervisor
42 42
from ganeti import bdev
43
from ganeti import netutils
43 44

  
44 45

  
45 46
def _InitSSHSetup():
......
239 240
                               " entries: %s" % invalid_hvs,
240 241
                               errors.ECODE_INVAL)
241 242

  
242
  hostname = utils.GetHostInfo()
243
  hostname = netutils.GetHostInfo()
243 244

  
244 245
  if hostname.ip.startswith("127."):
245 246
    raise errors.OpPrereqError("This host's IP resolves to the private"
......
247 248
                               (hostname.ip, constants.ETC_HOSTS),
248 249
                               errors.ECODE_ENVIRON)
249 250

  
250
  if not utils.OwnIpAddress(hostname.ip):
251
  if not netutils.OwnIpAddress(hostname.ip):
251 252
    raise errors.OpPrereqError("Inconsistency: this host's name resolves"
252 253
                               " to %s,\nbut this ip address does not"
253 254
                               " belong to this host. Aborting." %
254 255
                               hostname.ip, errors.ECODE_ENVIRON)
255 256

  
256
  clustername = utils.GetHostInfo(utils.HostInfo.NormalizeName(cluster_name))
257
  clustername = \
258
    netutils.GetHostInfo(netutils.HostInfo.NormalizeName(cluster_name))
257 259

  
258
  if utils.TcpPing(clustername.ip, constants.DEFAULT_NODED_PORT,
260
  if netutils.TcpPing(clustername.ip, constants.DEFAULT_NODED_PORT,
259 261
                   timeout=5):
260 262
    raise errors.OpPrereqError("Cluster IP already active. Aborting.",
261 263
                               errors.ECODE_NOTUNIQUE)
262 264

  
263 265
  if secondary_ip:
264
    if not utils.IsValidIP4(secondary_ip):
266
    if not netutils.IsValidIP4(secondary_ip):
265 267
      raise errors.OpPrereqError("Invalid secondary ip given",
266 268
                                 errors.ECODE_INVAL)
267 269
    if (secondary_ip != hostname.ip and
268
        not utils.OwnIpAddress(secondary_ip)):
270
        not netutils.OwnIpAddress(secondary_ip)):
269 271
      raise errors.OpPrereqError("You gave %s as secondary IP,"
270 272
                                 " but it does not belong to this host." %
271 273
                                 secondary_ip, errors.ECODE_ENVIRON)
......
574 576
  total_timeout = 30
575 577
  # Here we have a phase where no master should be running
576 578
  def _check_ip():
577
    if utils.TcpPing(master_ip, constants.DEFAULT_NODED_PORT):
579
    if netutils.TcpPing(master_ip, constants.DEFAULT_NODED_PORT):
578 580
      raise utils.RetryAgain()
579 581

  
580 582
  try:
......
641 643
  @return: list of (node, votes)
642 644

  
643 645
  """
644
  myself = utils.HostInfo().name
646
  myself = netutils.HostInfo().name
645 647
  try:
646 648
    node_list.remove(myself)
647 649
  except ValueError:

Also available in: Unified diff