Add UUID check and fix wording

Don't suggest renaming any more as it's not enough.
This commit is contained in:
2024-08-20 17:03:48 -04:00
parent 9a661d0173
commit 9b3075be18
2 changed files with 12 additions and 3 deletions

View File

@ -2627,7 +2627,7 @@ def vm_worker_import_snapshot(
if dom_uuid:
fail(
celery,
f'VM "{domain}" already exists in the cluster; remove or rename it before importing a snapshot',
f"VM '{domain}' (UUID '{dom_uuid}') already exists in the cluster; remove it before importing a snapshot",
)
return
@ -2672,6 +2672,15 @@ def vm_worker_import_snapshot(
)
return
# Check that another VM with the same UUID doesn't already exist (rename is not enough!)
dom_name = getDomainName(zkhandler, export_source_details["vm_detail"]["uuid"])
if dom_name:
fail(
celery,
f"VM UUID '{export_source_details['vm_detail']['uuid']}' (Name '{dom_name}') already exists in the cluster; remove it before importing a snapshot",
)
return
# Handle incrementals
incremental_parent = export_source_details.get("incremental_parent", None)
if incremental_parent is not None: