Search in sources :

Example 1 with RecreateReplicationSetRequestParams

use of com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams in project coprhd-controller by CoprHD.

the class RPDeviceController method addPreVolumeExpandSteps.

/**
 * RP specific workflow steps required prior to expanding the underlying volume are added here.
 * Ex. RP CG remove replication sets.
 *
 * @param workflow
 * @param volURI
 * @param expandVolURIs
 * @param taskId
 * @return
 * @throws WorkflowException
 */
public String addPreVolumeExpandSteps(Workflow workflow, List<VolumeDescriptor> volumeDescriptors, String taskId) throws WorkflowException {
    // Just grab a legit target volume that already has an assigned protection controller.
    // This will work for all operations, adding, removing, vpool change, etc.
    List<VolumeDescriptor> protectionControllerDescriptors = VolumeDescriptor.filterByType(volumeDescriptors, new VolumeDescriptor.Type[] { VolumeDescriptor.Type.RP_TARGET, VolumeDescriptor.Type.RP_VPLEX_VIRT_TARGET }, new VolumeDescriptor.Type[] {});
    // If there are no RP volumes, just return
    if (protectionControllerDescriptors.isEmpty()) {
        return null;
    }
    // Grab any volume from the list so we can grab the protection system, which will be the same for all volumes.
    Volume volume = _dbClient.queryObject(Volume.class, protectionControllerDescriptors.get(0).getVolumeURI());
    ProtectionSystem rpSystem = _dbClient.queryObject(ProtectionSystem.class, volume.getProtectionController());
    // Get only the RP volumes from the descriptors.
    List<VolumeDescriptor> volumeDescriptorsTypeFilter = VolumeDescriptor.filterByType(volumeDescriptors, new VolumeDescriptor.Type[] { VolumeDescriptor.Type.RP_SOURCE, VolumeDescriptor.Type.RP_EXISTING_SOURCE, VolumeDescriptor.Type.RP_VPLEX_VIRT_SOURCE }, new VolumeDescriptor.Type[] {});
    // If there are no RP volumes, just return
    if (volumeDescriptorsTypeFilter.isEmpty()) {
        return null;
    }
    for (VolumeDescriptor descriptor : volumeDescriptorsTypeFilter) {
        URI volURI = descriptor.getVolumeURI();
        ProtectionSystem rp = _dbClient.queryObject(ProtectionSystem.class, volume.getProtectionController());
        Map<String, RecreateReplicationSetRequestParams> rsetParams = new HashMap<String, RecreateReplicationSetRequestParams>();
        RecreateReplicationSetRequestParams rsetParam = getReplicationSettings(rpSystem, volURI);
        rsetParams.put(RPHelper.getRPWWn(volURI, _dbClient), rsetParam);
        String stepId = workflow.createStepId();
        Workflow.Method deleteRsetExecuteMethod = new Workflow.Method(METHOD_DELETE_RSET_STEP, rpSystem.getId(), Arrays.asList(volURI));
        Workflow.Method deleteRsetRollbackeMethod = new Workflow.Method(METHOD_DELETE_RSET_ROLLBACK_STEP, rpSystem.getId(), Arrays.asList(volURI), rsetParams);
        workflow.createStep(STEP_PRE_VOLUME_EXPAND, "Pre volume expand, delete replication set subtask for RP: " + volURI.toString(), null, rpSystem.getId(), rp.getSystemType(), this.getClass(), deleteRsetExecuteMethod, deleteRsetRollbackeMethod, stepId);
        _log.info("addPreVolumeExpandSteps Replication Set in workflow");
    }
    return STEP_PRE_VOLUME_EXPAND;
}
Also used : VolumeDescriptor(com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor) Volume(com.emc.storageos.db.client.model.Volume) HashMap(java.util.HashMap) Workflow(com.emc.storageos.workflow.Workflow) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) RecreateReplicationSetRequestParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams)

Example 2 with RecreateReplicationSetRequestParams

