VMware Cloud Community
orian
Hot Shot
Hot Shot
Jump to solution

list of mounted datastore

Hi,

How can I (with the vmware orchestrator) query  datastores which are mounted form specific host?

same datastore can be unmount in other host in the same datacenter.

I attached a print screen.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Check the following sample code:

System.log("Mounted datastores for host: " + host.name);

var datastores = host.datastore;

for each (var ds in datastores) {

  var hostsOfDs = ds.host;

  for each (var h in hostsOfDs) {

    if (h.key != host) continue;

    if (!h.mountInfo.mounted) continue;

    System.log(" > datastore: '" + ds.name + (ds.summary.accessible?"'":"' (inaccessible)"));

  }

}

View solution in original post

0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Check the following sample code:

System.log("Mounted datastores for host: " + host.name);

var datastores = host.datastore;

for each (var ds in datastores) {

  var hostsOfDs = ds.host;

  for each (var h in hostsOfDs) {

    if (h.key != host) continue;

    if (!h.mountInfo.mounted) continue;

    System.log(" > datastore: '" + ds.name + (ds.summary.accessible?"'":"' (inaccessible)"));

  }

}

0 Kudos