[Libguestfs] [PATCH v2 01/11] rhv-upload: Cancel transfer if finalize failed

Nir Soffer nirsof at gmail.com
Mon Nov 18 21:53:40 UTC 2019


If engine fails to finalize the transfer, for example due to
inaccessible storage, it will move to "paused by system" state and keep
the disk. We need to cancel the transfer to have the disk removed.

Thanks: Daniel Erez.
---
 v2v/rhv-upload-plugin.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
index 9b433bd7..114d5d55 100644
--- a/v2v/rhv-upload-plugin.py
+++ b/v2v/rhv-upload-plugin.py
@@ -458,6 +458,11 @@ def close(h):
         with builtins.open(params['diskid_file'], 'w') as fp:
             fp.write(disk.id)
 
+    except:
+        # If oVirt engine fails to finalize the transfer, it will pause the
+        # transfer and keep the disk.
+        transfer_service.cancel()
+        raise
     finally:
         connection.close()
 
-- 
2.21.0





More information about the Libguestfs mailing list