Search in sources :

Example 6 with RecreateReplicationSetRequestParams

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

the class VPlexDeviceController method getRecreateReplicationSetParams.

/**
 * Gets the replication set parameters.
 *
 * @param rpSystem
 *            A reference to the RP protection system.
 * @param vplexVolumes
 *            A list of the VPLEX distributed volumes.
 * @param vplexVolumeURIs
 *            An OUT parameters containing the URIs of the passed VPLEX volumes.
 *
 * @return
 */
private Map<String, RecreateReplicationSetRequestParams> getRecreateReplicationSetParams(ProtectionSystem rpSystem, List<Volume> vplexVolumes, List<URI> vplexVolumeURIs) {
    Map<String, RecreateReplicationSetRequestParams> params = new HashMap<String, RecreateReplicationSetRequestParams>();
    for (Volume vplexVolume : vplexVolumes) {
        URI vplexVolumeURI = vplexVolume.getId();
        vplexVolumeURIs.add(vplexVolumeURI);
        RecreateReplicationSetRequestParams volumeParam = _rpDeviceController.getReplicationSettings(rpSystem, vplexVolumeURI);
        params.put(RPHelper.getRPWWn(vplexVolumeURI, _dbClient), volumeParam);
    }
    return params;
}
Also used : HashMap(java.util.HashMap) Volume(com.emc.storageos.db.client.model.Volume) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) RecreateReplicationSetRequestParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams)

Example 7 with RecreateReplicationSetRequestParams

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

the class RecoverPointClient method getReplicationSet.

/**
 * Get the replication set information associated with this volume. This is important when assembling a workflow to
 * recreate the replication set for the purpose of expanding volumes.
 *
 * Steps are as follows:
 * This method: Get the state information associated with the replication set
 * Delete method below: Delete the replication set
 * RP Controller: Expand volumes
 * Recreate method below: Perform a rescan_san
 * Recreate method below: Create the replication set
 *
 * @param RecoverPointVolumeProtectionInfo volume - Volume info for the CG to remove the replication set from
 * @return void
 *
 * @throws RecoverPointException
 */
public RecreateReplicationSetRequestParams getReplicationSet(RecoverPointVolumeProtectionInfo volume) throws RecoverPointException {
    ReplicationSetSettings rsetSettings = null;
    try {
        ConsistencyGroupUID cgID = new ConsistencyGroupUID();
        cgID.setId(volume.getRpVolumeGroupID());
        ReplicationSetUID repSetUID = new ReplicationSetUID();
        repSetUID.setId(volume.getRpVolumeRSetID());
        rsetSettings = getReplicationSetSettings(functionalAPI, rsetSettings, cgID, repSetUID);
        if (rsetSettings == null) {
            throw RecoverPointException.exceptions.cannotFindReplicationSet(volume.getRpVolumeWWN());
        }
        RecreateReplicationSetRequestParams response = new RecreateReplicationSetRequestParams();
        response.setCgName(volume.getRpProtectionName());
        response.setName(rsetSettings.getReplicationSetName());
        response.setConsistencyGroupUID(cgID);
        response.setVolumes(new ArrayList<CreateRSetVolumeParams>());
        ConsistencyGroupState state = functionalAPI.getGroupState(cgID);
        ConsistencyGroupSettings cgSettings = functionalAPI.getGroupSettings(cgID);
        // Get the standby production copy (if one exists). In the case of MetroPoint,
        // we must ignore the standby copy device when getting the replication set. Including
        // the standby copy during replication set re-creation will throw an exception
        // because it has the same device ID as the active copy device.
        ConsistencyGroupCopyUID standbyProdCopy = RecoverPointUtils.getStandbyProductionCopy(cgSettings, state);
        for (UserVolumeSettings volumeSettings : rsetSettings.getVolumes()) {
            if (standbyProdCopy != null && RecoverPointUtils.copiesEqual(volumeSettings.getGroupCopyUID(), standbyProdCopy)) {
                // This is the standby production copy so ignore it.
                String standyCopyName = functionalAPI.getGroupCopyName(volumeSettings.getGroupCopyUID());
                logger.info(String.format("Ignoring volume %s at standby copy %s to avoid duplicate device IDs in replication set reconstruction for MetroPoint.", volumeSettings.getVolumeInfo().getVolumeName(), standyCopyName));
                continue;
            }
            CreateRSetVolumeParams volumeParams = new CreateRSetVolumeParams();
            volumeParams.setDeviceUID(volumeSettings.getVolumeInfo().getVolumeID());
            volumeParams.setConsistencyGroupCopyUID(volumeSettings.getGroupCopyUID());
            response.getVolumes().add(volumeParams);
        }
        return response;
    } catch (FunctionalAPIActionFailedException_Exception e) {
        throw RecoverPointException.exceptions.cannotFindReplicationSet(volume.getRpVolumeWWN(), e);
    } catch (FunctionalAPIInternalError_Exception e) {
        throw RecoverPointException.exceptions.cannotFindReplicationSet(volume.getRpVolumeWWN(), e);
    }
}
Also used : UserVolumeSettings(com.emc.fapiclient.ws.UserVolumeSettings) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) ReplicationSetSettings(com.emc.fapiclient.ws.ReplicationSetSettings) ConsistencyGroupState(com.emc.fapiclient.ws.ConsistencyGroupState) RecreateReplicationSetRequestParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID) CreateRSetVolumeParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams.CreateRSetVolumeParams) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ReplicationSetUID(com.emc.fapiclient.ws.ReplicationSetUID) ConsistencyGroupSettings(com.emc.fapiclient.ws.ConsistencyGroupSettings)

