Bug 1402331

Summary: Unable to upload disk via API
Product: [oVirt] ovirt-imageio Reporter: Ondra Machacek <omachace>
Component: DaemonAssignee: Amit Aviram <aaviram>
Status: CLOSED NOTABUG QA Contact: Raz Tamir <ratamir>
Severity: high Docs Contact:
Priority: unspecified    
Version: ---CC: amureini, bugs, tnisan, ylavi
Target Milestone: ---Flags: rule-engine: ovirt-4.0.z+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-07 10:40:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ondra Machacek 2016-12-07 09:26:09 UTC
Every time I upload disk via API it failed on following exception:

 2016-12-07 09:06:58,529 ERROR   (Thread-1) [web] Failed to dispatch request
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ovirt_imageio_common/web.py", line 48, in __call__
    resp = self.dispatch(request)
  File "/usr/lib/python2.7/site-packages/ovirt_imageio_common/web.py", line 74, in dispatch
    return method(*match.groups())
  File "/usr/lib/python2.7/site-packages/ovirt_imageio_daemon/server.py", line 184, in put
    ticket = get_ticket(ticket_id, "write", offset + size)
  File "/usr/lib/python2.7/site-packages/ovirt_imageio_daemon/server.py", line 160, in get_ticket
    raise HTTPForbidden("Content-Length(%d) out of allowed range(%d)" %( size, ticket['size']))
HTTPForbidden: Content-Length(8388608) out of allowed range(1024)

The failed code is here:
https://github.com/oVirt/ovirt-imageio/blob/master/daemon/ovirt_imageio_daemon/server.py#L159

When I remove this condition everything works fine.

The code I use to upload disk is here:

 https://gerrit.ovirt.org/#/c/65962/

Comment 1 Ondra Machacek 2016-12-07 10:40:36 UTC
The problem was that the disk created by the script was created as 1**20, which is 1KiB. So wasn't possible to upload the real disk data there which was 21MiB, closing as not a bug.