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