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;
}
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);
}
}
Aggregations