[Libguestfs] [nbdkit PATCH] retry: Tweak error message
Eric Blake
eblake at redhat.com
Thu Apr 2 12:38:08 UTC 2020
On 4/2/20 4:40 AM, Richard W.M. Jones wrote:
>> with your suggestion, we'd have:
>>
>> initial try fails:
>> retry 1: original error
>> delay
>> retry 1 fails:
>> retry 2: original error
>> delay
>> retry 2 fails:
>> could not recover after 2 retries
>>
>> where we lost the log of the errno of retry 2.
>
> It's not printed, but also it's not lost. do_retry will immediately
> return false, causing the called function to return this final errno
> (hopefully back to the client). The reason for printing the "original
> errno" was because those intermediate errnos would otherwise be lost.
Good point.
>
> Attached is my suggested patch - it's a small evolution on top of
> yours. The output is now:
>
> $ rm -f /tmp/inject ; (sleep 5s; touch /tmp/inject ) & ./nbdkit -f -v -U - null size=1G --filter=retry --filter=noextents --filter=error error-rate=100% error-file=/tmp/inject --filter=delay rdelay=1 retries=3 --run 'qemu-img convert $nbd /var/tmp/out.img'
>
> nbdkit: null[1]: error: injecting EIO error into pread
> nbdkit: null[1]: debug: pread failed: original errno = 5
> nbdkit: null[1]: debug: retry 1: waiting 2 seconds before retrying
>
> nbdkit: null[1]: error: injecting EIO error into pread
> nbdkit: null[1]: debug: pread failed: original errno = 5
> nbdkit: null[1]: debug: retry 2: waiting 4 seconds before retrying
>
> nbdkit: null[1]: error: injecting EIO error into pread
> nbdkit: null[1]: debug: pread failed: original errno = 5
> nbdkit: null[1]: debug: retry 3: waiting 8 seconds before retrying
>
> nbdkit: null[1]: error: injecting EIO error into pread
> nbdkit: null[1]: debug: could not recover after 3 retries
> nbdkit: null[1]: debug: sending error reply: Input/output error
>
Yes, this is looking better. Let's go for it.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the Libguestfs
mailing list