Search in sources :

Example 6 with StoragePool

use of com.emc.storageos.storagedriver.model.StoragePool in project coprhd-controller by CoprHD.

the class DellSCUtil method getStoragePoolFromStorageType.

/**
 * Gets a StoragePool object for a storage type.
 *
 * @param api The Storage Center API connection.
 * @param storageType The storage type.
 * @param pool The StoragePool object to populate or null.
 * @return The StoragePool.
 */
public StoragePool getStoragePoolFromStorageType(StorageCenterAPI api, ScStorageType storageType, StoragePool pool) {
    if (pool == null) {
        pool = new StoragePool();
    }
    pool.setNativeId(storageType.instanceId);
    pool.setStorageSystemId(storageType.scSerialNumber);
    LOG.info("Discovered Pool {}, storageSystem {}", pool.getNativeId(), pool.getStorageSystemId());
    pool.setDeviceLabel(storageType.name);
    pool.setDisplayName(storageType.name);
    pool.setPoolName(storageType.name);
    pool.setCapabilities(new ArrayList<>(0));
    // Get the supported transport protocols
    Set<StoragePool.Protocols> protocols = new HashSet<>();
    List<String> transportProtocols = getSupportedProtocols(api, storageType.scSerialNumber);
    if (transportProtocols.contains(Protocol.FC.toString())) {
        protocols.add(StoragePool.Protocols.FC);
    }
    if (transportProtocols.contains(Protocol.iSCSI.toString())) {
        protocols.add(StoragePool.Protocols.iSCSI);
    }
    pool.setProtocols(protocols);
    pool.setPoolServiceType(StoragePool.PoolServiceType.block);
    pool.setMaximumThickVolumeSize(0L);
    pool.setMinimumThickVolumeSize(0L);
    // Max 512 TB
    pool.setMaximumThinVolumeSize(549755813888L);
    // Min 1 GB
    pool.setMinimumThinVolumeSize(1048576L);
    pool.setSupportedResourceType(StoragePool.SupportedResourceType.THIN_ONLY);
    ScStorageTypeStorageUsage su = api.getStorageTypeStorageUsage(storageType.instanceId);
    LOG.info("Space info: {} {} {}", su.allocatedSpace, su.freeSpace, su.usedSpace);
    pool.setSubscribedCapacity(SizeUtil.sizeStrToKBytes(su.usedSpace));
    pool.setFreeCapacity(SizeUtil.sizeStrToKBytes(su.freeSpace));
    pool.setTotalCapacity(SizeUtil.sizeStrToKBytes(su.allocatedSpace));
    pool.setOperationalStatus(StoragePool.PoolOperationalStatus.READY);
    return pool;
}
Also used : Protocols(com.emc.storageos.storagedriver.model.StoragePool.Protocols) StoragePool(com.emc.storageos.storagedriver.model.StoragePool) ScStorageTypeStorageUsage(com.emc.storageos.driver.dellsc.scapi.objects.ScStorageTypeStorageUsage) HashSet(java.util.HashSet)

Example 7 with StoragePool

use of com.emc.storageos.storagedriver.model.StoragePool in project coprhd-controller by CoprHD.

the class StorageDriverSimulator method discoverStoragePools.

