Skip to content

Searching all VMs by a resourcepool #3180

Closed Answered by atc0005
lugerlee asked this question in Q&A
Discussion options

You must be logged in to vote

@lugerlee Take a look here:

https://github.com/vmware/govmomi/blob/main/examples/virtualmachines/main.go

v, err := m.CreateContainerView(ctx, c.ServiceContent.RootFolder, []string{"VirtualMachine"}, true)
if err != nil {
return err
}

If you replace c.ServiceContent.RootFolder with a ManagedObjectReference to the resource pool it should return the VirtualMachine values from the specified pool recursively.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dougm
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants