Search in sources :

Example 6 with CapabilityInstance

use of com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance 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)

Example 7 with CapabilityInstance

use of com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance in project coprhd-controller by CoprHD.

the class ExternalBlockStorageDevice method addDeduplicationCapability.

/**
 * Create deduplication capability and add it to the passed
 * storage capabilities
 *
 * @param storageCapabilities reference to storage capbilities
 * @param deduplication indicates if deduplication is required
 */
private void addDeduplicationCapability(StorageCapabilities storageCapabilities, Boolean deduplication) {
    if (deduplication) {
        // Create the deduplicated capability.
        DeduplicationCapabilityDefinition capabilityDefinition = new DeduplicationCapabilityDefinition();
        Map<String, List<String>> capabilityProperties = new HashMap<>();
        capabilityProperties.put(DeduplicationCapabilityDefinition.PROPERTY_NAME.ENABLED.name(), Collections.singletonList(Boolean.TRUE.toString()));
        CapabilityInstance dedupCapability = new CapabilityInstance(capabilityDefinition.getId(), capabilityDefinition.getId(), capabilityProperties);
        // Get the common capabilities for the passed storage capabilities.
        // If null, create and set it.
        CommonStorageCapabilities commonCapabilities = storageCapabilities.getCommonCapabilitis();
        if (commonCapabilities == null) {
            commonCapabilities = new CommonStorageCapabilities();
            storageCapabilities.setCommonCapabilitis(commonCapabilities);
        }
        // Get the data storage service options for the common capabilities.
        // If null, create it and set it.
        List<DataStorageServiceOption> dataStorageSvcOptions = commonCapabilities.getDataStorage();
        if (dataStorageSvcOptions == null) {
            dataStorageSvcOptions = new ArrayList<>();
            commonCapabilities.setDataStorage(dataStorageSvcOptions);
        }
        // Create a new data storage service option for the auto tiering policy capability
        // and add it to the list.
        DataStorageServiceOption dataStorageSvcOption = new DataStorageServiceOption(Collections.singletonList(dedupCapability));
        dataStorageSvcOptions.add(dataStorageSvcOption);
    }
}
Also used : HashMap(java.util.HashMap) DeduplicationCapabilityDefinition(com.emc.storageos.storagedriver.storagecapabilities.DeduplicationCapabilityDefinition) CommonStorageCapabilities(com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities) CapabilityInstance(com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance) DataStorageServiceOption(com.emc.storageos.storagedriver.storagecapabilities.DataStorageServiceOption) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Aggregations

CapabilityInstance (com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance)7 ArrayList (java.util.ArrayList)5 AutoTieringPolicyCapabilityDefinition (com.emc.storageos.storagedriver.storagecapabilities.AutoTieringPolicyCapabilityDefinition)4 DeduplicationCapabilityDefinition (com.emc.storageos.storagedriver.storagecapabilities.DeduplicationCapabilityDefinition)4 HashMap (java.util.HashMap)4 List (java.util.List)4 StoragePool (com.emc.storageos.storagedriver.model.StoragePool)3 CommonStorageCapabilities (com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities)3 DataStorageServiceOption (com.emc.storageos.storagedriver.storagecapabilities.DataStorageServiceOption)3 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 VolumeDetailsCommandResult (com.emc.storageos.hp3par.command.VolumeDetailsCommandResult)2 DriverTask (com.emc.storageos.storagedriver.DriverTask)2 CapabilityDefinition (com.emc.storageos.storagedriver.storagecapabilities.CapabilityDefinition)2 HashSet (java.util.HashSet)2 AutoTieringPolicy (com.emc.storageos.db.client.model.AutoTieringPolicy)1 CPGCommandResult (com.emc.storageos.hp3par.command.CPGCommandResult)1 CPGMember (com.emc.storageos.hp3par.command.CPGMember)1 CPGSpaceCommandResult (com.emc.storageos.hp3par.command.CPGSpaceCommandResult)1 VolumesCommandResult (com.emc.storageos.hp3par.command.VolumesCommandResult)1 Protocols (com.emc.storageos.storagedriver.model.StoragePool.Protocols)1