Adam Litke has uploaded a new change for review.
Change subject: ImageManifest: create_image_dir ......................................................................
ImageManifest: create_image_dir
Change-Id: I94a8cfdd9fb1f3c3fd4e4e2ab409bfd287829351 Signed-off-by: Adam Litke alitke@redhat.com --- M tests/image_manifest_tests.py M vdsm/storage/image.py 2 files changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/43557/1
diff --git a/tests/image_manifest_tests.py b/tests/image_manifest_tests.py index a2ac1c0..a27eabd 100644 --- a/tests/image_manifest_tests.py +++ b/tests/image_manifest_tests.py @@ -23,6 +23,7 @@ from testlib import VdsmTestCase, namedTemporaryDir
from storage import sd, image +from storage.sdm import sdm_verb
class ImageManifestTests(VdsmTestCase): @@ -33,3 +34,14 @@ manifest = image.ImageManifest(tmpdir) expected = os.path.join(tmpdir, sduuid, sd.DOMAIN_IMAGES, imguuid) self.assertEquals(expected, manifest.getImageDir(sduuid, imguuid)) + + @sdm_verb + def test_create_image_dir(self): + with namedTemporaryDir() as tmpdir: + sduuid = str(uuid.uuid4()) + imguuid = str(uuid.uuid4()) + manifest = image.ImageManifest(tmpdir) + os.makedirs(os.path.join(tmpdir, sduuid, sd.DOMAIN_IMAGES)) + manifest.create_image_dir(sduuid, imguuid) + self.assertTrue(os.path.exists(manifest.getImageDir(sduuid, + imguuid))) \ No newline at end of file diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py index 81b2043..5f87921 100644 --- a/vdsm/storage/image.py +++ b/vdsm/storage/image.py @@ -38,6 +38,7 @@ from threadLocal import vars import resourceFactories import resourceManager as rm +from sdm import require_sdm
log = logging.getLogger('Storage.Image') rmanager = rm.ResourceManager.getInstance() @@ -97,6 +98,13 @@ """ return os.path.join(self.repoPath, sdUUID, sd.DOMAIN_IMAGES, imgUUID)
+ @require_sdm + def create_image_dir(self, sd_id, img_id): + img_dir = self.getImageDir(sd_id, img_id) + if not os.path.isdir(img_dir): + log.info("Create placeholder %s for image's volumes", img_dir) + os.mkdir(img_dir) + return img_dir
class Image: """ Actually represents a whole virtual disk.
automation@ovirt.org has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 5:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 6:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 7:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 8:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Jenkins CI RO has abandoned this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Abandoned
Abandoned due to no activity - please restore if still relevant
gerrit-hooks has posted comments on this change.
Change subject: ImageManifest: create_image_dir ......................................................................
Patch Set 9:
* Update tracker: IGNORE, no Bug-Url found
vdsm-patches@lists.fedorahosted.org