Example 8 with RecreateReplicationSetRequestParams

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

the class RPDeviceController method addPreRestoreFromFullcopySteps.

/**
 * Adds the necessary RecoverPoint controller steps that need to be executed prior
 * to restoring a volume from full copy. The pre-restore step is required if we
 * are restoring a VPLEX distributed or VMAX full copy
 *
 * @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 addPreRestoreFromFullcopySteps(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());
            }
            // Lock CG
            List<String> locks = new ArrayList<String>();
            String lockName = ControllerLockingUtil.getConsistencyGroupStorageKey(_dbClient, sourceVolumes.get(0).getConsistencyGroup(), rpSystem.getId());
            if (null != lockName) {
                locks.add(lockName);
                acquireWorkflowLockOrThrow(workflow, locks);
            }
            String stepId = workflow.createStepId();
            Workflow.Method deleteRsetExecuteMethod = new Workflow.Method(METHOD_DELETE_RSET_STEP, rpSystem.getId(), volumeURIs);
            // rollback method for deleteRset. If deleteRest fails, recreate the Rset
            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 full copy, delete replication set step for RP", waitFor, rpSystem.getId(), rpSystem.getSystemType(), this.getClass(), deleteRsetExecuteMethod, recreateRSetExecuteMethod, stepId);
            _log.info("Created workflow step to delete 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 9 with RecreateReplicationSetRequestParams

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

the class RPDeviceController method addPostRestoreVolumeSteps.

/**
 * Adds the necessary RecoverPoint controller steps that need to be executed after
 * restoring a volume from snapshot. The post-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 addPostRestoreVolumeSteps(Workflow workflow, String waitFor, URI storageSystemURI, URI volumeURI, URI snapshotURI, String taskId) {
    BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
    // Only consider native snapshots
    if (snapshot != null && NullColumnValueGetter.isNotNullValue(snapshot.getTechnologyType()) && snapshot.getTechnologyType().equals(TechnologyType.NATIVE.name())) {
        Volume volume = _dbClient.queryObject(Volume.class, volumeURI);
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemURI);
        if (volume != null && storageSystem != null) {
            boolean vplexDistBackingVolume = false;
            Volume associatedVPlexVolume = Volume.fetchVplexVolume(_dbClient, volume);
            if (associatedVPlexVolume != null && associatedVPlexVolume.getAssociatedVolumes() != null && associatedVPlexVolume.getAssociatedVolumes().size() == 2) {
                vplexDistBackingVolume = true;
            }
            if (vplexDistBackingVolume) {
                volume = associatedVPlexVolume;
            }
            // 2 - A backing volume to a VPlex distributed volume
            if (!NullColumnValueGetter.isNullURI(volume.getProtectionController()) && (vplexDistBackingVolume || (storageSystem != null && NullColumnValueGetter.isNotNullValue(storageSystem.getSystemType()) && storageSystem.getSystemType().equals(SystemType.vmax.name())))) {
                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);
                Map<String, RecreateReplicationSetRequestParams> rsetParams = new HashMap<String, RecreateReplicationSetRequestParams>();
                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 recreateRSetExecuteMethod = new Workflow.Method(METHOD_RECREATE_RSET_STEP, rpSystem.getId(), volumeURIs, rsetParams);
                waitFor = workflow.createStep(STEP_POST_VOLUME_RESTORE, "Post volume restore from snapshot, re-create replication set step for RP: " + volume.toString(), waitFor, rpSystem.getId(), rpSystem.getSystemType(), this.getClass(), recreateRSetExecuteMethod, rollbackMethodNullMethod(), stepId);
                _log.info(String.format("Created workflow step to re-create replication set for volume %s.", volume.getId().toString()));
            }
        }
    }
    return waitFor;
}
Also used : HashMap(java.util.HashMap) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) 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) Volume(com.emc.storageos.db.client.model.Volume) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

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