LUClusterVerifyGroup: Localize virtual file paths
authorMichael Hanselmann <hansmi@google.com>
Thu, 4 Oct 2012 23:58:34 +0000 (01:58 +0200)
committerMichael Hanselmann <hansmi@google.com>
Thu, 11 Oct 2012 10:05:38 +0000 (12:05 +0200)
The check for file consistency didn't properly handle virtual paths
in case of a virtual cluster. This didn't cause any breakage as in
a standard virtual cluster setup with only one node all files are
visible for every node.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/backend.py
lib/cmdlib.py

index e1a410f..0a7f4c4 100644 (file)
@@ -647,8 +647,11 @@ def VerifyNode(what, cluster_name):
         tmp.append((source, hv_name, str(err)))
 
   if constants.NV_FILELIST in what:
-    result[constants.NV_FILELIST] = utils.FingerprintFiles(
-      what[constants.NV_FILELIST])
+    fingerprints = utils.FingerprintFiles(map(vcluster.LocalizeVirtualPath,
+                                              what[constants.NV_FILELIST]))
+    result[constants.NV_FILELIST] = \
+      dict((vcluster.MakeVirtualPath(key), value)
+           for (key, value) in fingerprints.items())
 
   if constants.NV_NODELIST in what:
     (nodes, bynode) = what[constants.NV_NODELIST]
index 62ba065..ba13cac 100644 (file)
@@ -60,6 +60,7 @@ from ganeti import ht
 from ganeti import rpc
 from ganeti import runtime
 from ganeti import pathutils
+from ganeti import vcluster
 from ganeti.masterd import iallocator
 
 import ganeti.masterd.instance # pylint: disable=W0611
@@ -2565,7 +2566,10 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
       if nresult.fail_msg or not nresult.payload:
         node_files = None
       else:
-        node_files = nresult.payload.get(constants.NV_FILELIST, None)
+        fingerprints = nresult.payload.get(constants.NV_FILELIST, None)
+        node_files = dict((vcluster.LocalizeVirtualPath(key), value)
+                          for (key, value) in fingerprints.items())
+        del fingerprints
 
       test = not (node_files and isinstance(node_files, dict))
       errorif(test, constants.CV_ENODEFILECHECK, node.name,
@@ -3089,9 +3093,10 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
 
     node_verify_param = {
       constants.NV_FILELIST:
-        utils.UniqueSequence(filename
-                             for files in filemap
-                             for filename in files),
+        map(vcluster.MakeVirtualPath,
+            utils.UniqueSequence(filename
+                                 for files in filemap
+                                 for filename in files)),
       constants.NV_NODELIST:
         self._SelectSshCheckNodes(node_data_list, self.group_uuid,
                                   self.all_node_info.values()),