Hello,
in vco I want to remove datastores and then send the canonical name reformated for the storage people to remove the lun from the storage
but I can not find were in the vcenter API to link a datastrore name with the canonical name of vmfs extents
can some one help me ?
regards
Daniel
Hi Daniel,
To find the canonical name, try the following script:
if (ds.summary.type != "VMFS") {
throw "Type of file system volume is not VMFS";
}
var disks = ds.info.vmfs.extent;
var cn = "";
for each (var disk in disks) {
if (cn != "") cn += ", ";
cn += disk.diskName;
}
System.log("Datastore: " + ds.name + " has canonical name(s): " + cn);
The input parameter is the variable ds of type VC:Datastore
Hi Daniel,
To find the canonical name, try the following script:
if (ds.summary.type != "VMFS") {
throw "Type of file system volume is not VMFS";
}
var disks = ds.info.vmfs.extent;
var cn = "";
for each (var disk in disks) {
if (cn != "") cn += ", ";
cn += disk.diskName;
}
System.log("Datastore: " + ds.name + " has canonical name(s): " + cn);
The input parameter is the variable ds of type VC:Datastore
thank you Ilian it works and it is quite simple
but why can't I see the vmfs object ds.info.vmfs.extent in the API library ?
Because for VMFS datastores ds.info is actually not a VcDatastoreInfo but VcVmfsDatastoreInfo (this object extends VcDatastoreInfo). And vmfs is a property of VcVmfsDatastoreInfo.
vRO API documentation does not represent this type of parent-child links very well, so you may want to look also at vSphere API documentation. For example - vSphere 5.5 Documentation Center shows that DatastoreInfo data object is extended by VmfsDatastoreInfo data object.
Great information !
thank you