Change in vdsm[master]: tests: Add test_overwrite_blocksize test

alitke at redhat.com alitke at redhat.com
Fri Mar 11 21:44:30 UTC 2016


Adam Litke has uploaded a new change for review.

Change subject: tests: Add test_overwrite_blocksize test
......................................................................

tests: Add test_overwrite_blocksize test

The BlockStorageDomainManifest has special behavior with respect to its
logBlkSize and phyBlkSize properties.  These are set at object
construction time from the passed metadata but are not updated when
replaceMetadata is called (even if the new metadata specifies new
sizes).  This test verifies that values are not overridden by
replaceMetadata but that non-default values can be provided during
object construction.

Change-Id: I85fc8ad393aff49154d9d414bd6474a723b315f1
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M tests/domain_manifest_test.py
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/54669/1

diff --git a/tests/domain_manifest_test.py b/tests/domain_manifest_test.py
index 74d359f..3b5cde9 100644
--- a/tests/domain_manifest_test.py
+++ b/tests/domain_manifest_test.py
@@ -111,6 +111,24 @@
             self.assertEquals(512, env.sd_manifest.logBlkSize)
             self.assertEquals(512, env.sd_manifest.phyBlkSize)
 
+    def test_overwrite_blocksize(self):
+        metadata = {sd.DMDK_VERSION: 3,
+                    blockSD.DMDK_LOGBLKSIZE: 2048,
+                    blockSD.DMDK_PHYBLKSIZE: 1024}
+        with fake_block_env() as env:
+            # Replacing the metadata will not overwrite these values since they
+            # are set only in the manifest constructor.
+            env.sd_manifest.replaceMetadata(metadata)
+            self.assertEquals(512, env.sd_manifest.logBlkSize)
+            self.assertEquals(512, env.sd_manifest.phyBlkSize)
+
+            # If we supply values in the metadata used to construct the
+            # manifest then those values will apply.
+            new_manifest = blockSD.BlockStorageDomainManifest(
+                env.sd_manifest.sdUUID, metadata)
+            self.assertEquals(2048, new_manifest.logBlkSize)
+            self.assertEquals(1024, new_manifest.phyBlkSize)
+
 
 class BlockDomainMetadataSlotTests(VdsmTestCase):
 


-- 
To view, visit https://gerrit.ovirt.org/54669
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85fc8ad393aff49154d9d414bd6474a723b315f1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>


More information about the vdsm-patches mailing list