Adam Litke has uploaded a new change for review. Change subject: storagetests: Add create_block_volume ......................................................................
storagetests: Add create_block_volume Add a utility function to create a fake block volume. We must make sure the LV is present in our FakeLVM instance with the proper lvtags. Volume metadata is allocated from the fake domain's metadata area. We must also create the directory for the image. Change-Id: I4e1aafd87c4fee5b3f47a63ca7b055009cd006b8 Signed-off-by: Adam Litke <ali...@redhat.com> --- M tests/storagetestlib.py 1 file changed, 16 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/54570/1 diff --git a/tests/storagetestlib.py b/tests/storagetestlib.py index 5184124..c4b6359 100644 --- a/tests/storagetestlib.py +++ b/tests/storagetestlib.py @@ -24,7 +24,7 @@ from storagefakelib import FakeLVM from monkeypatch import MonkeyPatchScope -from storage import sd, blockSD, fileSD, blockVolume +from storage import sd, blockSD, fileSD, image, volume, blockVolume DOM_VER = 3 # The default domain version we are using @@ -136,3 +136,18 @@ for mdfile in mdfiles: make_file(mdfile) return imguuid, voluuid + + +def make_block_volume(lvm, sd_manifest, size, imguuid, voluuid): + sduuid = sd_manifest.sdUUID + image_manifest = image.ImageManifest(sd_manifest.getRepoPath()) + imagedir = image_manifest.getImageDir(sduuid, imguuid) + os.makedirs(imagedir) + lvm.createLV(sduuid, voluuid, size / MB) + with sd_manifest.acquireVolumeMetadataSlot( + voluuid, blockVolume.VOLUME_MDNUMBLKS) as slot: + lvm.addtag(sduuid, voluuid, "%s%s" % (blockVolume.TAG_PREFIX_MD, slot)) + lvm.addtag(sduuid, voluuid, "%s%s" % (blockVolume.TAG_PREFIX_PARENT, + volume.BLANK_UUID)) + lvm.addtag(sduuid, voluuid, "%s%s" % (blockVolume.TAG_PREFIX_IMAGE, + imguuid)) -- To view, visit https://gerrit.ovirt.org/54570 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4e1aafd87c4fee5b3f47a63ca7b055009cd006b8 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Adam Litke <ali...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches