Revision b15d625f lib/cmdlib.py

b/lib/cmdlib.py
516 516

  
517 517
    self.clustername = clustername = utils.HostInfo(self.op.cluster_name)
518 518

  
519
    if not utils.TcpPing(constants.LOCALHOST_IP_ADDRESS, hostname.ip,
520
                         constants.DEFAULT_NODED_PORT):
519
    if not utils.TcpPing(hostname.ip, constants.DEFAULT_NODED_PORT,
520
                         source=constants.LOCALHOST_IP_ADDRESS):
521 521
      raise errors.OpPrereqError("Inconsistency: this host's name resolves"
522 522
                                 " to %s,\nbut this ip address does not"
523 523
                                 " belong to this host."
......
528 528
      raise errors.OpPrereqError("Invalid secondary ip given")
529 529
    if (secondary_ip and
530 530
        secondary_ip != hostname.ip and
531
        (not utils.TcpPing(constants.LOCALHOST_IP_ADDRESS, secondary_ip,
532
                           constants.DEFAULT_NODED_PORT))):
531
        (not utils.TcpPing(secondary_ip, constants.DEFAULT_NODED_PORT,
532
                           source=constants.LOCALHOST_IP_ADDRESS))):
533 533
      raise errors.OpPrereqError("You gave %s as secondary IP,"
534 534
                                 " but it does not belong to this host." %
535 535
                                 secondary_ip)
......
1478 1478
                                   " new node doesn't have one")
1479 1479

  
1480 1480
    # checks reachablity
1481
    if not utils.TcpPing(utils.HostInfo().name,
1482
                         primary_ip,
1483
                         constants.DEFAULT_NODED_PORT):
1481
    if not utils.TcpPing(primary_ip, constants.DEFAULT_NODED_PORT):
1484 1482
      raise errors.OpPrereqError("Node not reachable by ping")
1485 1483

  
1486 1484
    if not newbie_singlehomed:
1487 1485
      # check reachability from my secondary ip to newbie's secondary ip
1488
      if not utils.TcpPing(myself.secondary_ip,
1489
                           secondary_ip,
1490
                           constants.DEFAULT_NODED_PORT):
1486
      if not utils.TcpPing(secondary_ip, constants.DEFAULT_NODED_PORT,
1487
                           source=myself.secondary_ip):
1491 1488
        raise errors.OpPrereqError("Node secondary ip not reachable by TCP"
1492 1489
                                   " based ping to noded port")
1493 1490

  
......
3076 3073
                                 " adding an instance in start mode")
3077 3074

  
3078 3075
    if self.op.ip_check:
3079
      if utils.TcpPing(utils.HostInfo().name, hostname1.ip,
3080
                       constants.DEFAULT_NODED_PORT):
3076
      if utils.TcpPing(hostname1.ip, constants.DEFAULT_NODED_PORT):
3081 3077
        raise errors.OpPrereqError("IP %s of instance %s already in use" %
3082 3078
                                   (hostname1.ip, instance_name))
3083 3079

  

Also available in: Unified diff