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

Method GetVMConfig

pkg/api/vm_config.go:56–70  ·  view source on GitHub ↗

GetVMConfig fetches the configuration for a VM or container.

(vm *VM)

Source from the content-addressed store, hash-verified

54
55// GetVMConfig fetches the configuration for a VM or container.
56func (c *Client) GetVMConfig(vm *VM) (*VMConfig, error) {
57 var result map[string]interface{}
58
59 endpoint := fmt.Sprintf("/nodes/%s/%s/%d/config", vm.Node, vm.Type, vm.ID)
60 if err := c.Get(endpoint, &result); err != nil {
61 return nil, fmt.Errorf("failed to get config: %w", err)
62 }
63
64 data, ok := result["data"].(map[string]interface{})
65 if !ok {
66 return nil, fmt.Errorf("unexpected config response format")
67 }
68
69 return parseVMConfig(vm.Type, data), nil
70}
71
72// UpdateVMConfig updates the configuration for a VM or container.
73// For LXC: uses PUT (synchronous, no task ID)

Callers 4

TestPVEMockAPIFunction · 0.95
pollForConfigChangeMethod · 0.80
ShowVMContextMenuMethod · 0.80

Calls 2

GetMethod · 0.95
parseVMConfigFunction · 0.85

Tested by 1

TestPVEMockAPIFunction · 0.76