This fixes issue 773. For a while already, SSH ports are
available via ssconf. This enables us to simplify the
RPC signature of NodeVerify.

Signed-off-by: Helga Velroyen <[email protected]>
---
 lib/backend.py                     | 12 +++---------
 lib/cmdlib/node.py                 |  1 -
 lib/rpc_defs.py                    |  2 --
 lib/server/noded.py                |  4 ++--
 test/py/ganeti.backend_unittest.py |  4 ++--
 5 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/lib/backend.py b/lib/backend.py
index cd94d92..b53fcb6 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -1100,7 +1100,7 @@ def _VerifySshClutter(node_status_list, my_name):
   return result
 
 
-def VerifyNode(what, cluster_name, all_hvparams, node_groups, groups_cfg):
+def VerifyNode(what, cluster_name, all_hvparams, node_groups):
   """Verify the status of the local node.
 
   Based on the input L{what} parameter, various checks are done on the
@@ -1131,8 +1131,6 @@ def VerifyNode(what, cluster_name, all_hvparams, 
node_groups, groups_cfg):
   @type node_groups: a dict of strings
   @param node_groups: node _names_ mapped to their group uuids (it's enough to
       have only those nodes that are in `what["nodelist"]`)
-  @type groups_cfg: a dict of dict of strings
-  @param groups_cfg: a dictionary mapping group uuids to their configuration
   @rtype: dict
   @return: a dictionary with the same keys as the input dict, and
       values representing the result of the checks
@@ -1177,19 +1175,15 @@ def VerifyNode(what, cluster_name, all_hvparams, 
node_groups, groups_cfg):
 
     # Try to contact all nodes
     val = {}
+    ssh_port_map = ssconf.SimpleStore().GetSshPortMap()
     for node in nodes:
-      params = groups_cfg.get(node_groups.get(node))
-      ssh_port = params["ndparams"].get(constants.ND_SSH_PORT)
-      logging.debug("Ssh port %s (None = default) for node %s",
-                    str(ssh_port), node)
-
       # We only test if master candidates can communicate to other nodes.
       # We cannot test if normal nodes cannot communicate with other nodes,
       # because the administrator might have installed additional SSH keys,
       # over which Ganeti has no power.
       if my_name in mcs:
         success, message = _GetSshRunner(cluster_name). \
-                              VerifyNodeHostname(node, ssh_port)
+                              VerifyNodeHostname(node, ssh_port_map)
         if not success:
           val[node] = message
 
diff --git a/lib/cmdlib/node.py b/lib/cmdlib/node.py
index e9f7618..50e86ce 100644
--- a/lib/cmdlib/node.py
+++ b/lib/cmdlib/node.py
@@ -312,7 +312,6 @@ class LUNodeAdd(LogicalUnit):
           [node_name], vparams, cname,
           self.cfg.GetClusterInfo().hvparams,
           {node_name: self.node_group},
-          self.cfg.GetAllNodeGroupsInfoDict()
         )[node_name]
       (errmsgs, _) = CheckNodePVs(result.payload, excl_stor)
       if errmsgs:
diff --git a/lib/rpc_defs.py b/lib/rpc_defs.py
index b38ea1f..aceb768 100644
--- a/lib/rpc_defs.py
+++ b/lib/rpc_defs.py
@@ -514,8 +514,6 @@ _NODE_CALLS = [
     ("cluster_name", None, "Cluster name"),
     ("all_hvparams", None, "Dictionary mapping hypervisor names to hvparams"),
     ("node_groups", None, "node names mapped to their group uuids"),
-    ("groups_cfg", None,
-      "a dictionary mapping group uuids to their configuration"),
     ], None, None, "Request verification of given parameters"),
   ("node_volumes", MULTI, None, constants.RPC_TMO_FAST, [], None, None,
    "Gets all volumes on node(s)"),
diff --git a/lib/server/noded.py b/lib/server/noded.py
index 880f2e1..4ce0421 100644
--- a/lib/server/noded.py
+++ b/lib/server/noded.py
@@ -821,9 +821,9 @@ class NodeRequestHandler(http.server.HttpServerHandler):
     """Run a verify sequence on this node.
 
     """
-    (what, cluster_name, hvparams, node_groups, groups_cfg) = params
+    (what, cluster_name, hvparams, node_groups) = params
     return backend.VerifyNode(what, cluster_name, hvparams,
-                              node_groups, groups_cfg)
+                              node_groups)
 
   @classmethod
   def perspective_node_verify_light(cls, params):
diff --git a/test/py/ganeti.backend_unittest.py 
b/test/py/ganeti.backend_unittest.py
index 68b2eee..9f58957 100755
--- a/test/py/ganeti.backend_unittest.py
+++ b/test/py/ganeti.backend_unittest.py
@@ -135,7 +135,7 @@ class TestNodeVerify(testutils.GanetiTestCase):
     local_data = (netutils.Hostname.GetSysName(),
                   constants.IP4_ADDRESS_LOCALHOST)
     result = backend.VerifyNode({constants.NV_MASTERIP: local_data},
-                                None, {}, {}, {})
+                                None, {}, {})
     self.failUnless(constants.NV_MASTERIP in result,
                     "Master IP data not returned")
     self.failUnless(result[constants.NV_MASTERIP], "Cannot reach localhost")
@@ -147,7 +147,7 @@ class TestNodeVerify(testutils.GanetiTestCase):
     # we just test that whatever TcpPing returns, VerifyNode returns too
     netutils.TcpPing = lambda a, b, source=None: False
     result = backend.VerifyNode({constants.NV_MASTERIP: bad_data},
-                                None, {}, {}, {})
+                                None, {}, {})
     self.failUnless(constants.NV_MASTERIP in result,
                     "Master IP data not returned")
     self.failIf(result[constants.NV_MASTERIP],
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to