Maor Lipchuk has uploaded a new change for review. Change subject: storagetestlib: Add sdVersion param to the test API. ......................................................................
storagetestlib: Add sdVersion param to the test API. Add a storage domain version when creating a mock for the storage domain, so we can determine if the sd is of version 4 or version 3. Change-Id: I9759fa6d8b2bd7c359fd188d1e18ffbba5004941 Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M tests/storagetestlib.py 1 file changed, 11 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/65308/1 diff --git a/tests/storagetestlib.py b/tests/storagetestlib.py index 959a5fa..d93bb49 100644 --- a/tests/storagetestlib.py +++ b/tests/storagetestlib.py @@ -72,9 +72,9 @@ @contextmanager -def fake_file_env(obj=None): +def fake_file_env(obj=None, sd_version=3): with namedTemporaryDir() as tmpdir: - sd_manifest = make_filesd_manifest(tmpdir) + sd_manifest = make_filesd_manifest(tmpdir, sd_version) fake_sdc = FakeStorageDomainCache() with MonkeyPatchScope([ [sd, 'storage_repository', tmpdir], @@ -89,7 +89,7 @@ @contextmanager -def fake_block_env(obj=None): +def fake_block_env(obj=None, sd_version=3): with namedTemporaryDir() as tmpdir: lvm = FakeLVM(tmpdir) fake_sdc = FakeStorageDomainCache() @@ -101,7 +101,7 @@ (volume, 'sdCache', fake_sdc), (hsm, 'sdCache', fake_sdc), ]): - sd_manifest = make_blocksd_manifest(tmpdir, lvm) + sd_manifest = make_blocksd_manifest(tmpdir, lvm, sd_version) fake_sdc.domains[sd_manifest.sdUUID] = FakeSD(sd_manifest) try: yield FakeBlockEnv(tmpdir, sd_manifest, fake_sdc, lvm) @@ -142,7 +142,8 @@ return md -def make_blocksd_manifest(tmpdir, fake_lvm, sduuid=None, devices=None): +def make_blocksd_manifest(tmpdir, fake_lvm, sduuid=None, devices=None, + sd_version=3): if sduuid is None: sduuid = make_uuid() if devices is None: @@ -159,7 +160,8 @@ fake_lvm.createLV(sduuid, blockSD.MASTERLV, blockSD.MASTERLV_SIZE) # We'll store the domain metadata in the VG's tags - metadata = make_sd_metadata(sduuid, pools=[spuuid]) + metadata = make_sd_metadata(sduuid, version=sd_version, + pools=[spuuid]) assert(metadata[sd.DMDK_VERSION] >= 3) # Tag based MD is V3 and above tag_md = blockSD.TagBasedSDMetadata(sduuid) tag_md.update(metadata) @@ -186,7 +188,7 @@ return os.path.join(domaindir, sd.DOMAIN_META_DATA, sd.METADATA) -def make_filesd_manifest(tmpdir): +def make_filesd_manifest(tmpdir, sd_version=3): spuuid = make_uuid() sduuid = make_uuid() @@ -194,7 +196,8 @@ metafile = get_metafile_path(domain_path) make_file(metafile) metadata = fileSD.FileSDMetadata(metafile) - metadata.update(make_sd_metadata(sduuid, pools=[spuuid])) + metadata.update(make_sd_metadata(sduuid, version=sd_version, + pools=[spuuid])) manifest = fileSD.FileStorageDomainManifest(domain_path, metadata) os.makedirs(os.path.join(manifest.domaindir, sd.DOMAIN_IMAGES)) -- To view, visit https://gerrit.ovirt.org/65308 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9759fa6d8b2bd7c359fd188d1e18ffbba5004941 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org