Search in sources :

Example 6 with HostVmfsVolume

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

Example 7 with HostVmfsVolume

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

Example 8 with HostVmfsVolume

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;
}
Also used : Arrays(java.util.Arrays) FileQueryFlags(com.vmware.vim25.FileQueryFlags) InvalidDatastoreFaultMsg(com.vmware.vim25.InvalidDatastoreFaultMsg) BaseHelper(com.vmware.photon.controller.model.adapters.vsphere.util.connection.BaseHelper) LoggerFactory(org.slf4j.LoggerFactory) SelectionSpec(com.vmware.vim25.SelectionSpec) UpdateSet(com.vmware.vim25.UpdateSet) ArrayOfHostFileSystemMountInfo(com.vmware.vim25.ArrayOfHostFileSystemMountInfo) PropertyFilterSpec(com.vmware.vim25.PropertyFilterSpec) Utils(com.vmware.xenon.common.Utils) Map(java.util.Map) PbmProfileId(com.vmware.pbm.PbmProfileId) Connection(com.vmware.photon.controller.model.adapters.vsphere.util.connection.Connection) VimPortType(com.vmware.vim25.VimPortType) TaskInfo(com.vmware.vim25.TaskInfo) ArrayOfHostDatastoreBrowserSearchResults(com.vmware.vim25.ArrayOfHostDatastoreBrowserSearchResults) FinderException(com.vmware.photon.controller.model.adapters.vsphere.util.finders.FinderException) ObjectContent(com.vmware.vim25.ObjectContent) Set(java.util.Set) List(java.util.List) InvalidPropertyFaultMsg(com.vmware.vim25.InvalidPropertyFaultMsg) DiskService(com.vmware.photon.controller.model.resources.DiskService) WaitOptions(com.vmware.vim25.WaitOptions) Finder(com.vmware.photon.controller.model.adapters.vsphere.util.finders.Finder) VimPath(com.vmware.photon.controller.model.adapters.vsphere.util.VimPath) GetMoRef(com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef) RuntimeFaultFaultMsg(com.vmware.vim25.RuntimeFaultFaultMsg) RetrieveOptions(com.vmware.vim25.RetrieveOptions) ArrayList(java.util.ArrayList) VmDiskFileQuery(com.vmware.vim25.VmDiskFileQuery) HashSet(java.util.HashSet) CollectionUtils(org.apache.commons.collections.CollectionUtils) PbmProfile(com.vmware.pbm.PbmProfile) ObjectSpec(com.vmware.vim25.ObjectSpec) VmDiskFileQueryFilter(com.vmware.vim25.VmDiskFileQueryFilter) InvalidCollectorVersionFaultMsg(com.vmware.vim25.InvalidCollectorVersionFaultMsg) FileFaultFaultMsg(com.vmware.vim25.FileFaultFaultMsg) PropertySpec(com.vmware.vim25.PropertySpec) HostVmfsVolume(com.vmware.vim25.HostVmfsVolume) HostDatastoreBrowserSearchSpec(com.vmware.vim25.HostDatastoreBrowserSearchSpec) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) TraversalSpec(com.vmware.vim25.TraversalSpec) PbmFaultFaultMsg(com.vmware.pbm.PbmFaultFaultMsg) InvalidArgumentFaultMsg(com.vmware.pbm.InvalidArgumentFaultMsg) VimNames(com.vmware.photon.controller.model.adapters.vsphere.util.VimNames) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) RetrieveResult(com.vmware.vim25.RetrieveResult) ComputeStateWithDescription(com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription) PbmProfileResourceType(com.vmware.pbm.PbmProfileResourceType) PbmProfileResourceTypeEnum(com.vmware.pbm.PbmProfileResourceTypeEnum) Collections(java.util.Collections) HostVmfsVolume(com.vmware.vim25.HostVmfsVolume) ArrayOfHostFileSystemMountInfo(com.vmware.vim25.ArrayOfHostFileSystemMountInfo) HashSet(java.util.HashSet)

Aggregations

HostVmfsVolume (com.vmware.vim25.HostVmfsVolume)8 HostStorageAPI (com.iwave.ext.vmware.HostStorageAPI)2 VMWareException (com.iwave.ext.vmware.VMWareException)2 HostFileSystemMountInfo (com.vmware.vim25.HostFileSystemMountInfo)2 HostFileSystemVolume (com.vmware.vim25.HostFileSystemVolume)2 HostScsiDiskPartition (com.vmware.vim25.HostScsiDiskPartition)2 RemoteException (java.rmi.RemoteException)2 InvalidArgumentFaultMsg (com.vmware.pbm.InvalidArgumentFaultMsg)1 PbmFaultFaultMsg (com.vmware.pbm.PbmFaultFaultMsg)1 PbmProfile (com.vmware.pbm.PbmProfile)1 PbmProfileId (com.vmware.pbm.PbmProfileId)1 PbmProfileResourceType (com.vmware.pbm.PbmProfileResourceType)1 PbmProfileResourceTypeEnum (com.vmware.pbm.PbmProfileResourceTypeEnum)1 VimNames (com.vmware.photon.controller.model.adapters.vsphere.util.VimNames)1 VimPath (com.vmware.photon.controller.model.adapters.vsphere.util.VimPath)1 BaseHelper (com.vmware.photon.controller.model.adapters.vsphere.util.connection.BaseHelper)1 Connection (com.vmware.photon.controller.model.adapters.vsphere.util.connection.Connection)1 GetMoRef (com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef)1 Finder (com.vmware.photon.controller.model.adapters.vsphere.util.finders.Finder)1 FinderException (com.vmware.photon.controller.model.adapters.vsphere.util.finders.FinderException)1