Change in vdsm[master]: tests: Set common StorageDomainManifest fields automatically

alitke at redhat.com alitke at redhat.com
Tue Nov 17 19:36:53 UTC 2015


Adam Litke has uploaded a new change for review.

Change subject: tests: Set common StorageDomainManifest fields automatically
......................................................................

tests: Set common StorageDomainManifest fields automatically

When creating storage domains it is common to request the same set of
fields to be included in the initial metadata.  Do this automatically
for tests which do not supply their own starting metadata.

Change-Id: Ideac50c4a3cb5490669ff7b036019b8a88bcc54b
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M tests/storagetestlib.py
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/48693/1

diff --git a/tests/storagetestlib.py b/tests/storagetestlib.py
index f3585cc..16248c1 100644
--- a/tests/storagetestlib.py
+++ b/tests/storagetestlib.py
@@ -35,13 +35,21 @@
         yield
 
 
+def get_default_metadata():
+    md = FakeMetadata()
+    md[sd.DMDK_VERSION] = 3
+    md[sd.DMDK_CLASS] = sd.DATA_DOMAIN
+    md[sd.DMDK_POOLS] = [str(uuid.uuid4())]
+    return md
+
+
 def make_blocksd(tmpdir, fake_lvm, sduuid=None, devices=None, metadata=None):
     if sduuid is None:
         sduuid = str(uuid.uuid4())
     if devices is None:
         devices = get_random_devices()
     if metadata is None:
-        metadata = FakeMetadata({sd.DMDK_VERSION: 3})
+        metadata = get_default_metadata()
 
     fake_lvm.createVG(sduuid, devices, blockSD.STORAGE_DOMAIN_TAG,
                       blockSD.VG_METADATASIZE)
@@ -72,7 +80,7 @@
     domain_path = os.path.join(tmpdir, sduuid)
     make_file(get_metafile_path(domain_path))
     if metadata is None:
-        metadata = FakeMetadata({sd.DMDK_VERSION: 3})
+        metadata = get_default_metadata()
     manifest = fileSD.FileStorageDomainManifest(domain_path, metadata)
     os.makedirs(os.path.join(manifest.domaindir, sduuid, sd.DOMAIN_IMAGES))
     return manifest


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ideac50c4a3cb5490669ff7b036019b8a88bcc54b
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