|
|
10436e |
From 41f3e803050b46fd79d8c2e728fc0425da05878c Mon Sep 17 00:00:00 2001
|
|
|
10436e |
From: Daniel Erez <derez@redhat.com>
|
|
|
10436e |
Date: Mon, 18 Mar 2019 18:51:26 +0200
|
|
|
10436e |
Subject: [PATCH] v2v: rhv-upload-plugin - improve wait logic after finalize
|
|
|
10436e |
(RHBZ#1680361)
|
|
|
10436e |
|
|
|
10436e |
After invoking transfer_service.finalize, check operation status by
|
|
|
10436e |
examining DiskStatus. This is done instead of failing after a
|
|
|
10436e |
predefined timeout regardless the status.
|
|
|
10436e |
|
|
|
10436e |
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1680361
|
|
|
10436e |
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
|
|
|
10436e |
Tested-by: Ilanit Stein <istein@redhat.com>
|
|
|
10436e |
(cherry picked from commit eeabb3fdc7756887b53106f455a7b54309130637)
|
|
|
10436e |
---
|
|
|
10436e |
v2v/rhv-upload-plugin.py | 19 +++++++++++++------
|
|
|
10436e |
1 file changed, 13 insertions(+), 6 deletions(-)
|
|
|
10436e |
|
|
|
10436e |
diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
|
|
|
10436e |
index 2a950c5ed..4d61a089b 100644
|
|
|
10436e |
--- a/v2v/rhv-upload-plugin.py
|
|
|
10436e |
+++ b/v2v/rhv-upload-plugin.py
|
|
|
10436e |
@@ -523,16 +523,23 @@ def close(h):
|
|
|
10436e |
# waiting for the transfer object to cease to exist, which
|
|
|
10436e |
# falls through to the exception case and then we can
|
|
|
10436e |
# continue.
|
|
|
10436e |
- endt = time.time() + timeout
|
|
|
10436e |
+ disk_id = disk.id
|
|
|
10436e |
+ start = time.time()
|
|
|
10436e |
try:
|
|
|
10436e |
while True:
|
|
|
10436e |
time.sleep(1)
|
|
|
10436e |
- tmp = transfer_service.get()
|
|
|
10436e |
- if time.time() > endt:
|
|
|
10436e |
- raise RuntimeError("timed out waiting for transfer "
|
|
|
10436e |
- "to finalize")
|
|
|
10436e |
+ disk_service = h['disk_service']
|
|
|
10436e |
+ disk = disk_service.get()
|
|
|
10436e |
+ if disk.status == types.DiskStatus.LOCKED:
|
|
|
10436e |
+ if time.time() > start + timeout:
|
|
|
10436e |
+ raise RuntimeError("timed out waiting for transfer "
|
|
|
10436e |
+ "to finalize")
|
|
|
10436e |
+ continue
|
|
|
10436e |
+ if disk.status == types.DiskStatus.OK:
|
|
|
10436e |
+ debug("finalized after %s seconds" % (time.time() - start))
|
|
|
10436e |
+ break
|
|
|
10436e |
except sdk.NotFoundError:
|
|
|
10436e |
- pass
|
|
|
10436e |
+ raise RuntimeError("transfer failed: disk %s not found" % disk_id)
|
|
|
10436e |
|
|
|
10436e |
# Write the disk ID file. Only do this on successful completion.
|
|
|
10436e |
with builtins.open(params['diskid_file'], 'w') as fp:
|
|
|
10436e |
--
|
|
|
10436e |
2.26.2
|
|
|
10436e |
|