[Libguestfs] [PATCH 1/2] v2v: rhv-upload-plugin: Handle send send failures

Richard W.M. Jones rjones at redhat.com
Wed Aug 22 09:45:35 UTC 2018


On Tue, Aug 21, 2018 at 10:47:01PM +0300, Nir Soffer wrote:
> Here is output when simulating expired ticket in verbose mode.
> 
> unexpected response from imageio server:
> could not write sector offset 1897857024 size 65536
> 403: Forbidden
> b'{"explanation": "Access was denied to this resource.", "code": 403,
> "detail": "Ticket u\'acdad591-f29e-4d85-bf41-046e250aa015\' expired",
> "title": "Forbidden"}'
> nbdkit: python[1]: error:
> /home/nsoffer/src/libguestfs/tmp/v2v.ayEM8r/rhv-upload-plugin.py: pwrite:
> error: ['Traceback (most recent call last):\n', '  File
> "/home/nsoffer/src/libguestfs/tmp/v2v.ayEM8r/rhv-upload-plugin.py", line
> 373, in pwrite\n    (offset, count))\n', '  File
> "/home/nsoffer/src/libguestfs/tmp/v2v.ayEM8r/rhv-upload-plugin.py", line
> 321, in request_failed\n    raise RuntimeError("%s: %d %s: %r" % (msg,
> status, reason, body[:200]))\n', 'RuntimeError: could not write sector
> offset 1897857024 size 65536: 403 Forbidden: b\'{"explanation": "Access was
> denied to this resource.", "code": 403, "detail": "Ticket
> u\\\'acdad591-f29e-4d85-bf41-046e250aa015\\\' expired", "title":
> "Forbidden"}\'\n']
> nbdkit: python[1]: debug: sending error reply: Input/output error
> qemu-img: error while writing sector 3706752: Input/output error

Given the limitation of having to have a single line output in the
error message, this seems like it's doing the right thing to me.

You can (painfully) rewrite the error message to make it look like the
original:

Traceback (most recent call last):
  File "/home/nsoffer/src/libguestfs/tmp/v2v.ayEM8r/rhv-upload-plugin.py", line 373, in pwrite    (offset, count))
  File "/home/nsoffer/src/libguestfs/tmp/v2v.ayEM8r/rhv-upload-plugin.py", line 321, in request_failed    raise RuntimeError("%s: %d %s: %r" % (msg, status, reason, body[:200]))
RuntimeError: could not write sector offset 1897857024 size 65536: 403 Forbidden: b{"explanation": "Access was denied to this resource.", "code": 403, "detail": "Ticket u'acdad591-f29e-4d85-bf41-046e250aa015' expired", "title": "Forbidden"}

So it looks like all the information is still there, particularly
about the expired ticket.

Thanks for testing this,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list