mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0043-v2v-o-rhv-upload-check-for-a-valid-image-transfer-ri.patch

46b2f6
From d02694e659ebe1ecad29f8461d87eda6a1f8faa2 Mon Sep 17 00:00:00 2001
46b2f6
From: Pino Toscano <ptoscano@redhat.com>
46b2f6
Date: Thu, 19 Sep 2019 09:52:41 +0200
46b2f6
Subject: [PATCH] v2v: -o rhv-upload: check for a valid image transfer right
46b2f6
 away
46b2f6
46b2f6
Check for the INITIALIZING state of the image transfer right away,
46b2f6
without waiting 5 seconds even before the first time: this way, if the
46b2f6
transfer is already in the right state then there is no need to wait.
46b2f6
---
46b2f6
 v2v/rhv-upload-plugin.py | 2 +-
46b2f6
 1 file changed, 1 insertion(+), 1 deletion(-)
46b2f6
46b2f6
diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
46b2f6
index 6ec74a5d4..7f62b4e3b 100644
46b2f6
--- a/v2v/rhv-upload-plugin.py
46b2f6
+++ b/v2v/rhv-upload-plugin.py
46b2f6
@@ -190,13 +190,13 @@ def open(readonly):
46b2f6
     # actual transfer can start when its status is "Transferring".
46b2f6
     endt = time.time() + timeout
46b2f6
     while True:
46b2f6
-        time.sleep(5)
46b2f6
         transfer = transfer_service.get()
46b2f6
         if transfer.phase != types.ImageTransferPhase.INITIALIZING:
46b2f6
             break
46b2f6
         if time.time() > endt:
46b2f6
             raise RuntimeError("timed out waiting for transfer status "
46b2f6
                                "!= INITIALIZING")
46b2f6
+        time.sleep(5)
46b2f6
 
46b2f6
     # Now we have permission to start the transfer.
46b2f6
     if params['rhv_direct']:
46b2f6
-- 
46b2f6
2.24.1
46b2f6