use of com.vmware.vim25.HostScsiDiskPartition 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.HostScsiDiskPartition 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;
}
Aggregations