-
Notifications
You must be signed in to change notification settings - Fork 928
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
Powershell get-view in pyvmomi #746
Comments
I think https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/vminfo_quick.py is the best example for what you want.
fetches the properties for the VM. This sample doesn't have a filter in it. But you can add something like https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/filter_vms.py#L44 to it (that example is just made for 1 property filtering, so you'd have to compare arrays rather than |
https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/filter_vms.py#L44 is an filter after you had transfered the data from vcenter to your client. |
I don't have any easy way to confirm if powercli does the filtering on the client or on the server (likely the easiest way would be to make vCenter config changes to log communication, or using something like wireshark). The only reason I am thinking powercli does client filtering is that I haven't yet found anything in the PropertyCollector's FilterSpec that would provide server-side filtering based on values. It just allows setting the properties and objects that one is interested in. |
Is your feature request related to a problem? Please describe.
In VMware PowerCLI I can retrieve very quick with get-view with -filter and -property data from our large vCenter. With using -filter and -property, the data is filtered on vCenter side, not on client side. This reduces a lot of network traffic with each API Call.
This is an example:
Get-View -ViewType VirtualMachine -Filter @{'Runtime.PowerState'='poweredOn';'Guest.ToolsState'='ToolsOk'} -property Name
Describe the solution you'd like
How can In get this done with pyvmomi?
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: