On Mon, May 16, 2011 at 3:19 PM, Iustin Pop <[email protected]> wrote:

Interdiff, to make clear that my_ and all_ are for now the same, and
adding the assert:
(I can submit as a separate patch to differentiate from dato's code,
or merge in the same commit)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 81b53ff..2c954bb 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -1391,18 +1391,10 @@ class LUClusterVerify(LogicalUnit):
   def CheckPrereq(self):
     self.all_node_info = self.cfg.GetAllNodesInfo()
     self.all_inst_info = self.cfg.GetAllInstancesInfo()
-
-    self.my_node_names = utils.NiceSort([n.name
-                                         for n in self.all_node_info.values()])
-
-    self.my_node_info = dict((name, self.all_node_info[name])
-                             for name in self.my_node_names)
-
-    self.my_inst_names = utils.NiceSort([i.name
-                                         for i in self.all_inst_info.values()])
-
-    self.my_inst_info = dict((name, self.all_inst_info[name])
-                             for name in self.my_inst_names)
+    self.my_node_names = utils.NiceSort(list(self.all_node_info))
+    self.my_node_info = self.all_node_info
+    self.my_inst_names = utils.NiceSort(list(self.all_inst_info))
+    self.my_inst_info = self.all_inst_info

   def _Error(self, ecode, item, msg, *args, **kwargs):
     """Format an error message.
@@ -2252,6 +2244,8 @@ class LUClusterVerify(LogicalUnit):
     """Build hooks nodes.

     """
+    assert self.my_node_names, ("Node list not gathered,"
+      " has CheckPrereq been executed?")
     return ([], self.my_node_names)

   def Exec(self, feedback_fn):

Reply via email to