add ha disable to vmKill#35
Open
TheHeroBrine422 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.