Set snapshot name before start

This commit is contained in:
Joshua Boniface 2024-08-20 23:01:52 -04:00
parent 0bf9cc6b06
commit 565011b277
1 changed files with 18 additions and 18 deletions

View File

@ -2076,6 +2076,10 @@ def vm_worker_detach_device(zkhandler, celery, domain, xml_spec):
def vm_worker_create_snapshot(
zkhandler, celery, domain, snapshot_name=None, zk_only=False
):
if snapshot_name is None:
now = datetime.now()
snapshot_name = now.strftime("%Y%m%d%H%M%S")
current_stage = 0
total_stages = 1
start(
@ -2094,10 +2098,6 @@ def vm_worker_create_snapshot(
)
return False
if snapshot_name is None:
now = datetime.now()
snapshot_name = now.strftime("%Y%m%d%H%M%S")
else:
reg = re.compile("^[a-z0-9.-_]+$")
if not reg.match(snapshot_name):
fail(