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