[Libguestfs] [PATCH 10/18] rhv-upload: Try to remove disk on timeout

Daniel Erez derez at redhat.com
Mon Nov 18 12:37:50 UTC 2019


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.


>
> > ---
> >  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?


> > +            raise RuntimeError(
> > +                "timed out waiting for disk %s to become unlocked" %
> disk.id)
>

>
> >      return disk
> > --
> > 2.21.0
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20191118/d5ac13bf/attachment.htm>


More information about the Libguestfs mailing list