We don't need to keep the disk_service object in the handle since it can be extracted from the connection and the disk id. This will make it easier to extract the code for creating a disk from open(). --- 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 7075ce3ba..809917562 100644 --- a/v2v/rhv-upload-plugin.py +++ b/v2v/rhv-upload-plugin.py @@ -246,7 +246,6 @@ def open(readonly): 'can_zero': can_zero, 'connection': connection, 'disk': disk, - 'disk_service': disk_service, 'failed': False, 'highestwrite': 0, 'http': http, @@ -477,11 +476,12 @@ def close(h): # 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)) start = time.time() try: while True: time.sleep(1) - disk_service = h['disk_service'] disk = disk_service.get() if disk.status == types.DiskStatus.LOCKED: if time.time() > start + timeout: -- 2.21.0