From c0686fc5c7522c7685c02fc6278c54060b80a4cf Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 25 Aug 2024 15:17:46 -0400 Subject: [PATCH] Remove stage overrides These aren't needed after pending refactor. --- daemon-common/vm.py | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/daemon-common/vm.py b/daemon-common/vm.py index 852abc84..d7add399 100644 --- a/daemon-common/vm.py +++ b/daemon-common/vm.py @@ -2079,16 +2079,13 @@ def vm_worker_create_snapshot( domain, snapshot_name=None, zk_only=False, - override_current_stage=0, - override_total_stages=1, ): if snapshot_name is None: now = datetime.now() snapshot_name = now.strftime("%Y%m%d%H%M%S") - # This allows these to be called inside another run while still updating celery - current_stage = override_current_stage - total_stages = override_total_stages + current_stage = 0 + total_stages = 1 start( celery, f"Creating snapshot '{snapshot_name}' of VM '{domain}'", @@ -2124,8 +2121,7 @@ def vm_worker_create_snapshot( # Get the list of all RBD volumes rbd_list = zkhandler.read(("domain.storage.volumes", dom_uuid)).split(",") - if override_total_stages == 1: - total_stages += 1 + len(rbd_list) + total_stages += 1 + len(rbd_list) snap_list = list() @@ -2231,12 +2227,9 @@ def vm_worker_remove_snapshot( celery, domain, snapshot_name, - override_current_stage=0, - override_total_stages=1, ): - # This allows these to be called inside another run while still updating celery - current_stage = override_current_stage - total_stages = override_total_stages + current_stage = 0 + total_stages = 1 start( celery, f"Removing snapshot '{snapshot_name}' of VM '{domain}'", @@ -2267,8 +2260,7 @@ def vm_worker_remove_snapshot( ) rbd_snapshots = _snapshots.split(",") - if override_total_stages == 1: - total_stages = 2 + len(rbd_snapshots) + total_stages = 2 + len(rbd_snapshots) for snap in rbd_snapshots: current_stage += 1 @@ -2292,7 +2284,7 @@ def vm_worker_remove_snapshot( current_stage += 1 update( celery, - "Deleting VM configuration snapshot", + "Removing VM configuration snapshot", current=current_stage, total=total_stages, ) @@ -2303,7 +2295,7 @@ def vm_worker_remove_snapshot( if not ret: fail( celery, - f'Failed to delete snapshot "{snapshot_name}" of VM "{domain}" in Zookeeper.', + f'Failed to remove snapshot "{snapshot_name}" of VM "{domain}" from Zookeeper', ) return False @@ -2421,12 +2413,9 @@ def vm_worker_export_snapshot( snapshot_name, export_path, incremental_parent=None, - override_current_stage=0, - override_total_stages=1, ): - # This allows these to be called inside another run while still updating celery - current_stage = override_current_stage - total_stages = override_total_stages + current_stage = 0 + total_stages = 1 start( celery, f"Exporting snapshot '{snapshot_name}' of VM '{domain}' to '{export_path}'", @@ -2517,8 +2506,7 @@ def vm_worker_export_snapshot( ) snapshot_rbdsnaps = snapshot_rbdsnaps.split(",") - if override_total_stages == 1: - total_stages = 2 + len(snapshot_rbdsnaps) + total_stages = 2 + len(snapshot_rbdsnaps) # Create destination directory export_target_path = f"{export_path}/{domain}/{snapshot_name}/images"