def test_domain_metadata_io(self): with fake_file_env() as env: desc = 'foo' set_domain_metaparams(env.sd_manifest, {sd.DMDK_DESCRIPTION: desc}) # Test that metadata is persisted to our temporary storage area domain_dir = env.sd_manifest.domaindir manifest = fileSD.FileStorageDomainManifest(domain_dir) self.assertEqual(desc, manifest.getMetaParam(sd.DMDK_DESCRIPTION))
def make_filesd_manifest(tmpdir, metadata=None): sduuid = str(uuid.uuid4()) domain_path = os.path.join(tmpdir, sduuid) make_file(get_metafile_path(domain_path)) if metadata is None: metadata = FakeMetadata() manifest = fileSD.FileStorageDomainManifest(domain_path, metadata) os.makedirs(os.path.join(manifest.domaindir, sduuid, sd.DOMAIN_IMAGES)) return manifest
def make_filesd_manifest(tmpdir): spuuid = make_uuid() sduuid = make_uuid() domain_path = os.path.join(tmpdir, spuuid, sduuid) metafile = get_metafile_path(domain_path) make_file(metafile) metadata = fileSD.FileSDMetadata(metafile) metadata.update(make_sd_metadata(sduuid, pools=[spuuid])) manifest = fileSD.FileStorageDomainManifest(domain_path, metadata) os.makedirs(os.path.join(manifest.domaindir, sd.DOMAIN_IMAGES)) return manifest