Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/dashboard/src/lib/server/backends/proxmox/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,12 @@ export class ProxmoxClient {
.json<PveResponse<{ result: PveAgentNetworkInterface[] }>>();
return res.data.result;
}

async updateHAResources(sid: string, params: Record<string, string>): Promise<void> {
await this.api
.put(`cluster/ha/resources/${sid}`, {
body: this.toForm(params)
})
.json<PveResponse<null>>();
}
}
3 changes: 3 additions & 0 deletions apps/dashboard/src/lib/server/backends/proxmox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,9 @@ export class ProxmoxBackend implements VmBackend {
async killVm(id: string, proxmoxId?: number): Promise<void> {
clearProxmoxReadCaches();
const { node, vmid } = await this.resolve(id, proxmoxId);
await this.client.updateHAResources(`vm:${vmid}`, {
state: 'disabled'
});
const upid = await this.client.stopVm(node, vmid);
await this.client.waitForTask(node, upid);
}
Expand Down