libguestfs/SOURCES/0052-v2v-o-rhv-upload-check...

36 lines
1.2 KiB
Diff

From 303ecfdf662a2fd80b115a1e2f20560e6f97d953 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Thu, 19 Sep 2019 09:52:41 +0200
Subject: [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 6ec74a5d4..7f62b4e3b 100644
--- a/v2v/rhv-upload-plugin.py
+++ b/v2v/rhv-upload-plugin.py
@@ -190,13 +190,13 @@ 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
if time.time() > endt:
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.18.4