Expand orphan volume test
authorHrvoje Ribicic <riba@google.com>
Thu, 7 May 2015 15:35:38 +0000 (15:35 +0000)
committerHrvoje Ribicic <riba@google.com>
Fri, 8 May 2015 09:50:04 +0000 (11:50 +0200)
to ensure we are not reporting stray volumes on other VGs as orphans.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

test/py/cmdlib/cluster_unittest.py

index 17f6d3e..7097ac8 100644 (file)
@@ -1692,12 +1692,18 @@ class TestLUClusterVerifyGroupVerifyOrphanVolumes(
   @withLockedLU
   def testOrphanedVolume(self, lu):
     master_img = cluster.LUClusterVerifyGroup.NodeImage(uuid=self.master_uuid)
-    master_img.volumes = ["mock_vg/disk_0", "mock_vg/disk_1", "mock_vg/disk_2"]
+    master_img.volumes = [
+      "mock_vg/disk_0",  # Required, present, no error
+      "mock_vg/disk_1",  # Unknown, present, orphan
+      "mock_vg/disk_2",  # Reserved, present, no error
+      "other_vg/disk_0", # Required, present, no error
+      "other_vg/disk_1", # Unknown, present, no error
+                         ]
     node_imgs = {
       self.master_uuid: master_img
     }
     node_vol_should = {
-      self.master_uuid: ["mock_vg/disk_0"]
+      self.master_uuid: ["mock_vg/disk_0", "other_vg/disk_0", "other_vg/disk_1"]
     }
 
     lu._VerifyOrphanVolumes("mock_vg", node_vol_should, node_imgs,
@@ -1705,6 +1711,8 @@ class TestLUClusterVerifyGroupVerifyOrphanVolumes(
     self.mcpu.assertLogContainsRegex("volume mock_vg/disk_1 is unknown")
     self.mcpu.assertLogDoesNotContainRegex("volume mock_vg/disk_0 is unknown")
     self.mcpu.assertLogDoesNotContainRegex("volume mock_vg/disk_2 is unknown")
+    self.mcpu.assertLogDoesNotContainRegex("volume other_vg/disk_0 is unknown")
+    self.mcpu.assertLogDoesNotContainRegex("volume other_vg/disk_1 is unknown")
 
 
 class TestLUClusterVerifyGroupVerifyNPlusOneMemory(