Revision 16abfbc2 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
567 | 567 |
|
568 | 568 |
self.clustername = clustername = utils.HostInfo(self.op.cluster_name) |
569 | 569 |
|
570 |
result = utils.RunCmd(["fping", "-S127.0.0.1", "-q", hostname.ip])
|
|
571 |
if result.failed:
|
|
570 |
if not utils.TcpPing(constants.LOCALHOST_IP_ADDRESS, hostname.ip,
|
|
571 |
constants.DEFAULT_NODED_PORT):
|
|
572 | 572 |
raise errors.OpPrereqError("Inconsistency: this host's name resolves" |
573 | 573 |
" to %s,\nbut this ip address does not" |
574 | 574 |
" belong to this host." |
... | ... | |
577 | 577 |
secondary_ip = getattr(self.op, "secondary_ip", None) |
578 | 578 |
if secondary_ip and not utils.IsValidIP(secondary_ip): |
579 | 579 |
raise errors.OpPrereqError("Invalid secondary ip given") |
580 |
if secondary_ip and secondary_ip != hostname.ip: |
|
581 |
result = utils.RunCmd(["fping", "-S127.0.0.1", "-q", secondary_ip]) |
|
582 |
if result.failed: |
|
583 |
raise errors.OpPrereqError("You gave %s as secondary IP,\n" |
|
584 |
"but it does not belong to this host." % |
|
585 |
secondary_ip) |
|
580 |
if (secondary_ip and |
|
581 |
secondary_ip != hostname.ip and |
|
582 |
(not utils.TcpPing(constants.LOCALHOST_IP_ADDRESS, secondary_ip, |
|
583 |
constants.DEFAULT_NODED_PORT))): |
|
584 |
raise errors.OpPrereqError("You gave %s as secondary IP,\n" |
|
585 |
"but it does not belong to this host." % |
|
586 |
secondary_ip) |
|
586 | 587 |
self.secondary_ip = secondary_ip |
587 | 588 |
|
588 | 589 |
# checks presence of the volume group given |
... | ... | |
1428 | 1429 |
" new node doesn't have one") |
1429 | 1430 |
|
1430 | 1431 |
# checks reachablity |
1431 |
command = ["fping", "-q", primary_ip]
|
|
1432 |
result = utils.RunCmd(command)
|
|
1433 |
if result.failed:
|
|
1432 |
if not utils.TcpPing(utils.HostInfo().name,
|
|
1433 |
primary_ip,
|
|
1434 |
constants.DEFAULT_NODED_PORT):
|
|
1434 | 1435 |
raise errors.OpPrereqError("Node not reachable by ping") |
1435 | 1436 |
|
1436 | 1437 |
if not newbie_singlehomed: |
1437 | 1438 |
# check reachability from my secondary ip to newbie's secondary ip |
1438 |
command = ["fping", "-S%s" % myself.secondary_ip, "-q", secondary_ip] |
|
1439 |
result = utils.RunCmd(command) |
|
1440 |
if result.failed: |
|
1441 |
raise errors.OpPrereqError("Node secondary ip not reachable by ping") |
|
1439 |
if not utils.TcpPing(myself.secondary_ip, |
|
1440 |
secondary_ip, |
|
1441 |
constants.DEFAULT_NODED_PORT): |
|
1442 |
raise errors.OpPrereqError( |
|
1443 |
"Node secondary ip not reachable by TCP based ping to noded port") |
|
1442 | 1444 |
|
1443 | 1445 |
self.new_node = objects.Node(name=node, |
1444 | 1446 |
primary_ip=primary_ip, |
... | ... | |
1529 | 1531 |
self.cfg.GetHostKey()) |
1530 | 1532 |
|
1531 | 1533 |
if new_node.secondary_ip != new_node.primary_ip: |
1532 |
result = ssh.SSHCall(node, "root", |
|
1533 |
"fping -S 127.0.0.1 -q %s" % new_node.secondary_ip) |
|
1534 |
if result.failed: |
|
1534 |
if not rpc.call_node_tcp_ping(new_node.name, |
|
1535 |
constants.LOCALHOST_IP_ADDRESS, |
|
1536 |
new_node.secondary_ip, |
|
1537 |
constants.DEFAULT_NODED_PORT, |
|
1538 |
10, False): |
|
1535 | 1539 |
raise errors.OpExecError("Node claims it doesn't have the" |
1536 | 1540 |
" secondary ip you gave (%s).\n" |
1537 | 1541 |
"Please fix and re-run this command." % |
... | ... | |
2844 | 2848 |
" adding an instance in start mode") |
2845 | 2849 |
|
2846 | 2850 |
if self.op.ip_check: |
2847 |
command = ["fping", "-q", hostname1.ip] |
|
2848 |
result = utils.RunCmd(command) |
|
2849 |
if not result.failed: |
|
2850 |
raise errors.OpPrereqError("IP address %s of instance %s already" |
|
2851 |
" in use" % (hostname1.ip, instance_name)) |
|
2851 |
if utils.TcpPing(utils.HostInfo().name, hostname1.ip, |
|
2852 |
constants.DEFAULT_NODED_PORT): |
|
2853 |
raise errors.OpPrereqError("IP %s of instance %s already in use" % |
|
2854 |
(hostname1.ip, instance_name)) |
|
2852 | 2855 |
|
2853 | 2856 |
# bridge verification |
2854 | 2857 |
bridge = getattr(self.op, "bridge", None) |
Also available in: Unified diff