Skip to content

add ha disable to vmKill#35

Open
TheHeroBrine422 wants to merge 1 commit into
mainfrom
caleb-vm-freeze-pxmx-ha
Open

add ha disable to vmKill#35
TheHeroBrine422 wants to merge 1 commit into
mainfrom
caleb-vm-freeze-pxmx-ha

Conversation

@TheHeroBrine422

Copy link
Copy Markdown
Contributor

This is added because Proxmox's HA manager sometimes likes to put an VM into an error state. In this situation the only way to reboot the VM is to set the HA state to disabled and then start it back up.

Setting HA state to disabled will always shutdown the machine though.

This still has a UX problem though. updateHAResources doesn't respond with any type of task you can wait on, and when a VM is stuck in this state, running waitForTask on the stopVm upid gives an error because the task wont complete properly. So we need to handle that but I don't wanna figure that out.

This commit will at least successfully kill the VM which allows a user to stop their VM. Without this a VM would never be able to be shutdown. We might be able to remove the stopVm call entirely since HA disabled does stop the vm, but we have no way of finding out when its finished other then just polling it.

Currently if a VM is stuck in this state, the UI gives a "Internal Error" if you try to kill the VM, but then the VM will stop 10-15 seconds later.

Here is the error you get in the console.

[500] POST /projects/01KWRPSE2EYKVR8WTD1WK1WDRE/servers/01KWRSSKWQ32E6KSCTVP6AB0B6
Error: Proxmox task failed: command 'ha-manager crm-command stop vm:122 0' failed: exit code 255 (UPID: UPID:pxmx-07:0004FD68:294ECB2F:6A4A3075:hastop:122:addison@pve!caleb-dash:)
at ProxmoxClient.waitForTask (src/lib/server/backends/proxmox/client.ts:385:12)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async ProxmoxBackend.killVm (src/lib/server/backends/proxmox/index.ts:731:3)
at async powerAction (src/lib/remote/vms.remote.ts:704:2)
at async handle_remote_call_internal (../../node_modules/.pnpm/@sveltejs+kit@2.68.0_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.4_vite@8.1.0_@types_b6c7449f366319f58f903bf20d7ba145/node_modules/@sveltejs/kit/src/runtime/server/remote.js?v=4c50d97f:246:14)
at async resolve (../../node_modules/.pnpm/@sveltejs+kit@2.68.0_@sveltejs+vite-plugin-svelte@7.1.2_svelte@5.56.4_vite@8.1.0_@types_b6c7449f366319f58f903bf20d7ba145/node_modules/@sveltejs/kit/src/runtime/server/respond.js?v=4c50d97f:602:12)
at async instrument (src/lib/server/observability.ts:86:6)
at async eval (src/hooks.server.ts:97:13)
at async instrument (src/lib/server/observability.ts:86:6)
at async Object.handleBetterAuth [as handle] (src/hooks.server.ts:70:10)

To force a VM into the HA error state, repeatedly spam the restart and shutdown buttons via dashboard. eventually the VM should get into the error state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant