[Libguestfs] [PATCH v2 02/11] rhv-upload: Keep disk_id in handle

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


We kept the disk object for its id. Replace it with the disk id. This
can make debugging easier when we log the handle.
---
 v2v/rhv-upload-plugin.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py
index 114d5d55..24944005 100644
--- a/v2v/rhv-upload-plugin.py
+++ b/v2v/rhv-upload-plugin.py
@@ -205,7 +205,7 @@ def open(readonly):
         'can_trim': can_trim,
         'can_zero': can_zero,
         'connection': connection,
-        'disk': disk,
+        'disk_id': disk.id,
         'failed': False,
         'highestwrite': 0,
         'http': http,
@@ -425,7 +425,7 @@ def close(h):
         return
 
     try:
-        disk = h['disk']
+        disk_id = h['disk_id']
 
         transfer_service.finalize()
 
@@ -435,9 +435,8 @@ def close(h):
         # waiting for the transfer object to cease to exist, which
         # falls through to the exception case and then we can
         # continue.
-        disk_id = disk.id
         disk_service = (
-            connection.system_service().disks_service().disk_service(disk.id))
+            connection.system_service().disks_service().disk_service(disk_id))
         start = time.time()
         try:
             while True:
@@ -456,7 +455,7 @@ def close(h):
 
         # Write the disk ID file.  Only do this on successful completion.
         with builtins.open(params['diskid_file'], 'w') as fp:
-            fp.write(disk.id)
+            fp.write(disk_id)
 
     except:
         # If oVirt engine fails to finalize the transfer, it will pause the
-- 
2.21.0





More information about the Libguestfs mailing list