Search in sources :

Example 1 with HostScsiDiskPartition

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;
}
Also used : VmfsDatastoreInfo(com.vmware.vim25.VmfsDatastoreInfo) HostScsiDiskPartition(com.vmware.vim25.HostScsiDiskPartition) HostVmfsVolume(com.vmware.vim25.HostVmfsVolume) HostScsiDisk(com.vmware.vim25.HostScsiDisk)

Example 2 with HostScsiDiskPartition

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;
}
Also used : VmfsDatastoreInfo(com.vmware.vim25.VmfsDatastoreInfo) HostScsiDiskPartition(com.vmware.vim25.HostScsiDiskPartition) HostVmfsVolume(com.vmware.vim25.HostVmfsVolume)

Aggregations

HostScsiDiskPartition (com.vmware.vim25.HostScsiDiskPartition)2 HostVmfsVolume (com.vmware.vim25.HostVmfsVolume)2 VmfsDatastoreInfo (com.vmware.vim25.VmfsDatastoreInfo)2 HostScsiDisk (com.vmware.vim25.HostScsiDisk)1