use of com.emc.storageos.storagedriver.storagecapabilities.CapabilityDefinition in project coprhd-controller by CoprHD.
the class ExternalDeviceCommunicationInterface method discoverAutoTieringPoliciesForStoragePool.
/**
* Discovers the auto tiering policies supported by the passed driver storage pool
* and updates the passed auto tiering policy maps.
*
* @param driverStorageSystem A reference to the driver storage system.
* @param storagePool A reference to the driver storage pool.
* @param pool A reference to the controller storage pool representing the driver storage pool.
* @param autoTieringPolicyPoolMap A map of unique policy ids and controller storage pools that support the policy.
* @param autoTieringPolicyPropertiesMap A map of unique policy ids and the policy properties.
*/
private void discoverAutoTieringPoliciesForStoragePool(StorageSystem driverStorageSystem, StoragePool storagePool, com.emc.storageos.db.client.model.StoragePool pool, Map<String, List<com.emc.storageos.db.client.model.StoragePool>> autoTieringPolicyPoolMap, Map<String, Map<String, List<String>>> autoTieringPolicyPropertiesMap) {
// Get the capabilities specified for the storage pool and
// process any auto tiering policy capabilities.
List<CapabilityInstance> capabilities = storagePool.getCapabilities();
if (capabilities == null) {
return;
}
for (CapabilityInstance capability : capabilities) {
// Get the capability definition for the capability.
String capabilityDefinitionUid = capability.getCapabilityDefinitionUid();
if ((capabilityDefinitionUid == null) || (capabilityDefinitionUid.isEmpty())) {
_log.error(String.format("Skipping capability %s with no capability definition UID for storage pool %s on system %s", capability.getName(), storagePool.getNativeId(), driverStorageSystem.getNativeId()));
continue;
}
// Get the capability definition from the map of supported capability definitions.
CapabilityDefinition capabilityDefinition = capabilityDefinitions.get(capabilityDefinitionUid);
if (capabilityDefinition == null) {
_log.info(String.format("Skipping unsupported capability of type %s for storage pool %s on system %s", capabilityDefinitionUid, storagePool.getNativeId(), driverStorageSystem.getNativeId()));
continue;
}
// Handle auto tiering policy capability.
if (AutoTieringPolicyCapabilityDefinition.CAPABILITY_UID.equals(capabilityDefinitionUid)) {
// Get the policy id.
String policyId = capability.getPropertyValue(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.POLICY_ID.name());
if (policyId == null) {
_log.error(String.format("Skipping auto tiering policy capability %s with no policy id for storage pool %s on system %s", capability.getName(), storagePool.getNativeId(), driverStorageSystem.getNativeId()));
continue;
}
// Add the pool to the set of storage pools for this auto tiering policy.
if (autoTieringPolicyPoolMap.containsKey(policyId)) {
List<com.emc.storageos.db.client.model.StoragePool> autoTieringPolicyPools = autoTieringPolicyPoolMap.get(policyId);
autoTieringPolicyPools.add(pool);
} else {
List<com.emc.storageos.db.client.model.StoragePool> autoTieringPolicyPools = new ArrayList<>();
autoTieringPolicyPools.add(pool);
autoTieringPolicyPoolMap.put(policyId, autoTieringPolicyPools);
}
// Also, save the properties for this auto tiering policy.
if (!autoTieringPolicyPropertiesMap.containsKey(policyId)) {
autoTieringPolicyPropertiesMap.put(policyId, capability.getProperties());
}
}
}
}
use of com.emc.storageos.storagedriver.storagecapabilities.CapabilityDefinition in project coprhd-controller by CoprHD.
the class ExternalDeviceCommunicationInterface method discoverDeduplicationCapabilityForStoragePool.
/**
* Discover deduplication capability for storage pool.
* If driver does not report "deduplication" for storage pool, we assume that deduplication is disabled.
* If driver reports "deduplication" for storage pool, we assume that it is enabled, unless its ENABLED property is set to false.
*
* @param driverStorageSystem A reference to the driver storage system.
* @param driverPool A reference to the driver storage pool.
* @param dbPool A reference to the system storage pool representing the driver storage pool.
*/
private void discoverDeduplicationCapabilityForStoragePool(StorageSystem driverStorageSystem, StoragePool driverPool, com.emc.storageos.db.client.model.StoragePool dbPool) {
// Get the capabilities specified for the storage pool and
// process and process deduplication capability if reported by driver
List<CapabilityInstance> capabilities = driverPool.getCapabilities();
if (capabilities == null) {
return;
}
for (CapabilityInstance capability : capabilities) {
// Get the capability definition for the capability.
String capabilityDefinitionUid = capability.getCapabilityDefinitionUid();
if ((capabilityDefinitionUid == null) || (capabilityDefinitionUid.isEmpty())) {
_log.error(String.format("Skipping capability %s with no capability definition UID for storage pool %s on system %s", capability.getName(), driverPool.getNativeId(), driverStorageSystem.getNativeId()));
continue;
}
// Get the capability definition from the map of supported
// capability definitions.
CapabilityDefinition capabilityDefinition = capabilityDefinitions.get(capabilityDefinitionUid);
if (capabilityDefinition == null) {
_log.info(String.format("Skipping unsupported capability of type %s for storage pool %s on system %s", capabilityDefinitionUid, driverPool.getNativeId(), driverStorageSystem.getNativeId()));
continue;
}
if (DeduplicationCapabilityDefinition.CAPABILITY_UID.equals(capabilityDefinitionUid)) {
// Handle dedup capability.
// Check if dedup is enabled; we assume that if driver reports deduplication in pool capabilities,
// it is enabled by default, unless it is explicitly disabled.
String isEnabled = capability.getPropertyValue(DeduplicationCapabilityDefinition.PROPERTY_NAME.ENABLED.name());
if (isEnabled != null && isEnabled.equalsIgnoreCase("false")) {
_log.info(String.format("StoragePool %s of storage system %s has deduplication disabled", driverPool.getNativeId(), driverStorageSystem.getNativeId()));
dbPool.setDedupCapable(false);
} else {
_log.info(String.format("Enable deduplication for StoragePool %s of storage system %s ", driverPool.getNativeId(), driverStorageSystem.getNativeId()));
dbPool.setDedupCapable(true);
}
}
}
}
Aggregations