On Mon, Nov 18, 2019 at 1:05 AM Nir Soffer <nirsof@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
>