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

Method getVMs

internal/cli/cli_helpers.go:54–75  ·  view source on GitHub ↗

getVMs returns all guests across all nodes. In group mode it fans out across all connected profiles.

(ctx context.Context)

Source from the content-addressed store, hash-verified

52// getVMs returns all guests across all nodes. In group mode it fans out across
53// all connected profiles.
54func (s *cliSession) getVMs(ctx context.Context) ([]*api.VM, error) {
55 if s.group != nil {
56 return s.group.GetGroupVMs(ctx)
57 }
58
59 cluster, err := s.single.GetClusterStatus()
60 if err != nil {
61 return nil, err
62 }
63
64 var vms []*api.VM
65
66 for _, n := range cluster.Nodes {
67 if n == nil {
68 continue
69 }
70
71 vms = append(vms, n.VMs...)
72 }
73
74 return vms, nil
75}
76
77// findVM locates a guest by VMID across all profiles.
78func (s *cliSession) findVM(ctx context.Context, vmid int) (*api.VM, error) {

Callers 3

completeVMIDsFunction · 0.80
runGuestsListFunction · 0.80

Calls 2

GetGroupVMsMethod · 0.80
GetClusterStatusMethod · 0.80

Tested by

no test coverage detected