Nir Soffer has uploaded a new change for review.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
sp: Streamline acquiring of multiple images locks
Replace srcImageResourcesNamespace and dstImageResourcesNamespace with src_img_ns and dst_img_ns, streamlining code creating the namespace and using them.
Change-Id: I20bcebeb11f3ccbe10b029a424f4c27a890eea8c Signed-off-by: Nir Soffer nsoffer@redhat.com --- M vdsm/storage/sp.py 1 file changed, 13 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/65041/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index eb0ca1d..11b3287 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -1523,18 +1523,14 @@ :returns: a dict containing the UUID of the newly created image. :rtype: dict """ - srcImageResourcesNamespace = sd.getNamespace(sc.IMAGE_NAMESPACE, - sdUUID) + src_img_ns = sd.getNamespace(sc.IMAGE_NAMESPACE, sdUUID) if dstSdUUID not in (sdUUID, sd.BLANK_UUID): - dstImageResourcesNamespace = sd.getNamespace(sc.IMAGE_NAMESPACE, - dstSdUUID) + dst_img_ns = sd.getNamespace(sc.IMAGE_NAMESPACE, dstSdUUID) else: - dstImageResourcesNamespace = srcImageResourcesNamespace + dst_img_ns = src_img_ns
- with nested(rm.acquireResource(srcImageResourcesNamespace, - srcImgUUID, rm.SHARED), - rm.acquireResource(dstImageResourcesNamespace, - dstImgUUID, rm.EXCLUSIVE) + with nested(rm.acquireResource(src_img_ns, srcImgUUID, rm.SHARED), + rm.acquireResource(dst_img_ns, dstImgUUID, rm.EXCLUSIVE) ): dstUUID = image.Image(self.poolPath).copyCollapsed( sdUUID, vmUUID, srcImgUUID, srcVolUUID, dstImgUUID, @@ -1566,10 +1562,8 @@ :param force: Should the operation be forced. :type force: bool """ - srcImageResourcesNamespace = sd.getNamespace(sc.IMAGE_NAMESPACE, - srcDomUUID) - dstImageResourcesNamespace = sd.getNamespace(sc.IMAGE_NAMESPACE, - dstDomUUID) + src_img_ns = sd.getNamespace(sc.IMAGE_NAMESPACE, srcDomUUID) + dst_img_ns = sd.getNamespace(sc.IMAGE_NAMESPACE, dstDomUUID) # For MOVE_OP acquire exclusive lock # For COPY_OP shared lock is enough if op == image.MOVE_OP: @@ -1579,10 +1573,8 @@ else: raise se.MoveImageError(imgUUID)
- with nested(rm.acquireResource(srcImageResourcesNamespace, - imgUUID, srcLock), - rm.acquireResource(dstImageResourcesNamespace, - imgUUID, rm.EXCLUSIVE)): + with nested(rm.acquireResource(src_img_ns, imgUUID, srcLock), + rm.acquireResource(dst_img_ns, imgUUID, rm.EXCLUSIVE)): image.Image(self.poolPath).move(srcDomUUID, dstDomUUID, imgUUID, vmUUID, op, postZero, force)
@@ -1758,10 +1750,8 @@ :param force: Should the operation be forced. :type force: bool """ - srcImageResourcesNamespace = sd.getNamespace(sc.IMAGE_NAMESPACE, - srcDomUUID) - dstImageResourcesNamespace = sd.getNamespace(sc.IMAGE_NAMESPACE, - dstDomUUID) + src_img_ns = sd.getNamespace(sc.IMAGE_NAMESPACE, srcDomUUID) + dst_img_ns = sd.getNamespace(sc.IMAGE_NAMESPACE, dstDomUUID)
imgList = imgDict.keys() imgList.sort() @@ -1769,9 +1759,9 @@ resourceList = [] for imgUUID in imgList: resourceList.append(rm.acquireResource( - srcImageResourcesNamespace, imgUUID, rm.EXCLUSIVE)) + src_img_ns, imgUUID, rm.EXCLUSIVE)) resourceList.append(rm.acquireResource( - dstImageResourcesNamespace, imgUUID, rm.EXCLUSIVE)) + dst_img_ns, imgUUID, rm.EXCLUSIVE))
with nested(*resourceList): image.Image(self.poolPath).multiMove(
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
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.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
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.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
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.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
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.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
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.6', 'ovirt-4.0'])
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
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.6', 'ovirt-4.0'])
Nir Soffer has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
Patch Set 6: Verified+1
Nir Soffer has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
Patch Set 6: Continuous-Integration+1
Test failures not relevant.
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
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.6', 'ovirt-4.0'])
Freddy Rolland has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
Patch Set 7: Code-Review+1
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
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.6', 'ovirt-4.0'])
Adam Litke has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
Patch Set 8: Code-Review+2
Nir Soffer has submitted this change and it was merged.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
sp: Streamline acquiring of multiple images locks
Replace srcImageResourcesNamespace and dstImageResourcesNamespace with src_img_ns and dst_img_ns, streamlining code creating the namespace and using them.
Change-Id: I20bcebeb11f3ccbe10b029a424f4c27a890eea8c Signed-off-by: Nir Soffer nsoffer@redhat.com Reviewed-on: https://gerrit.ovirt.org/65041 Reviewed-by: Freddy Rolland frolland@redhat.com Continuous-Integration: Jenkins CI Reviewed-by: Adam Litke alitke@redhat.com --- M vdsm/storage/sp.py 1 file changed, 13 insertions(+), 23 deletions(-)
Approvals: Adam Litke: Looks good to me, approved Nir Soffer: Verified Jenkins CI: Passed CI tests Freddy Rolland: Looks good to me, but someone else must approve
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline acquiring of multiple images locks ......................................................................
Patch Set 9:
* Update tracker: IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org