-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #1173 #1368
Fix #1173 #1368
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @amandahla , using ContainerView
would speed things up, do you want to try that? For an example, see:
govmomi/examples/virtualmachines/main.go
Lines 45 to 58 in e560c7b
// Create view of VirtualMachine objects | |
m := view.NewManager(c.Client) | |
v, err := m.CreateContainerView(ctx, c.ServiceContent.RootFolder, []string{"VirtualMachine"}, true) | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer v.Destroy(ctx) | |
// Retrieve summary property for all machines | |
// Reference: http://pubs.vmware.com/vsphere-60/topic/com.vmware.wssdk.apiref.doc/vim.VirtualMachine.html | |
var vms []mo.VirtualMachine | |
err = v.Retrieve(ctx, []string{"VirtualMachine"}, []string{"summary"}, &vms) |
@dougm Much faster, thanks! Do you think is necessary to change others too to not use finder? |
@amandahla looking good, can you also remove "WIP" from the commit message? There might be other places where |
@dougm sure, done! Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amandahla sorry I just realized I had started a review with these 2 comments, but hadn't actually submitted the review with my commit message update request.
@dougm no problem, thanks for the comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks again @amandahla
Glad to help! :-) |
I changed to get all VMs but it's a little bit slow because I'm retrieving the config.template property for each VM otherwise will count Templates as VM too.