Ensure snapshot name does not already exist

This commit is contained in:
Joshua Boniface 2024-05-21 16:38:47 -04:00
parent 3d0d5e63f6
commit 359191c83f
1 changed files with 6 additions and 0 deletions

View File

@ -1265,6 +1265,12 @@ def create_vm_snapshot(zkhandler, domain, snapshot_name=None):
False, False,
f'ERROR: Snapshot name "{snapshot_name}" contains invalid characters; only alphanumeric, ".", "-", and "_" characters are allowed!', f'ERROR: Snapshot name "{snapshot_name}" contains invalid characters; only alphanumeric, ".", "-", and "_" characters are allowed!',
) )
current_snapshots = zkhandler.children(("domain.snapshots", dom_uuid))
if current_snapshots and snapshot_name in current_snapshots:
return (
False,
f'ERROR: Snapshot name "{snapshot_name}" already exists for VM "{domain}"!',
)
tstart = time.time() tstart = time.time()