Add "mirror" VM state
This commit is contained in:
parent
6960513bbd
commit
c766648ed0
|
@ -1280,7 +1280,7 @@ def vm_flush_locks(zkhandler, vm):
|
|||
zkhandler, None, None, None, vm, is_fuzzy=False, negate=False
|
||||
)
|
||||
|
||||
if retdata[0].get("state") not in ["stop", "disable"]:
|
||||
if retdata[0].get("state") not in ["stop", "disable", "mirror"]:
|
||||
return {"message": "VM must be stopped to flush locks"}, 400
|
||||
|
||||
retflag, retdata = pvc_vm.flush_locks(zkhandler, vm)
|
||||
|
|
|
@ -206,12 +206,12 @@ def cli_cluster_status_format_pretty(CLI_CONFIG, data):
|
|||
|
||||
output.append(f"{ansii['purple']}Nodes:{ansii['end']} {nodes_string}")
|
||||
|
||||
vm_states = ["start", "disable"]
|
||||
vm_states = ["start", "disable", "mirror"]
|
||||
vm_states.extend(
|
||||
[
|
||||
state
|
||||
for state in data.get("vms", {}).keys()
|
||||
if state not in ["total", "start", "disable"]
|
||||
if state not in ["total", "start", "disable", "mirror"]
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -221,7 +221,7 @@ def cli_cluster_status_format_pretty(CLI_CONFIG, data):
|
|||
continue
|
||||
if state in ["start"]:
|
||||
state_colour = ansii["green"]
|
||||
elif state in ["migrate", "disable", "provision"]:
|
||||
elif state in ["migrate", "disable", "provision", "mirror"]:
|
||||
state_colour = ansii["blue"]
|
||||
elif state in ["stop", "fail"]:
|
||||
state_colour = ansii["red"]
|
||||
|
|
|
@ -1760,6 +1760,7 @@ def format_info(config, domain_information, long_output):
|
|||
"provision": ansiprint.blue(),
|
||||
"restore": ansiprint.blue(),
|
||||
"import": ansiprint.blue(),
|
||||
"mirror": ansiprint.blue(),
|
||||
}
|
||||
ainformation.append(
|
||||
"{}State:{} {}{}{}".format(
|
||||
|
|
|
@ -1160,6 +1160,7 @@ def get_resource_metrics(zkhandler):
|
|||
"fail": 8,
|
||||
"import": 9,
|
||||
"restore": 10,
|
||||
"mirror": 99,
|
||||
}
|
||||
state = vm["state"]
|
||||
output_lines.append(
|
||||
|
|
|
@ -85,6 +85,7 @@ vm_state_combinations = [
|
|||
"provision",
|
||||
"import",
|
||||
"restore",
|
||||
"mirror",
|
||||
]
|
||||
ceph_osd_state_combinations = [
|
||||
"up,in",
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue