Bug 1037584

Summary: downloadImage fails getting size from file:// protocol using method http.
Product: Red Hat Enterprise Virtualization Manager Reporter: Sandro Bonazzola <sbonazzo>
Component: vdsmAssignee: Federico Simoncelli <fsimonce>
Status: CLOSED NOTABUG QA Contact: Aharon Canan <acanan>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: abaron, bazulay, dfediuck, fsimonce, hateya, iheim, lpeer, oschreib, pstehlik, scohen, yeylon
Target Milestone: ---Keywords: Triaged
Target Release: 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-03 20:04:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1034777    

Description Sandro Bonazzola 2013-12-03 12:14:33 UTC
vdsClient -s localhost downloadImage "{'url': 'file:///var/tmp/tmpnhXPRe', 'method': 'http'}" 288cf8b3-13e5-4b17-87bf-17882591115b f1ba6631-4ee6-4667-9fe5-a7de06a10b43 e6ccdabd-0109-40ad-94a0-a5d4aad6ee15 defac5f2-36b3-495d-a98c-cd13efbd98fc


Traceback (most recent call last):
File "/usr/share/vdsm/storage/task.py", line 857, in _run
return fn(*args, **kargs)
File "/usr/share/vdsm/storage/task.py", line 318, in run
return self.cmd(*self.argslist, **self.argsdict)
File "/usr/share/vdsm/storage/securable.py", line 68, in wrapper
return f(self, *args, **kwargs)
File "/usr/share/vdsm/storage/sp.py", line 1790, in downloadImage
.download(methodArgs, sdUUID, imgUUID, volUUID)
File "/usr/share/vdsm/storage/image.py", line 1172, in download
vol.extend(imageSharing.getSize(methodArgs) / volume.BLOCK_SIZE)
File "/usr/share/vdsm/storage/imageSharing.py", line 78, in getSize
return getSizeImpl(methodArgs)
File "/usr/share/vdsm/storage/imageSharing.py", line 44, in httpGetSize
raise RuntimeError("Unable to determine image size")
RuntimeError: Unable to determine image size

The command causing that error is:
# /usr/bin/curl -q --silent --fail --show-error --head file:///var/tmp/tmpnhXPRe
Content-Length: 21474836480
Accept-ranges: bytes
Last-Modified: Tue, 03 Dec 2013 11:20:45 GMT
# echo $?
0


originally observed while verifying http://gerrit.ovirt.org/#/c/21923/

We're using file:// because downloadImage doesn't support local has method (bug #1037500 )

Comment 1 Federico Simoncelli 2013-12-03 19:15:22 UTC
(In reply to Sandro Bonazzola from comment #0)
> vdsClient -s localhost downloadImage "{'url': 'file:///var/tmp/tmpnhXPRe',
> 'method': 'http'}" 288cf8b3-13e5-4b17-87bf-17882591115b
> f1ba6631-4ee6-4667-9fe5-a7de06a10b43 e6ccdabd-0109-40ad-94a0-a5d4aad6ee15
> defac5f2-36b3-495d-a98c-cd13efbd98fc

WRT:

{'url': 'file:///var/tmp/tmpnhXPRe', 'method': 'http'}

You are using the downloadImage HTTP method to, instead, do a local copy from a file:/// url.
Luckily it fails. You shouldn't be exploiting an internal implementation (curl) in order to achieve something that downloadImage (http method) wasn't designed for.

I'd prefer to address this with bug 1037500.

Comment 2 Sergey Gotliv 2013-12-03 20:04:58 UTC
Closed based on comment 1.