Revision 8e74adce lib/client/gnt_cluster.py
b/lib/client/gnt_cluster.py | ||
---|---|---|
976 | 976 |
@ivar success: Indicates if all action_cb calls were successful |
977 | 977 |
|
978 | 978 |
""" |
979 |
def __init__(self, node_list, action_cb, node2ip, port, |
|
979 |
def __init__(self, node_list, action_cb, node2ip, port, feedback_fn,
|
|
980 | 980 |
_ping_fn=netutils.TcpPing, _sleep_fn=time.sleep): |
981 | 981 |
"""Init the object. |
982 | 982 |
|
... | ... | |
985 | 985 |
@type node2ip: dict |
986 | 986 |
@param node2ip: Node to ip mapping |
987 | 987 |
@param port: The port to use for the TCP ping |
988 |
@param feedback_fn: The function used for feedback |
|
988 | 989 |
@param _ping_fn: Function to check reachabilty (for unittest use only) |
989 | 990 |
@param _sleep_fn: Function to sleep (for unittest use only) |
990 | 991 |
|
... | ... | |
995 | 996 |
self.success = True |
996 | 997 |
self.action_cb = action_cb |
997 | 998 |
self.port = port |
999 |
self.feedback_fn = feedback_fn |
|
998 | 1000 |
self._ping_fn = _ping_fn |
999 | 1001 |
self._sleep_fn = _sleep_fn |
1000 | 1002 |
|
... | ... | |
1022 | 1024 |
for node in self.down: |
1023 | 1025 |
if self._ping_fn(self.node2ip[node], self.port, timeout=_EPO_PING_TIMEOUT, |
1024 | 1026 |
live_port_needed=True): |
1025 |
ToStdout("Node %s became available", node)
|
|
1027 |
self.feedback_fn("Node %s became available" % node)
|
|
1026 | 1028 |
self.up.add(node) |
1027 | 1029 |
self.down -= self.up |
1028 | 1030 |
# If we have a node available there is the possibility to run the |
... | ... | |
1051 | 1053 |
for node in node_list) |
1052 | 1054 |
|
1053 | 1055 |
port = netutils.GetDaemonPort(constants.NODED) |
1054 |
helper = _RunWhenNodesReachableHelper(node_list, action_cb, node2ip, port) |
|
1056 |
helper = _RunWhenNodesReachableHelper(node_list, action_cb, node2ip, port, |
|
1057 |
ToStdout) |
|
1055 | 1058 |
|
1056 | 1059 |
try: |
1057 | 1060 |
return utils.Retry(helper, interval, _EPO_REACHABLE_TIMEOUT, |
Also available in: Unified diff