Pino Toscano
2019-Sep-19 10:38 UTC
[Libguestfs] [PATCH] v2v: -o rhv-upload: check for a valid image transfer right away
Check for the INITIALIZING state of the image transfer right away, without waiting 5 seconds even before the first time: this way, if the transfer is already in the right state then there is no need to wait. --- v2v/rhv-upload-plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py index 51a7f381a..685680213 100644 --- a/v2v/rhv-upload-plugin.py +++ b/v2v/rhv-upload-plugin.py @@ -188,7 +188,6 @@ def open(readonly): # actual transfer can start when its status is "Transferring". endt = time.time() + timeout while True: - time.sleep(5) transfer = transfer_service.get() if transfer.phase != types.ImageTransferPhase.INITIALIZING: break @@ -196,6 +195,7 @@ def open(readonly): transfer_service.cancel() raise RuntimeError("timed out waiting for transfer status " "!= INITIALIZING") + time.sleep(5) # Now we have permission to start the transfer. if params['rhv_direct']: -- 2.21.0
Martin Kletzander
2019-Sep-19 11:17 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: check for a valid image transfer right away
On Thu, Sep 19, 2019 at 12:38:40PM +0200, Pino Toscano wrote:>Check for the INITIALIZING state of the image transfer right away, >without waiting 5 seconds even before the first time: this way, if the >transfer is already in the right state then there is no need to wait. >--- > v2v/rhv-upload-plugin.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >ACK, I wonder if you found it by just looking at the code or you have experienced it.
Richard W.M. Jones
2019-Sep-19 18:44 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: check for a valid image transfer right away
On Thu, Sep 19, 2019 at 12:38:40PM +0200, Pino Toscano wrote:> Check for the INITIALIZING state of the image transfer right away, > without waiting 5 seconds even before the first time: this way, if the > transfer is already in the right state then there is no need to wait. > --- > v2v/rhv-upload-plugin.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py > index 51a7f381a..685680213 100644 > --- a/v2v/rhv-upload-plugin.py > +++ b/v2v/rhv-upload-plugin.py > @@ -188,7 +188,6 @@ def open(readonly): > # actual transfer can start when its status is "Transferring". > endt = time.time() + timeout > while True: > - time.sleep(5) > transfer = transfer_service.get() > if transfer.phase != types.ImageTransferPhase.INITIALIZING: > break > @@ -196,6 +195,7 @@ def open(readonly): > transfer_service.cancel() > raise RuntimeError("timed out waiting for transfer status " > "!= INITIALIZING") > + time.sleep(5) > > # Now we have permission to start the transfer. > if params['rhv_direct']:Obvious fix, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Seemingly Similar Threads
- [PATCH] v2v: -o rhv-upload: cancel disk transfer on open failure
- [PATCH] rhv-upload: Fix waiting for transfer
- [PATCH] v2v: rhv-upload-plugin - improve wait logic after finalize (RHBZ#1680361)
- [PATCH] v2v: rhv-plugin: Use string literal concatenation
- Re: [PATCH] v2v: rhv-upload-plugin - improve wait logic after finalize (RHBZ#1680361)