use of com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams in project coprhd-controller by CoprHD.

the class RPDeviceController method addPreRestoreVolumeSteps.

/**
 * Adds the necessary RecoverPoint controller steps that need to be executed prior
 * to restoring a volume from snapshot. The pre-restore step is required if we
 * are restoring a native array snapshot of the following parent volumes:
 * <ul>
 * <li>A BlockSnapshot parent volume that is a regular RP source/target residing on a VMAX.</li>
 * <li>A BlockSnapshot parent volume that is a backing volume to a VPlex distributed volume.</li>
 * </ul>
 *
 * @param workflow
 *            the Workflow being constructed
 * @param storageSystemURI
 *            the URI of storage controller
 * @param volumeURI
 *            the URI of volume to be restored
 * @param snapshotURI
 *            the URI of snapshot used for restoration
 * @param taskId
 *            the top level operation's taskId
 * @return A waitFor key that can be used by subsequent controllers to wait on
 */
public String addPreRestoreVolumeSteps(Workflow workflow, URI storageSystemURI, URI volumeURI, URI snapshotURI, String taskId) {
    String waitFor = null;
    BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
    // Only consider native snapshots
    if (snapshot != null && NullColumnValueGetter.isNotNullValue(snapshot.getTechnologyType()) && snapshot.getTechnologyType().equals(TechnologyType.NATIVE.toString())) {
        Volume volume = _dbClient.queryObject(Volume.class, volumeURI);
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemURI);
        if (volume != null && storageSystem != null) {
            boolean vplexDistBackingVolume = false;
            URI cgId = volume.getConsistencyGroup();
            Volume associatedVPlexVolume = Volume.fetchVplexVolume(_dbClient, volume);
            if (associatedVPlexVolume != null && associatedVPlexVolume.getAssociatedVolumes() != null && associatedVPlexVolume.getAssociatedVolumes().size() == 2) {
                vplexDistBackingVolume = true;
            }
            if (vplexDistBackingVolume) {
                volume = associatedVPlexVolume;
            }
            // before performing the native block restore.
            if (!NullColumnValueGetter.isNullURI(volume.getProtectionController()) && (vplexDistBackingVolume || (storageSystem != null && NullColumnValueGetter.isNotNullValue(storageSystem.getSystemType()) && storageSystem.getSystemType().equals(SystemType.vmax.toString())))) {
                ProtectionSystem rpSystem = null;
                rpSystem = _dbClient.queryObject(ProtectionSystem.class, volume.getProtectionController());
                if (rpSystem == null) {
                    // Verify non-null storage device returned from the database client.
                    throw DeviceControllerExceptions.recoverpoint.failedConnectingForMonitoring(volume.getProtectionController());
                }
                List<URI> volumeURIs = getVolumesForRestore(snapshot, volume);
                // Validate the replication sets for all volumes to restore. Must ensure the source
                // volume size is not greater than the target volume size
                List<Volume> volumes = _dbClient.queryObject(Volume.class, volumeURIs);
                RPHelper.validateRSetVolumeSizes(_dbClient, volumes);
                Map<String, RecreateReplicationSetRequestParams> rsetParams = new HashMap<String, RecreateReplicationSetRequestParams>();
                // Lock CG
                List<String> locks = new ArrayList<String>();
                String lockName = ControllerLockingUtil.getConsistencyGroupStorageKey(_dbClient, cgId, rpSystem.getId());
                if (null != lockName) {
                    locks.add(lockName);
                    acquireWorkflowLockOrThrow(workflow, locks);
                }
                for (URI volumeId : volumeURIs) {
                    Volume vol = _dbClient.queryObject(Volume.class, volumeId);
                    RecreateReplicationSetRequestParams rsetParam = getReplicationSettings(rpSystem, vol.getId());
                    rsetParams.put(RPHelper.getRPWWn(vol.getId(), _dbClient), rsetParam);
                }
                String stepId = workflow.createStepId();
                Workflow.Method deleteRsetExecuteMethod = new Workflow.Method(METHOD_DELETE_RSET_STEP, rpSystem.getId(), volumeURIs);
                Workflow.Method recreateRSetExecuteMethod = new Workflow.Method(METHOD_RECREATE_RSET_STEP, rpSystem.getId(), volumeURIs, rsetParams);
                waitFor = workflow.createStep(STEP_PRE_VOLUME_RESTORE, "Pre volume restore from snapshot, delete replication set step for RP: " + volumeURI.toString(), null, rpSystem.getId(), rpSystem.getSystemType(), this.getClass(), deleteRsetExecuteMethod, recreateRSetExecuteMethod, stepId);
                _log.info(String.format("Created workflow step to delete replication set for volume %s.", volume.getId().toString()));
            }
        }
    }
    return waitFor;
}
Also used : HashMap(java.util.HashMap) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) ArrayList(java.util.ArrayList) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) RecreateReplicationSetRequestParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams) Volume(com.emc.storageos.db.client.model.Volume) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 3 with RecreateReplicationSetRequestParams

use of com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams in project coprhd-controller by CoprHD.

the class RPDeviceController method addPostVolumeExpandSteps.

/**
 * RP specific workflow steps after volume expansion are added here in this method
 * RP CG replication sets that were removed during pre expand are reconstructed with the new expanded volumes.
 *
 * @param workflow
 * @param waitFor
 * @param volume
 *            descriptors
 * @param taskId
 * @return
 * @throws WorkflowException
 */
public String addPostVolumeExpandSteps(Workflow workflow, String waitFor, List<VolumeDescriptor> volumeDescriptors, String taskId) throws WorkflowException {
    // Get only the RP volumes from the descriptors.
    List<VolumeDescriptor> volumeDescriptorsTypeFilter = VolumeDescriptor.filterByType(volumeDescriptors, new VolumeDescriptor.Type[] { VolumeDescriptor.Type.RP_SOURCE, VolumeDescriptor.Type.RP_EXISTING_SOURCE, VolumeDescriptor.Type.RP_VPLEX_VIRT_SOURCE }, new VolumeDescriptor.Type[] {});
    // If there are no RP volumes, just return
    if (volumeDescriptorsTypeFilter.isEmpty()) {
        return waitFor;
    }
    for (VolumeDescriptor descriptor : volumeDescriptorsTypeFilter) {
        Volume volume = _dbClient.queryObject(Volume.class, descriptor.getVolumeURI());
        ProtectionSystem rpSystem = _dbClient.queryObject(ProtectionSystem.class, volume.getProtectionController());
        Map<String, RecreateReplicationSetRequestParams> rsetParams = new HashMap<String, RecreateReplicationSetRequestParams>();
        RecreateReplicationSetRequestParams rsetParam = getReplicationSettings(rpSystem, volume.getId());
        rsetParams.put(RPHelper.getRPWWn(volume.getId(), _dbClient), rsetParam);
        String stepId = workflow.createStepId();
        Workflow.Method recreateRSetExecuteMethod = new Workflow.Method(METHOD_RECREATE_RSET_STEP, rpSystem.getId(), Arrays.asList(volume.getId()), rsetParams);
        workflow.createStep(STEP_POST_VOLUME_EXPAND, "Post volume Expand, Recreate replication set subtask for RP: " + volume.toString(), waitFor, rpSystem.getId(), rpSystem.getSystemType(), this.getClass(), recreateRSetExecuteMethod, null, stepId);
        _log.info("Recreate Replication Set in workflow");
    }
    return STEP_POST_VOLUME_EXPAND;
}
Also used : VolumeDescriptor(com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor) Volume(com.emc.storageos.db.client.model.Volume) HashMap(java.util.HashMap) Workflow(com.emc.storageos.workflow.Workflow) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) RecreateReplicationSetRequestParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams)

Example 4 with RecreateReplicationSetRequestParams

use of com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams in project coprhd-controller by CoprHD.

the class RPDeviceController method addPostRestoreFromFullcopySteps.

/**
 * Adds the necessary RecoverPoint controller steps that need to be executed after
 * restoring a volume from full copy. The post-restore step is required if we
 * are restoring a VPLEX full copy, whoes source volume is a distributed VPLEX volume
 * or a VMAX volume
 *
 * @param workflow
 *            the Workflow being constructed
 * @param waitFor
 *            the step that the newly created steps will wait for.
 * @param storageSystemURI
 *            the URI of storage controller
 * @param fullCopies
 *            the URI of full copies to restore
 * @param taskId
 *            the top level operation's taskId
 * @return A waitFor key that can be used by subsequent controllers to wait on
 */
public String addPostRestoreFromFullcopySteps(Workflow workflow, String waitFor, URI storageSystemURI, List<URI> fullCopies, String taskId) {
    if (fullCopies != null && !fullCopies.isEmpty()) {
        List<Volume> sourceVolumes = checkIfDistributedVplexOrVmaxFullCopies(fullCopies);
        if (!sourceVolumes.isEmpty()) {
            Map<String, RecreateReplicationSetRequestParams> rsetParams = new HashMap<String, RecreateReplicationSetRequestParams>();
            List<URI> volumeURIs = new ArrayList<URI>();
            URI rpSystemId = sourceVolumes.get(0).getProtectionController();
            ProtectionSystem rpSystem = _dbClient.queryObject(ProtectionSystem.class, rpSystemId);
            for (Volume vol : sourceVolumes) {
                RecreateReplicationSetRequestParams rsetParam = getReplicationSettings(rpSystem, vol.getId());
                rsetParams.put(RPHelper.getRPWWn(vol.getId(), _dbClient), rsetParam);
                volumeURIs.add(vol.getId());
            }
            String stepId = workflow.createStepId();
            Workflow.Method recreateRSetExecuteMethod = new Workflow.Method(METHOD_RECREATE_RSET_STEP, rpSystemId, volumeURIs, rsetParams);
            waitFor = workflow.createStep(STEP_PRE_VOLUME_RESTORE, "Post volume restore from full copy, add replication set step for RP", waitFor, rpSystemId, rpSystem.getSystemType(), this.getClass(), recreateRSetExecuteMethod, rollbackMethodNullMethod(), stepId);
            _log.info("Created workflow step to recreate replication set for volumes");
        }
    }
    return waitFor;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Workflow(com.emc.storageos.workflow.Workflow) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) RecreateReplicationSetRequestParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams) Volume(com.emc.storageos.db.client.model.Volume)

Example 5 with RecreateReplicationSetRequestParams

use of com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams in project coprhd-controller by CoprHD.

the class RecoverPointClient method recreateReplicationSets.

/**
 * Perform Step 2 of expanding a volume, Recreate a replication set that was previously removed.
 *
 * @param volume volume base of replication set
 * @param rsetSettings replication set information used to create replication set
 * @throws RecoverPointException
 */
