use of com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities 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);
}
}
use of com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities in project coprhd-controller by CoprHD.
the class HP3PARProvisioningHelper method createVolumes.
public DriverTask createVolumes(List<StorageVolume> volumes, StorageCapabilities capabilities, DriverTask task, Registry driverRegistry) {
int volumesCreated = 0;
boolean IsDeDupEnabled = false;
// get deduplicationCapability
CommonStorageCapabilities commonCapabilities = capabilities.getCommonCapabilitis();
if (commonCapabilities != null) {
List<DataStorageServiceOption> dataService = commonCapabilities.getDataStorage();
if (dataService != null) {
for (DataStorageServiceOption dataServiceOption : dataService) {
List<CapabilityInstance> capabilityList = dataServiceOption.getCapabilities();
if (capabilityList != null) {
for (CapabilityInstance ci : capabilityList) {
String provTypeValue = ci.getPropertyValue(DeduplicationCapabilityDefinition.PROPERTY_NAME.ENABLED.name());
if (provTypeValue != null && provTypeValue.equalsIgnoreCase(Boolean.TRUE.toString())) {
IsDeDupEnabled = true;
}
}
}
}
}
}
// For each requested volume
for (StorageVolume volume : volumes) {
try {
_log.info("3PARDriver:createVolumes for storage system native id {}, volume name {} - start", volume.getStorageSystemId(), volume.getDisplayName());
// get Api client
HP3PARApi hp3parApi = hp3parUtil.getHP3PARDeviceFromNativeId(volume.getStorageSystemId(), driverRegistry);
// Create volume
VolumeDetailsCommandResult volResult = null;
Boolean isThin = volume.getThinlyProvisioned();
if (IsDeDupEnabled) {
isThin = false;
}
hp3parApi.createVolume(volume.getDisplayName(), volume.getStoragePoolId(), isThin, IsDeDupEnabled, volume.getRequestedCapacity() / HP3PARConstants.MEGA_BYTE);
volResult = hp3parApi.getVolumeDetails(volume.getDisplayName());
// Attributes of the volume in array
volume.setProvisionedCapacity(volResult.getSizeMiB() * HP3PARConstants.MEGA_BYTE);
// Allocated capacity is the sum of user, snapshot and admin reserved space
Long allocatedCapacity = volResult.getUserSpace().getReservedMiB();
allocatedCapacity += volResult.getSnapshotSpace().getReservedMiB();
allocatedCapacity += volResult.getAdminSpace().getReservedMiB();
volume.setAllocatedCapacity(allocatedCapacity * HP3PARConstants.MEGA_BYTE);
volume.setWwn(volResult.getWwn());
// required for volume delete
volume.setNativeId(volume.getDisplayName());
volume.setDeviceLabel(volume.getDisplayName());
volume.setAccessStatus(AccessStatus.READ_WRITE);
// Update Consistency Group
String volumeCGName = volume.getConsistencyGroup();
if (volumeCGName != null && !volumeCGName.isEmpty()) {
_log.info("3PARDriver:createVolumes Adding volume {} to consistency group {} ", volume.getDisplayName(), volumeCGName);
int addMember = 1;
hp3parApi.updateVVset(volumeCGName, volume.getNativeId(), addMember);
}
volumesCreated++;
_log.info("3PARDriver:createVolumes for storage system native id {}, volume name {} - end", volume.getStorageSystemId(), volume.getDisplayName());
} catch (Exception e) {
String msg = String.format("3PARDriver: Unable to create volume name %s with pool id %s for storage system native id %s; Error: %s.\n", volume.getDisplayName(), volume.getStoragePoolId(), volume.getStorageSystemId(), e);
_log.error(msg);
_log.error(CompleteError.getStackTrace(e));
task.setMessage(msg);
e.printStackTrace();
}
}
if (volumes.size() != 0) {
if (volumesCreated == volumes.size()) {
task.setMessage("Successful");
task.setStatus(DriverTask.TaskStatus.READY);
} else if (volumesCreated == 0) {
task.setStatus(DriverTask.TaskStatus.FAILED);
} else {
task.setStatus(DriverTask.TaskStatus.PARTIALLY_FAILED);
}
}
return task;
}
use of com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities in project coprhd-controller by CoprHD.
the class ExternalDeviceExportOperations method prepareCapabilities.
private void prepareCapabilities(ExportPathParams pathParams, StorageCapabilities capabilities) {
ExportPathsServiceOption numPath = new ExportPathsServiceOption(pathParams.getMinPaths(), pathParams.getMaxPaths());
List<ExportPathsServiceOption> exportPathParams = new ArrayList<>();
exportPathParams.add(numPath);
CommonStorageCapabilities commonCapabilities = new CommonStorageCapabilities();
commonCapabilities.setExportPathParams(exportPathParams);
capabilities.setCommonCapabilitis(commonCapabilities);
}
use of com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities in project coprhd-controller by CoprHD.
the class ExternalDeviceExportOperations method prepareCapabilitiesForAddInitiators.
private void prepareCapabilitiesForAddInitiators(ExportPathParams pathParams, StringSetMap existingZoningMap, URI varrayURI, List<com.emc.storageos.db.client.model.Initiator> initiators, StorageCapabilities capabilities) {
int driverMaxPath;
StringSetMap zoningMap = new StringSetMap();
// Calculate existing paths (without new initiators).
int existingPaths = 0;
List<URI> initiatorUris = URIUtil.toUris(initiators);
for (Map.Entry<String, AbstractChangeTrackingSet<String>> entry : existingZoningMap.entrySet()) {
if (!initiatorUris.contains(URIUtil.uri(entry.getKey()))) {
zoningMap.put(entry.getKey(), entry.getValue());
}
}
Map<com.emc.storageos.db.client.model.Initiator, List<com.emc.storageos.db.client.model.StoragePort>> assignments = blockScheduler.generateInitiatorsToStoragePortsMap(zoningMap, varrayURI);
existingPaths = assignments.values().size();
log.info("Existing path number in the export mask is {}", existingPaths);
// Otherwise we allocate the difference between max paths and existing paths
if (existingPaths + pathParams.getPathsPerInitiator() > pathParams.getMaxPaths()) {
// we always need at least path-per-initiator ports
driverMaxPath = pathParams.getPathsPerInitiator();
} else {
driverMaxPath = pathParams.getMaxPaths() - existingPaths;
}
// We assume that masking view meets min path before new initiators are added. We pass ppi as a minPath
// to driver, so we can zone at least one new initiator.
ExportPathsServiceOption numPath = new ExportPathsServiceOption(pathParams.getPathsPerInitiator(), driverMaxPath);
List<ExportPathsServiceOption> exportPathParams = new ArrayList<>();
exportPathParams.add(numPath);
CommonStorageCapabilities commonCapabilities = new CommonStorageCapabilities();
commonCapabilities.setExportPathParams(exportPathParams);
capabilities.setCommonCapabilitis(commonCapabilities);
}
use of com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities 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);
}
}
Aggregations