[Libguestfs] [PATCH 04/18] rhv-upload: Ensure connection is closed in close()

Nir Soffer nirsof at gmail.com
Sun Nov 17 23:04:26 UTC 2019


Previously the connection could be left open after close() if finalizing
the transfer failed.
---
 v2v/rhv-upload-plugin.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
index fdb3f1021..3fb3091a9 100644
--- a/v2v/rhv-upload-plugin.py
+++ b/v2v/rhv-upload-plugin.py
@@ -553,7 +553,8 @@ def close(h):
         delete_disk_on_failure(h)
         raise
 
-    connection.close()
+    finally:
+        connection.close()
 
 # Modify http.client.HTTPConnection to work over a Unix domain socket.
 # Derived from uhttplib written by Erik van Zijst under an MIT license.
-- 
2.21.0





More information about the Libguestfs mailing list