Nir Soffer has uploaded a new change for review.
Change subject: sp: Streamline usage of image.Image class ......................................................................
sp: Streamline usage of image.Image class
We used to create an image.Image an call a method in one line, making the code hard to read for no benefit. Separate creation of the image from the call.
Change-Id: Icc9de180542cd81a6d563d52b4b30b9520046469 Signed-off-by: Nir Soffer nsoffer@redhat.com --- M vdsm/storage/sp.py 1 file changed, 16 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/65049/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index 3297588..b317e7f 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -1528,7 +1528,8 @@ with nested(rm.acquireResource(src_img_ns, srcImgUUID, rm.SHARED), rm.acquireResource(dst_img_ns, dstImgUUID, rm.EXCLUSIVE) ): - dstUUID = image.Image(self.poolPath).copyCollapsed( + img = image.Image(self.poolPath) + dstUUID = img.copyCollapsed( sdUUID, vmUUID, srcImgUUID, srcVolUUID, dstImgUUID, dstVolUUID, descr, dstSdUUID, volType, volFormat, preallocate, postZero, force) @@ -1571,8 +1572,9 @@
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) + img = image.Image(self.poolPath) + img.move(srcDomUUID, dstDomUUID, imgUUID, vmUUID, op, postZero, + force)
def sparsifyImage(self, tmpSdUUID, tmpImgUUID, tmpVolUUID, dstSdUUID, dstImgUUID, dstVolUUID): @@ -1610,9 +1612,9 @@ with nested( rm.acquireResource(srcNamespace, tmpImgUUID, rm.EXCLUSIVE), rm.acquireResource(dstNamespace, dstImgUUID, rm.EXCLUSIVE)): - image.Image(self.poolPath).sparsify( - tmpSdUUID, tmpImgUUID, tmpVolUUID, dstSdUUID, dstImgUUID, - dstVolUUID) + img = image.Image(self.poolPath) + img.sparsify(tmpSdUUID, tmpImgUUID, tmpVolUUID, dstSdUUID, + dstImgUUID, dstVolUUID)
def cloneImageStructure(self, sdUUID, imgUUID, dstSdUUID): """ @@ -1638,8 +1640,8 @@ )))
with nested(*resList): - image.Image(self.poolPath).cloneStructure( - sdUUID, imgUUID, dstSdUUID) + img = image.Image(self.poolPath) + img.cloneStructure( sdUUID, imgUUID, dstSdUUID)
def syncImageData(self, sdUUID, imgUUID, dstSdUUID, syncType): """ @@ -1666,8 +1668,8 @@ )))
with nested(*resList): - image.Image(self.poolPath).syncData( - sdUUID, imgUUID, dstSdUUID, syncType) + img = image.Image(self.poolPath) + img.syncData(sdUUID, imgUUID, dstSdUUID, syncType)
def uploadImage(self, methodArgs, sdUUID, imgUUID, volUUID=None): """ @@ -1752,8 +1754,8 @@ dst_img_ns, imgUUID, rm.EXCLUSIVE))
with nested(*resourceList): - image.Image(self.poolPath).multiMove( - srcDomUUID, dstDomUUID, imgDict, vmUUID, force) + img = image.Image(self.poolPath) + img.multiMove( srcDomUUID, dstDomUUID, imgDict, vmUUID, force)
def reconcileVolumeChain(self, sdUUID, imgUUID, leafVolUUID): """ @@ -1798,8 +1800,8 @@ img_ns = sd.getNamespace(sc.IMAGE_NAMESPACE, sdUUID)
with rm.acquireResource(img_ns, imgUUID, rm.EXCLUSIVE): - image.Image(self.poolPath).merge( - sdUUID, vmUUID, imgUUID, ancestor, successor, postZero) + img = image.Image(self.poolPath) + img.merge(sdUUID, vmUUID, imgUUID, ancestor, successor, postZero)
def createVolume(self, sdUUID, imgUUID, size, volFormat, preallocate, diskType, volUUID=None, desc="",
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline usage of image.Image class ......................................................................
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 usage of image.Image class ......................................................................
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'])
Nir Soffer has posted comments on this change.
Change subject: sp: Streamline usage of image.Image class ......................................................................
Patch Set 2: Continuous-Integration+1
Network tests on python 3
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline usage of image.Image class ......................................................................
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 usage of image.Image class ......................................................................
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 usage of image.Image class ......................................................................
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 usage of image.Image class ......................................................................
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'])
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline usage of image.Image class ......................................................................
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'])
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline usage of image.Image class ......................................................................
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'])
Nir Soffer has posted comments on this change.
Change subject: sp: Streamline usage of image.Image class ......................................................................
Patch Set 8: Verified+1
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline usage of image.Image class ......................................................................
Patch Set 9:
* 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 usage of image.Image class ......................................................................
Patch Set 9: Code-Review+1
gerrit-hooks has posted comments on this change.
Change subject: sp: Streamline usage of image.Image class ......................................................................
Patch Set 10:
* 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 usage of image.Image class ......................................................................
Patch Set 10: Code-Review+2
Nir Soffer has submitted this change and it was merged.
Change subject: sp: Streamline usage of image.Image class ......................................................................
sp: Streamline usage of image.Image class
We used to create an image.Image an call a method in one line, making the code hard to read for no benefit. Separate creation of the image from the call.
Change-Id: Icc9de180542cd81a6d563d52b4b30b9520046469 Signed-off-by: Nir Soffer nsoffer@redhat.com Reviewed-on: https://gerrit.ovirt.org/65049 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, 16 insertions(+), 14 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 usage of image.Image class ......................................................................
Patch Set 11:
* Update tracker: IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org