[Libguestfs] [PATCH 10/18] rhv-upload: Try to remove disk on timeout
Nir Soffer
nsoffer at redhat.com
Mon Nov 18 15:59:11 UTC 2019
On Mon, Nov 18, 2019 at 2:38 PM Daniel Erez <derez at redhat.com> wrote:
>
>
>
> On Mon, Nov 18, 2019 at 1:53 AM Nir Soffer <nsoffer at redhat.com> wrote:
>>
>> On Mon, Nov 18, 2019 at 1:05 AM Nir Soffer <nirsof at gmail.com> wrote:
>> >
>> > If waiting for the disk to become OK times out, try to remove it. This
>> > is likely to fail.
>>
>> Daniel, do you think this can succeed?
>
>
> seems redundant, as remove disk will surely fail when the disk is still locked.
Thanks, will remove it in v2.
>> > ---
>> > v2v/rhv-upload-plugin.py | 7 ++++++-
>> > 1 file changed, 6 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
>> > index 9b433bd7e..e79e7ddf7 100644
>> > --- a/v2v/rhv-upload-plugin.py
>> > +++ b/v2v/rhv-upload-plugin.py
>> > @@ -575,6 +575,11 @@ def create_disk(connection):
>> > if disk.status == types.DiskStatus.OK:
>> > break
>> > if time.time() > endt:
>> > - raise RuntimeError("timed out waiting for disk to become unlocked")
>> > + try:
>> > + disk_service.remove()
>> > + except Exception as e:
>> > + debug("error removing disk %s: %s" % (disk.id, e))
>
>
> the following couple of lines looks good, perhaps extract to another patch?
Right, will keep this in v2.
>
>>
>> > + raise RuntimeError(
>> > + "timed out waiting for disk %s to become unlocked" % disk.id)
>
>
>> >
>> > return disk
>> > --
>> > 2.21.0
>> >
>>
More information about the Libguestfs
mailing list