feat: complete QEMU power lifecycle
This commit is contained in:
@@ -125,9 +125,19 @@ def test_proxmoxer_read_and_qemu_task_flow() -> None:
|
||||
token_value=os.getenv("PROXMOXER_OPERATOR_TOKEN_SECRET", "operator-secret"),
|
||||
verify_ssl=False,
|
||||
)
|
||||
status = operator_api.nodes("pve1").qemu("101").status.current.get()
|
||||
operation = "start" if status["status"] == "stopped" else "stop"
|
||||
endpoint = operator_api.nodes("pve1").qemu("101").status(operation)
|
||||
upid = endpoint.post()
|
||||
task = wait_task(operator_api, upid)
|
||||
assert task["exitstatus"] == "OK"
|
||||
status_resource = operator_api.nodes("pve1").qemu("101").status
|
||||
|
||||
def run(operation: str, expected: str) -> None:
|
||||
upid = status_resource(operation).post()
|
||||
assert wait_task(operator_api, upid)["exitstatus"] == "OK"
|
||||
assert status_resource.current.get()["status"] == expected
|
||||
|
||||
if status_resource.current.get()["status"] == "stopped":
|
||||
run("start", "running")
|
||||
run("reboot", "running")
|
||||
run("reset", "running")
|
||||
run("suspend", "paused")
|
||||
run("resume", "running")
|
||||
run("shutdown", "stopped")
|
||||
run("start", "running")
|
||||
run("stop", "stopped")
|
||||
|
||||
@@ -13,6 +13,10 @@ from app.simulation.transitions import InvalidTransitionError, VmState, plan_tra
|
||||
[
|
||||
(VmState.STOPPED, "start", VmState.RUNNING),
|
||||
(VmState.RUNNING, "stop", VmState.STOPPED),
|
||||
(VmState.RUNNING, "shutdown", VmState.STOPPED),
|
||||
(VmState.RUNNING, "reboot", VmState.RUNNING),
|
||||
(VmState.RUNNING, "reset", VmState.RUNNING),
|
||||
(VmState.RUNNING, "suspend", VmState.PAUSED),
|
||||
(VmState.RUNNING, "pause", VmState.PAUSED),
|
||||
(VmState.PAUSED, "resume", VmState.RUNNING),
|
||||
(VmState.RUNNING, "snapshot", VmState.RUNNING),
|
||||
|
||||
Reference in New Issue
Block a user