Hello Dan Kenigsberg, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/19284 to review the following change. Change subject: imageSharing: return proper size in httpGetSize ...................................................................... imageSharing: return proper size in httpGetSize When importing images from OpenStack Glance the Content-Length is 0 so we need to override the value with the content of the custom header X-Image-Meta-Size. Change-Id: Icbcc601767d7f5b044b9e0e32f35abccdfb5746b Signed-off-by: Federico Simoncelli <fsimo...@redhat.com> Reviewed-on: http://gerrit.ovirt.org/19222 Reviewed-by: Dan Kenigsberg <dan...@redhat.com> --- M vdsm/storage/imageSharing.py 1 file changed, 10 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/19284/1 diff --git a/vdsm/storage/imageSharing.py b/vdsm/storage/imageSharing.py index 5db0a4e..26f299a 100644 --- a/vdsm/storage/imageSharing.py +++ b/vdsm/storage/imageSharing.py @@ -29,11 +29,18 @@ headers = curlImgWrap.head(methodArgs.get('url'), methodArgs.get("headers", {})) + size = None + if 'Content-Length' in headers: size = int(headers['Content-Length']) - elif 'X-Image-Meta-Size' in headers: - size = int(headers['X-Image-Meta-Size']) - else: + + # OpenStack Glance returns Content-Length = 0 so we need to + # override the value with the content of the custom header + # X-Image-Meta-Size. + if 'X-Image-Meta-Size' in headers: + size = max(size, int(headers['X-Image-Meta-Size'])) + + if size is None: raise RuntimeError("Unable to determine image size") return size -- To view, visit http://gerrit.ovirt.org/19284 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icbcc601767d7f5b044b9e0e32f35abccdfb5746b Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-3.3 Gerrit-Owner: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches