Search in sources :

Example 1 with CreateRSetVolumeParams

use of com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams.CreateRSetVolumeParams 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)

Example 2 with CreateRSetVolumeParams

use of com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams.CreateRSetVolumeParams 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)

Aggregations

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 RecreateReplicationSetRequestParams (com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams)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 ReplicationSetSettings (com.emc.fapiclient.ws.ReplicationSetSettings)1 ReplicationSetSettingsChangesParam (com.emc.fapiclient.ws.ReplicationSetSettingsChangesParam)1 ReplicationSetUID (com.emc.fapiclient.ws.ReplicationSetUID)1 UserVolumeSettings (com.emc.fapiclient.ws.UserVolumeSettings)1 UserVolumeSettingsChangesParam (com.emc.fapiclient.ws.UserVolumeSettingsChangesParam)1 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)1 ArrayList (java.util.ArrayList)1