fix(proxmox): DestroyLXC DELETE takes no body + force=1 (live restore-test teardown)
The slice-6 restore-test teardown failed live: DELETE /lxc/{vmid} with a form body
returns HTTP 501 'Unexpected content for method DELETE', and a booted scratch needs
force=1. Move purge/destroy-unreferenced-disks/force to the query string, send no body.
Regression test locks the contract.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -96,11 +96,12 @@ func (c *Client) DestroyLXC(ctx context.Context, vmid int) (string, error) {
|
||||
if vmid == 0 {
|
||||
return "", fmt.Errorf("proxmox: DestroyLXC needs a vmid")
|
||||
}
|
||||
v := url.Values{}
|
||||
v.Set("purge", "1")
|
||||
v.Set("destroy-unreferenced-disks", "1")
|
||||
path := fmt.Sprintf("/nodes/%s/lxc/%d", c.node, vmid)
|
||||
return c.dataString(ctx, http.MethodDelete, path, v)
|
||||
// DELETE takes NO request body on PVE (a form body → HTTP 501 "Unexpected content for
|
||||
// method 'DELETE'"); the flags go in the query string. `force=1` destroys even a running
|
||||
// guest (the scratch may still be booted at teardown), `purge=1` drops it from jobs/HA,
|
||||
// `destroy-unreferenced-disks=1` reaps orphaned volumes.
|
||||
path := fmt.Sprintf("/nodes/%s/lxc/%d?purge=1&destroy-unreferenced-disks=1&force=1", c.node, vmid)
|
||||
return c.dataString(ctx, http.MethodDelete, path, nil)
|
||||
}
|
||||
|
||||
// Snapshot creates an LXC snapshot via POST /nodes/{node}/lxc/{vmid}/snapshot.
|
||||
|
||||
Reference in New Issue
Block a user