public void recreateReplicationSets(Map<String, RecreateReplicationSetRequestParams> rsetParams) throws RecoverPointException {
    if (rsetParams != null && !rsetParams.isEmpty()) {
        // Used to capture the volume WWNs associated with each replication set to recreate.
        List<String> volumeWWNs = new ArrayList<String>();
        try {
            // Get the CG ID from the first element in the list. All elements will share
            // the same CG ID.
            RecreateReplicationSetRequestParams param = rsetParams.values().iterator().next();
            ConsistencyGroupUID cgID = param.getConsistencyGroupUID();
            // Rescan the SAN
            functionalAPI.rescanSANVolumesInAllClusters(true);
            ConsistencyGroupSettingsChangesParam cgSettingsParam = new ConsistencyGroupSettingsChangesParam();
            ActivationSettingsChangesParams cgActivationSettings = new ActivationSettingsChangesParams();
            cgActivationSettings.setEnable(true);
            cgActivationSettings.setStartTransfer(true);
            cgSettingsParam.setActivationParams(cgActivationSettings);
            cgSettingsParam.setGroupUID(cgID);
            for (Entry<String, RecreateReplicationSetRequestParams> entry : rsetParams.entrySet()) {
                RecreateReplicationSetRequestParams rsetParam = entry.getValue();
                // Create replication set
                logger.info("Adding replication set: " + rsetParam.getName());
                ReplicationSetSettingsChangesParam repSetSettings = new ReplicationSetSettingsChangesParam();
                repSetSettings.setName(rsetParam.getName());
                repSetSettings.setShouldAttachAsClean(false);
                for (CreateRSetVolumeParams volume : rsetParam.getVolumes()) {
                    UserVolumeSettingsChangesParam volSettings = new UserVolumeSettingsChangesParam();
                    volSettings.setNewVolumeID(volume.getDeviceUID());
                    volSettings.setCopyUID(volume.getConsistencyGroupCopyUID());
                    volSettings.getCopyUID().setGroupUID(cgID);
                    repSetSettings.getVolumesChanges().add(volSettings);
                }
                cgSettingsParam.getReplicationSetsChanges().add(repSetSettings);
                volumeWWNs.add(entry.getKey());
            }
            // Add the replication set
            functionalAPI.setConsistencyGroupSettings(cgSettingsParam);
            logger.info("Checking for volumes unattached to splitters");
            RecoverPointUtils.verifyCGVolumesAttachedToSplitter(functionalAPI, cgID);
            RecoverPointImageManagementUtils rpiMgmt = new RecoverPointImageManagementUtils();
            logger.info("Waiting for links to become active for CG ");
            // Wait for the active state or paused state. If a copy is in direct access mode, the link
            // will be paused but it's still a valid state.
            rpiMgmt.waitForCGLinkState(functionalAPI, cgID, RecoverPointImageManagementUtils.getPipeActiveState(functionalAPI, cgID), PipeState.PAUSED);
        } catch (FunctionalAPIActionFailedException_Exception e) {
            throw RecoverPointException.exceptions.failedToRecreateReplicationSet(volumeWWNs.toString(), e);
        } catch (FunctionalAPIInternalError_Exception e) {
            throw RecoverPointException.exceptions.failedToRecreateReplicationSet(volumeWWNs.toString(), e);
        }
    }
}
Also used : ReplicationSetSettingsChangesParam(com.emc.fapiclient.ws.ReplicationSetSettingsChangesParam) ConsistencyGroupSettingsChangesParam(com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) UserVolumeSettingsChangesParam(com.emc.fapiclient.ws.UserVolumeSettingsChangesParam) ArrayList(java.util.ArrayList) RecoverPointImageManagementUtils(com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils) RecreateReplicationSetRequestParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams) CreateRSetVolumeParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams.CreateRSetVolumeParams) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ActivationSettingsChangesParams(com.emc.fapiclient.ws.ActivationSettingsChangesParams)

Aggregations

RecreateReplicationSetRequestParams (com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams)9 Volume (com.emc.storageos.db.client.model.Volume)7 HashMap (java.util.HashMap)7 NamedURI (com.emc.storageos.db.client.model.NamedURI)6 ProtectionSystem (com.emc.storageos.db.client.model.ProtectionSystem)6 Workflow (com.emc.storageos.workflow.Workflow)6 URI (java.net.URI)6 ArrayList (java.util.ArrayList)4 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)2 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)2 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)2 VolumeDescriptor (com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor)2 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 CreateRSetVolumeParams (com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams.CreateRSetVolumeParams)2 ActivationSettingsChangesParams (com.emc.fapiclient.ws.ActivationSettingsChangesParams)1 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)1 ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)1 ConsistencyGroupSettingsChangesParam (com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam)1 ConsistencyGroupState (com.emc.fapiclient.ws.ConsistencyGroupState)1