Search in sources :

Example 16 with ConsistencyGroupSettings

use of com.emc.fapiclient.ws.ConsistencyGroupSettings in project coprhd-controller by CoprHD.

the class RecoverPointClient method getCGState.

/**
 * Return the state of a consistency group.
 *
 * @param cgUID - CG identifier
 *
 * @return the state of the CG
 *
 * @throws RecoverPointException
 */
private RecoverPointCGState getCGState(ConsistencyGroupUID cgUID) throws RecoverPointException {
    ConsistencyGroupSettings cgSettings = null;
    ConsistencyGroupState cgState = null;
    try {
        cgSettings = functionalAPI.getGroupSettings(cgUID);
        cgState = functionalAPI.getGroupState(cgUID);
    } catch (FunctionalAPIActionFailedException_Exception e) {
        // No longer exists
        return RecoverPointCGState.DELETED;
    } catch (FunctionalAPIInternalError_Exception e) {
        // No longer exists
        return RecoverPointCGState.DELETED;
    }
    if (!cgSettings.isEnabled()) {
        return RecoverPointCGState.STOPPED;
    }
    // First check for disabled copies
    boolean someCopiesEnabled = false;
    boolean someCopiesDisabled = false;
    for (ConsistencyGroupCopyState cgCopyState : cgState.getGroupCopiesStates()) {
        if (cgCopyState.isEnabled()) {
            someCopiesEnabled = true;
        } else {
            someCopiesDisabled = true;
        }
    }
    if (someCopiesDisabled && !someCopiesEnabled) {
        // All copies are disabled
        return RecoverPointCGState.STOPPED;
    }
    // Now check to see if all the copies are paused
    boolean someCopiesPaused = false;
    boolean someCopiesNotPaused = false;
    List<ConsistencyGroupLinkState> cgLinkStateList;
    try {
        cgLinkStateList = functionalAPI.getGroupState(cgUID).getLinksStates();
    } catch (FunctionalAPIActionFailedException_Exception e) {
        // No longer exists
        return RecoverPointCGState.DELETED;
    } catch (FunctionalAPIInternalError_Exception e) {
        // No longer exists
        return RecoverPointCGState.DELETED;
    }
    for (ConsistencyGroupLinkState cgLinkState : cgLinkStateList) {
        // OK, this is our link that we just restored. Check the link state to see if it is active
        if (PipeState.ACTIVE.equals(cgLinkState.getPipeState()) || PipeState.SNAP_IDLE.equals(cgLinkState.getPipeState()) || PipeState.SNAP_SHIPPING.equals(cgLinkState.getPipeState()) || PipeState.STAND_BY.equals(cgLinkState.getPipeState())) {
            someCopiesNotPaused = true;
        } else {
            someCopiesPaused = true;
        }
    }
    if (someCopiesPaused && !someCopiesNotPaused) {
        // All copies are paused
        return RecoverPointCGState.PAUSED;
    }
    if (someCopiesPaused || someCopiesDisabled) {
        return RecoverPointCGState.MIXED;
    }
    return RecoverPointCGState.READY;
}
Also used : ConsistencyGroupLinkState(com.emc.fapiclient.ws.ConsistencyGroupLinkState) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) ConsistencyGroupCopyState(com.emc.fapiclient.ws.ConsistencyGroupCopyState) ConsistencyGroupSettings(com.emc.fapiclient.ws.ConsistencyGroupSettings) ConsistencyGroupState(com.emc.fapiclient.ws.ConsistencyGroupState)

Example 17 with ConsistencyGroupSettings

use of com.emc.fapiclient.ws.ConsistencyGroupSettings 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

ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)17 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)15 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)15 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)9 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)8 ReplicationSetSettings (com.emc.fapiclient.ws.ReplicationSetSettings)8 ConsistencyGroupCopySettings (com.emc.fapiclient.ws.ConsistencyGroupCopySettings)7 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)6 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)6 ConsistencyGroupState (com.emc.fapiclient.ws.ConsistencyGroupState)5 UserVolumeSettings (com.emc.fapiclient.ws.UserVolumeSettings)5 HashMap (java.util.HashMap)5 ArrayList (java.util.ArrayList)4 ClusterUID (com.emc.fapiclient.ws.ClusterUID)3 ConsistencyGroupLinkSettings (com.emc.fapiclient.ws.ConsistencyGroupLinkSettings)3 GlobalCopyUID (com.emc.fapiclient.ws.GlobalCopyUID)3 ReplicationSetUID (com.emc.fapiclient.ws.ReplicationSetUID)3 HashSet (java.util.HashSet)3 ConsistencyGroupCopyState (com.emc.fapiclient.ws.ConsistencyGroupCopyState)2 ConsistencyGroupLinkPolicy (com.emc.fapiclient.ws.ConsistencyGroupLinkPolicy)2