- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's actually a simple flag you can use to quickly assess if a Datastore is local (or more specifically if it is only seen by one host, which ultimately is the same issue in terms of your environment's health).
The boolean property multipleHostAccess in Datastore.Summary: http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.Datastore.Summary.html
A simple perl SDK script would be something like the following:
use strict;use warnings;use VMware::VIRuntime;Opts::parse();Opts::validate();Util::connect();my $datastore_views = Vim::find_entity_views( view_type => "Datastore",filter => { 'summary.multipleHostAccess' => 'false' },properties => [ 'vm', 'summary' ] );foreach my $datastore ( @{$datastore_views} ) {foreach my $entity_ref ( eval { @{$datastore->vm} } ) {my $vm_view = Vim::get_view( mo_ref => $entity_ref, properties => [ 'name' ] );printf("%s, %s\n", $vm_view->name, $datastore->summary->name);}}I didn't test this, so let me know if there are any errors.
In your case of going by specific host, you could create a script to find a HostSystem by name, then get the Datastore objects connected to it, check the multipleHostAccess flag and print out any VMs that are on Datastore objects that don't have multiple hosts connected.
The example above will inspect all Datastore objects in your vSphere inventory and may be enough to accomplish your task.