MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / StopVM

Method StopVM

pkg/api/vm_lifecycle.go:21–30  ·  view source on GitHub ↗

StopVM stops a VM or container.

(vm *VM)

Source from the content-addressed store, hash-verified

19
20// StopVM stops a VM or container.
21func (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`.

Callers 2

TestPVEMockAPIFunction · 0.95
newGuestsStopCmdFunction · 0.80

Calls 2

PostWithResponseMethod · 0.95
extractUPIDMethod · 0.95

Tested by 1

TestPVEMockAPIFunction · 0.76