Add "mirror" VM state

This commit is contained in:
2024-09-11 10:12:29 -04:00
parent b1c4b2e928
commit 1cbadb1172
6 changed files with 12 additions and 8 deletions

View File

@ -1160,6 +1160,7 @@ def get_resource_metrics(zkhandler):
"fail": 8,
"import": 9,
"restore": 10,
"mirror": 99,
}
state = vm["state"]
output_lines.append(

View File

@ -85,6 +85,7 @@ vm_state_combinations = [
"provision",
"import",
"restore",
"mirror",
]
ceph_osd_state_combinations = [
"up,in",

View File

@ -580,7 +580,7 @@ def rename_vm(zkhandler, domain, new_domain):
# Verify that the VM is in a stopped state; renaming is not supported otherwise
state = zkhandler.read(("domain.state", dom_uuid))
if state not in ["stop", "disable"]:
if state not in ["stop", "disable", "mirror"]:
return (
False,
'ERROR: VM "{}" is not in stopped state; VMs cannot be renamed while running.'.format(
@ -1125,6 +1125,7 @@ def get_list(
"migrate",
"unmigrate",
"provision",
"mirror",
]
if state not in valid_states:
return False, 'VM state "{}" is not valid.'.format(state)
@ -1903,10 +1904,10 @@ def vm_worker_flush_locks(zkhandler, celery, domain, force_unlock=False):
# Check that the domain is stopped (unless force_unlock is set)
domain_state = zkhandler.read(("domain.state", dom_uuid))
if not force_unlock and domain_state not in ["stop", "disable", "fail"]:
if not force_unlock and domain_state not in ["stop", "disable", "fail", "mirror"]:
fail(
celery,
f"VM state {domain_state} not in [stop, disable, fail] and not forcing",
f"VM state {domain_state} not in [stop, disable, fail, mirror] and not forcing",
)
return False
@ -2329,7 +2330,7 @@ def vm_worker_rollback_snapshot(zkhandler, celery, domain, snapshot_name):
# Verify that the VM is in a stopped state; renaming is not supported otherwise
state = zkhandler.read(("domain.state", dom_uuid))
if state not in ["stop", "disable"]:
if state not in ["stop", "disable", "mirror"]:
fail(
celery,
f"VM '{domain}' is not stopped or disabled; VMs cannot be rolled back while running",