Search in sources :

Example 11 with SRDFCopyRecommendation

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;
}
Also used : VolumeDescriptor(com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) BlockOrchestrationController(com.emc.storageos.blockorchestrationcontroller.BlockOrchestrationController) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) TaskList(com.emc.storageos.model.TaskList) ArrayList(java.util.ArrayList) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) Operation(com.emc.storageos.db.client.model.Operation) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_VPLEX_MIRROR_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) VolumeRecommendation(com.emc.storageos.api.service.impl.placement.VolumeRecommendation) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) Volume(com.emc.storageos.db.client.model.Volume)

Aggregations

SRDFCopyRecommendation (com.emc.storageos.volumecontroller.SRDFCopyRecommendation)11 ArrayList (java.util.ArrayList)11 Recommendation (com.emc.storageos.volumecontroller.Recommendation)10 SRDFRecommendation (com.emc.storageos.volumecontroller.SRDFRecommendation)10 NamedURI (com.emc.storageos.db.client.model.NamedURI)9 URI (java.net.URI)9 VPlexRecommendation (com.emc.storageos.volumecontroller.VPlexRecommendation)8 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)7 Project (com.emc.storageos.db.client.model.Project)6 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)6 StringSet (com.emc.storageos.db.client.model.StringSet)6 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)6 List (java.util.List)6 VolumeDescriptor (com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor)5 Network (com.emc.storageos.db.client.model.Network)5 StoragePool (com.emc.storageos.db.client.model.StoragePool)5 StringMap (com.emc.storageos.db.client.model.StringMap)5 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)5 VpoolRemoteCopyProtectionSettings (com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings)5 RPProtectionRecommendation (com.emc.storageos.volumecontroller.RPProtectionRecommendation)5