@Override
public DriverTask discoverStoragePools(StorageSystem storageSystem, List<StoragePool> storagePools) {
    _log.info("Discovery of storage pools for storage system {} .", storageSystem.getNativeId());
    String taskType = "discover-storage-pools";
    String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
    DriverTask task = new DriverSimulatorTask(taskId);
    AutoTieringPolicyCapabilityDefinition capabilityDefinition = new AutoTieringPolicyCapabilityDefinition();
    try {
        // Get connection information.
        Map<String, List<String>> connectionInfo = driverRegistry.getDriverAttributesForKey("StorageDriverSimulator", storageSystem.getNativeId());
        _log.info("Storage system connection info: {} : {}", storageSystem.getNativeId(), connectionInfo);
        for (int i = 0; i <= 2; i++) {
            StoragePool pool = new StoragePool();
            pool.setNativeId("pool-1234577-" + i + storageSystem.getNativeId());
            pool.setStorageSystemId(storageSystem.getNativeId());
            _log.info("Discovered Pool {}, storageSystem {}", pool.getNativeId(), pool.getStorageSystemId());
            pool.setDeviceLabel("er-pool-1234577" + i + storageSystem.getNativeId());
            pool.setPoolName(pool.getDeviceLabel());
            Set<StoragePool.Protocols> protocols = new HashSet<>();
            protocols.add(StoragePool.Protocols.FC);
            protocols.add(StoragePool.Protocols.iSCSI);
            // protocols.add(StoragePool.Protocols.ScaleIO);
            pool.setProtocols(protocols);
            pool.setPoolServiceType(StoragePool.PoolServiceType.block);
            pool.setMaximumThickVolumeSize(3000000L);
            pool.setMinimumThickVolumeSize(1000L);
            pool.setMaximumThinVolumeSize(5000000L);
            pool.setMinimumThinVolumeSize(1000L);
            if (i % 2 == 0) {
                pool.setSupportedResourceType(StoragePool.SupportedResourceType.THIN_ONLY);
            } else {
                pool.setSupportedResourceType(StoragePool.SupportedResourceType.THICK_ONLY);
            }
            pool.setSubscribedCapacity(5000000L);
            pool.setFreeCapacity(45000000L);
            pool.setTotalCapacity(48000000L);
            pool.setOperationalStatus(StoragePool.PoolOperationalStatus.READY);
            Set<StoragePool.SupportedDriveTypes> supportedDriveTypes = new HashSet<>();
            supportedDriveTypes.add(StoragePool.SupportedDriveTypes.FC);
            supportedDriveTypes.add(StoragePool.SupportedDriveTypes.SATA);
            pool.setSupportedDriveTypes(supportedDriveTypes);
            // Set<StoragePool.RaidLevels> raidLevels = new HashSet<>();
            // raidLevels.add(StoragePool.RaidLevels.RAID5);
            // raidLevels.add(StoragePool.RaidLevels.RAID6);
            // pool.setSupportedRaidLevels(raidLevels);
            List<CapabilityInstance> capabilities = new ArrayList<>();
            for (int j = 1; j <= 2; j++) {
                String policyId = "Auto-Tier-Policy-" + i + j;
                Map<String, List<String>> props = new HashMap<>();
                props.put(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.POLICY_ID.name(), Arrays.asList(policyId));
                String provisioningType;
                if (i % 2 == 0) {
                    provisioningType = StoragePool.AutoTieringPolicyProvisioningType.ThinlyProvisioned.name();
                } else {
                    provisioningType = StoragePool.AutoTieringPolicyProvisioningType.ThicklyProvisioned.name();
                }
                props.put(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.PROVISIONING_TYPE.name(), Arrays.asList(provisioningType));
                CapabilityInstance capabilityInstance = new CapabilityInstance(capabilityDefinition.getId(), policyId, props);
                capabilities.add(capabilityInstance);
            }
            pool.setCapabilities(capabilities);
            storagePools.add(pool);
        }
        task.setStatus(DriverTask.TaskStatus.READY);
        _log.info("StorageDriver: discoverStoragePools information for storage system {}, nativeId {} - end", storageSystem.getIpAddress(), storageSystem.getNativeId());
    } catch (Exception e) {
        task.setStatus(DriverTask.TaskStatus.FAILED);
        e.printStackTrace();
    }
    return task;
}
Also used : StoragePool(com.emc.storageos.storagedriver.model.StoragePool) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BeansException(org.springframework.beans.BeansException) DriverTask(com.emc.storageos.storagedriver.DriverTask) CapabilityInstance(com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance) ArrayList(java.util.ArrayList) List(java.util.List) AutoTieringPolicyCapabilityDefinition(com.emc.storageos.storagedriver.storagecapabilities.AutoTieringPolicyCapabilityDefinition) HashSet(java.util.HashSet)

Aggregations

StoragePool (com.emc.storageos.storagedriver.model.StoragePool)7 ArrayList (java.util.ArrayList)4 DriverTask (com.emc.storageos.storagedriver.DriverTask)3 CapabilityInstance (com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 CPGMember (com.emc.storageos.hp3par.command.CPGMember)2 CPGSpaceCommandResult (com.emc.storageos.hp3par.command.CPGSpaceCommandResult)2 VolumesCommandResult (com.emc.storageos.hp3par.command.VolumesCommandResult)2 Protocols (com.emc.storageos.storagedriver.model.StoragePool.Protocols)2 VolumeConsistencyGroup (com.emc.storageos.storagedriver.model.VolumeConsistencyGroup)2 AutoTieringPolicyCapabilityDefinition (com.emc.storageos.storagedriver.storagecapabilities.AutoTieringPolicyCapabilityDefinition)2 DeduplicationCapabilityDefinition (com.emc.storageos.storagedriver.storagecapabilities.DeduplicationCapabilityDefinition)2 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 StringMap (com.emc.storageos.db.client.model.StringMap)1 ScStorageTypeStorageUsage (com.emc.storageos.driver.dellsc.scapi.objects.ScStorageTypeStorageUsage)1 CPGCommandResult (com.emc.storageos.hp3par.command.CPGCommandResult)1 ConsistencyGroupResult (com.emc.storageos.hp3par.command.ConsistencyGroupResult)1 VolumeDetailsCommandResult (com.emc.storageos.hp3par.command.VolumeDetailsCommandResult)1