Remove stage overrides

These aren't needed after pending refactor.
This commit is contained in:
Joshua Boniface 2024-08-25 15:17:46 -04:00
parent 7ecc05b413
commit c0686fc5c7
1 changed files with 11 additions and 23 deletions

View File

@ -2079,16 +2079,13 @@ def vm_worker_create_snapshot(
domain, domain,
snapshot_name=None, snapshot_name=None,
zk_only=False, zk_only=False,
override_current_stage=0,
override_total_stages=1,
): ):
if snapshot_name is None: if snapshot_name is None:
now = datetime.now() now = datetime.now()
snapshot_name = now.strftime("%Y%m%d%H%M%S") 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 = 0
current_stage = override_current_stage total_stages = 1
total_stages = override_total_stages
start( start(
celery, celery,
f"Creating snapshot '{snapshot_name}' of VM '{domain}'", f"Creating snapshot '{snapshot_name}' of VM '{domain}'",
@ -2124,8 +2121,7 @@ def vm_worker_create_snapshot(
# Get the list of all RBD volumes # Get the list of all RBD volumes
rbd_list = zkhandler.read(("domain.storage.volumes", dom_uuid)).split(",") 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() snap_list = list()
@ -2231,12 +2227,9 @@ def vm_worker_remove_snapshot(
celery, celery,
domain, domain,
snapshot_name, 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 = 0
current_stage = override_current_stage total_stages = 1
total_stages = override_total_stages
start( start(
celery, celery,
f"Removing snapshot '{snapshot_name}' of VM '{domain}'", f"Removing snapshot '{snapshot_name}' of VM '{domain}'",
@ -2267,8 +2260,7 @@ def vm_worker_remove_snapshot(
) )
rbd_snapshots = _snapshots.split(",") 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: for snap in rbd_snapshots:
current_stage += 1 current_stage += 1
@ -2292,7 +2284,7 @@ def vm_worker_remove_snapshot(
current_stage += 1 current_stage += 1
update( update(
celery, celery,
"Deleting VM configuration snapshot", "Removing VM configuration snapshot",
current=current_stage, current=current_stage,
total=total_stages, total=total_stages,
) )
@ -2303,7 +2295,7 @@ def vm_worker_remove_snapshot(
if not ret: if not ret:
fail( fail(
celery, 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 return False
@ -2421,12 +2413,9 @@ def vm_worker_export_snapshot(
snapshot_name, snapshot_name,
export_path, export_path,
incremental_parent=None, 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 = 0
current_stage = override_current_stage total_stages = 1
total_stages = override_total_stages
start( start(
celery, celery,
f"Exporting snapshot '{snapshot_name}' of VM '{domain}' to '{export_path}'", 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(",") 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 # Create destination directory
export_target_path = f"{export_path}/{domain}/{snapshot_name}/images" export_target_path = f"{export_path}/{domain}/{snapshot_name}/images"