use of com.vmware.vim25.HostVmfsVolume in project coprhd-controller by CoprHD.
the class HostStorageAPI method getDisksByPartition.
/**
* Gets the disks associated with the datastore mapped by partition.
*
* @param datastore the datastore.
* @return the disks mapped by partition.
*/
public Map<HostScsiDiskPartition, HostScsiDisk> getDisksByPartition(Datastore datastore) {
if (!(datastore.getInfo() instanceof VmfsDatastoreInfo)) {
throw new IllegalArgumentException(datastore.getName() + " is not a VMFS datastore");
}
Map<HostScsiDiskPartition, HostScsiDisk> disks = Maps.newLinkedHashMap();
Map<String, HostScsiDisk> disksByName = getScsiDisksByCanonicalName();
HostVmfsVolume volume = ((VmfsDatastoreInfo) datastore.getInfo()).getVmfs();
for (HostScsiDiskPartition partition : volume.getExtent()) {
HostScsiDisk disk = disksByName.get(partition.getDiskName());
disks.put(partition, disk);
}
return disks;
}
use of com.vmware.vim25.HostVmfsVolume in project coprhd-controller by CoprHD.
the class HostStorageAPI method listPartitions.
/**
* Lists the partitions for the datastore. This will only return values for a VMFS datastore.
*
* @param datastore the datastore.
* @return the list of disk partitions for the VMFS datastore.
*/
protected static List<HostScsiDiskPartition> listPartitions(Datastore datastore) {
List<HostScsiDiskPartition> partitions = Lists.newArrayList();
if (datastore.getInfo() instanceof VmfsDatastoreInfo) {
HostVmfsVolume volume = ((VmfsDatastoreInfo) datastore.getInfo()).getVmfs();
addItems(partitions, volume.getExtent());
}
return partitions;
}
use of com.vmware.vim25.HostVmfsVolume in project photon-model by vmware.
the class EnumerationClient method getDatastoresHostMountInfo.
/**
* Get the mount info of all the datastores that are connected to a given host.
*/
public Set<String> getDatastoresHostMountInfo(HostSystemOverlay hs) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
Set<String> sharedDs = new HashSet<>();
ArrayOfHostFileSystemMountInfo mountInfo = this.getMoRef.entityProp(hs.getId(), HOST_DS_MOUNT_INFO);
if (mountInfo != null) {
mountInfo.getHostFileSystemMountInfo().stream().filter(fsMountInfo -> fsMountInfo.getVolume() instanceof HostVmfsVolume).forEach(fsMountInfo -> {
HostVmfsVolume vmfsVol = (HostVmfsVolume) fsMountInfo.getVolume();
if (!vmfsVol.isLocal()) {
sharedDs.add(vmfsVol.getName());
}
});
}
return sharedDs;
}
Aggregations