StopVM stops a VM or container.
(vm *VM)
| 19 | |
| 20 | // StopVM stops a VM or container. |
| 21 | func (c *Client) StopVM(vm *VM) (string, error) { |
| 22 | path := fmt.Sprintf("/nodes/%s/%s/%d/status/stop", vm.Node, vm.Type, vm.ID) |
| 23 | |
| 24 | var response map[string]interface{} |
| 25 | if err := c.PostWithResponse(path, nil, &response); err != nil { |
| 26 | return "", err |
| 27 | } |
| 28 | |
| 29 | return c.extractUPID(response) |
| 30 | } |
| 31 | |
| 32 | // ShutdownVM requests a graceful shutdown via the guest OS. |
| 33 | // For both QEMU and LXC, Proxmox exposes `/status/shutdown`. |