Blob Blame History Raw
From 200a365f20d5d8a3ddfe713e9bbe938206e43e9a Mon Sep 17 00:00:00 2001
From: Nir Soffer <nirsof@gmail.com>
Date: Mon, 18 Nov 2019 01:04:24 +0200
Subject: [PATCH] rhv-upload: Check status more frequently

Checking status more frequently save a couple of seconds. Here is
an example flow tested with oVirt upload_disk.py example:

With 5 seconds wait:

Created disk in 11.085111 seconds
Created transfer in 1.857502 seconds

With 1 second wait:

Created disk in 4.991227 seconds
Created transfer in 1.961243 seconds

(cherry picked from commit 8816c5db220f518ef70beec7ac543290e3d5c0c7
in virt-v2v)
---
 v2v/rhv-upload-plugin.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
index 7f62b4e3b..f13405df1 100644
--- a/v2v/rhv-upload-plugin.py
+++ b/v2v/rhv-upload-plugin.py
@@ -161,7 +161,7 @@ def open(readonly):
 
     endt = time.time() + timeout
     while True:
-        time.sleep(5)
+        time.sleep(1)
         disk = disk_service.get()
         if disk.status == types.DiskStatus.OK:
             break
@@ -196,7 +196,7 @@ def open(readonly):
         if time.time() > endt:
             raise RuntimeError("timed out waiting for transfer status "
                                "!= INITIALIZING")
-        time.sleep(5)
+        time.sleep(1)
 
     # Now we have permission to start the transfer.
     if params['rhv_direct']:
-- 
2.24.1