Added a new 'properties' argument to the view commands get_view(s) and
find_entity_view(s). The argument is a list of property paths to be
retrieved from the server. These can be full paths and are not
restricted to top-level managed properties. For example, to populate a
virtual machine view with just the power state information, you can
write:
my $vm_view = Vim::find_entity_view(view_type => 'VirtualMachine',
filter => { 'name' => 'foo' },
properties => [
'runtime.powerState' ]);
To retrieve properties from a filtered view, you should use the new
get_property method of the view. For example:
my $state = $vm_view->get_property('runtime.powerState');
Note that you can also get subproperties of the retrieved property:
my $vm_view = Vim::find_entity_view(view_type => 'VirtualMachine',
filter => { 'name' => 'foo' },
properties => [ 'config.hardware' ]);
my $memsize = $vm_view->get_property('config.hardware.memoryMB');
And that get_property works with fully-populated views as well. So:
my $vm_view = Vim::find_entity_view(view_type => 'VirtualMachine',
filter => { 'name' => 'foo' });
my $memsize = $vm_view->get_property('config.hardware.memoryMB');
Is equivalent to:
my $vm_view = Vim::find_entity_view(view_type => 'VirtualMachine',
filter => { 'name' => 'foo' });
my $memsize = $vm_view->config->hardware->memoryMB;
When using a filtered view, any attempts to read a property that wasn't
retrieved from the server will act the same as if the property were
unset.
The use of property filters is intended primarily as a performance
optimization to reduce the latency and network bandwidth of retrieving
full views of a large number of objects. In general, you should start
with full views and only switch to filtered views when tuning
application performance.
Note also that this support is currently experimental and may change or
be removed in the future.