Gathering Data with a ViewManager Object
You can use a vSphere view object in a
PropertyCollector
filter to simplify access to a subset of inventory
objects. For example, you could use a ContainerView
to collect information about all VirtualMachine objects in a datacenter, or a
ListView
to track information about Task objects while an operation is in progress.
The ViewManager
’s ListView method allows you to customize your view
with an input object list, the ContainerView
method lets you view all objects in a folder, datacenter, resource pool, or other
container of managed objects, and the InventoryView method lets you monitor the entire inventory.
The ViewManager has the following property:
- viewList – An array of view references. Each array entry is a managed object reference to a view created by this View Manager.
The view acts as a virtual parent object to the set, which provides the following benefits:
-
The view can collect objects from different parts of the inventory and make them available under the same parent.
-
All objects in the set are accessible by doing a single traversal step, rather than a chain of several steps starting at the root folder.
A best practice when using views is to call
the DestroyView()
method when a view is no longer needed. This practice
frees memory on the server.
See Retrieve Properties from a Set of Managed Objects with a View for an example that uses the ContainerView method to access Inventory data.
For more information about the vSphere inventory, browse the managed object definitions in the vSphere Web Services API Reference.