use of com.emc.storageos.volumecontroller.SRDFCopyRecommendation in project coprhd-controller by CoprHD.
the class VPlexBlockServiceApiImpl method createVolumes.
/**
* {@inheritDoc}
*
* @throws InternalException
*/
@Override
public TaskList createVolumes(VolumeCreate param, Project project, VirtualArray vArray, VirtualPool vPool, Map<VpoolUse, List<Recommendation>> recommendationMap, TaskList taskList, String task, VirtualPoolCapabilityValuesWrapper vPoolCapabilities) throws InternalException {
List<Recommendation> volRecommendations = recommendationMap.get(VpoolUse.ROOT);
List<Recommendation> srdfCopyRecommendations = recommendationMap.get(VpoolUse.SRDF_COPY);
if (taskList == null) {
taskList = new TaskList();
}
List<URI> allVolumes = new ArrayList<URI>();
List<VolumeDescriptor> descriptors = createVPlexVolumeDescriptors(param, project, vArray, vPool, volRecommendations, task, vPoolCapabilities, vPoolCapabilities.getBlockConsistencyGroup(), taskList, allVolumes, true);
for (VolumeDescriptor desc : descriptors) {
s_logger.info("Vplex Root Descriptors: " + desc.toString());
}
if (srdfCopyRecommendations != null) {
// This may be a Vplex volume or not
for (Recommendation srdfCopyRecommendation : srdfCopyRecommendations) {
vArray = _dbClient.queryObject(VirtualArray.class, srdfCopyRecommendation.getVirtualArray());
vPool = srdfCopyRecommendation.getVirtualPool();
List<VolumeDescriptor> srdfCopyDescriptors = new ArrayList<VolumeDescriptor>();
List<Recommendation> copyRecommendations = new ArrayList<Recommendation>();
copyRecommendations.add(srdfCopyRecommendation);
if (srdfCopyRecommendation instanceof VPlexRecommendation) {
String name = param.getName();
// Do not pass in the consistency group for vplex volumes fronting targets
// as we will eventually put them in the target CG.
srdfCopyDescriptors = createVPlexVolumeDescriptors(param, project, vArray, vPool, copyRecommendations, task, vPoolCapabilities, null, taskList, allVolumes, true);
param.setName(name);
} else {
srdfCopyDescriptors = super.createVolumesAndDescriptors(srdfCopyDescriptors, param.getName() + "_srdf_copy", vPoolCapabilities.getSize(), project, vArray, vPool, copyRecommendations, taskList, task, vPoolCapabilities);
}
for (VolumeDescriptor desc : srdfCopyDescriptors) {
s_logger.info("SRDF Copy: " + desc.toString());
}
descriptors.addAll(srdfCopyDescriptors);
}
}
// Log volume descriptor information
logVolumeDescriptorPrecreateInfo(descriptors, task);
// Now we get the Orchestration controller and use it to create the volumes of all types.
try {
BlockOrchestrationController controller = getController(BlockOrchestrationController.class, BlockOrchestrationController.BLOCK_ORCHESTRATION_DEVICE);
controller.createVolumes(descriptors, task);
} catch (InternalException e) {
if (s_logger.isErrorEnabled()) {
s_logger.error("Controller error", e);
}
String errMsg = String.format("Controller error: %s", e.getMessage());
Operation statusUpdate = new Operation(Operation.Status.error.name(), errMsg);
for (URI volumeURI : allVolumes) {
_dbClient.updateTaskOpStatus(Volume.class, volumeURI, task, statusUpdate);
}
for (TaskResourceRep volumeTask : taskList.getTaskList()) {
volumeTask.setState(Operation.Status.error.name());
volumeTask.setMessage(errMsg);
}
throw e;
}
return taskList;
}
Aggregations