Search in sources :

Example 1 with AutoTieringPolicyCapabilityDefinition

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

the class ExternalBlockStorageDevice method addAutoTieringPolicyCapability.

/**
 * Create the auto tiering policy capability and add it to the passed
 * storage capabilities
 *
 * @param storageCapabilities A reference to all storage capabilities.
 * @param autoTieringPolicyURI The URI of the AutoTieringPolicy or null.
 */
private void addAutoTieringPolicyCapability(StorageCapabilities storageCapabilities, URI autoTieringPolicyURI) {
    if (!NullColumnValueGetter.isNullURI(autoTieringPolicyURI)) {
        AutoTieringPolicy autoTieringPolicy = dbClient.queryObject(AutoTieringPolicy.class, autoTieringPolicyURI);
        if (autoTieringPolicy == null) {
            throw DeviceControllerException.exceptions.objectNotFound(autoTieringPolicyURI);
        }
        // Create the auto tiering policy capability.
        AutoTieringPolicyCapabilityDefinition capabilityDefinition = new AutoTieringPolicyCapabilityDefinition();
        Map<String, List<String>> capabilityProperties = new HashMap<>();
        capabilityProperties.put(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.POLICY_ID.name(), Arrays.asList(autoTieringPolicy.getPolicyName()));
        capabilityProperties.put(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.PROVISIONING_TYPE.name(), Arrays.asList(autoTieringPolicy.getProvisioningType()));
        CapabilityInstance autoTieringCapability = new CapabilityInstance(capabilityDefinition.getId(), autoTieringPolicy.getPolicyName(), 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 AutoTiering policy capability
        // and add it to the list.
        DataStorageServiceOption dataStorageSvcOption = new DataStorageServiceOption(Arrays.asList(autoTieringCapability));
        dataStorageSvcOptions.add(dataStorageSvcOption);
    }
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) HashMap(java.util.HashMap) 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) AutoTieringPolicyCapabilityDefinition(com.emc.storageos.storagedriver.storagecapabilities.AutoTieringPolicyCapabilityDefinition)

Example 2 with AutoTieringPolicyCapabilityDefinition

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

AutoTieringPolicyCapabilityDefinition (com.emc.storageos.storagedriver.storagecapabilities.AutoTieringPolicyCapabilityDefinition)2 CapabilityInstance (com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 AutoTieringPolicy (com.emc.storageos.db.client.model.AutoTieringPolicy)1 DriverTask (com.emc.storageos.storagedriver.DriverTask)1 StoragePool (com.emc.storageos.storagedriver.model.StoragePool)1 CommonStorageCapabilities (com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities)1 DataStorageServiceOption (com.emc.storageos.storagedriver.storagecapabilities.DataStorageServiceOption)1 HashSet (java.util.HashSet)1 BeansException (org.springframework.beans.BeansException)1