use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneResyncCompleter in project coprhd-controller by CoprHD.
the class VPlexDeviceController method resyncFullCopy.
/**
* {@inheritDoc}
*/
@Override
public void resyncFullCopy(URI vplexURI, List<URI> fullCopyURIs, String opId) throws InternalException {
TaskCompleter completer = null;
try {
completer = new CloneResyncCompleter(fullCopyURIs, opId);
// Generate the Workflow.
Workflow workflow = _workflowService.getNewWorkflow(this, RESYNC_FULL_COPY_WF_NAME, false, opId);
_log.info("Created resync full copy workflow with operation id {}", opId);
// add CG to taskCompleter
Volume firstFullCopy = getDataObject(Volume.class, fullCopyURIs.get(0), _dbClient);
BlockObject firstSource = BlockObject.fetch(_dbClient, firstFullCopy.getAssociatedSourceVolume());
if (!NullColumnValueGetter.isNullURI(firstSource.getConsistencyGroup())) {
completer.addConsistencyGroupId(firstSource.getConsistencyGroup());
}
// Get the VPLEX and backend full copy volumes.
URI nativeSystemURI = null;
Map<URI, Volume> vplexFullCopyMap = new HashMap<URI, Volume>();
Map<URI, Volume> nativeFullCopyMap = new HashMap<URI, Volume>();
for (URI fullCopyURI : fullCopyURIs) {
Volume fullCopyVolume = getDataObject(Volume.class, fullCopyURI, _dbClient);
vplexFullCopyMap.put(fullCopyURI, fullCopyVolume);
Volume nativeFullCopyVolume = VPlexUtil.getVPLEXBackendVolume(fullCopyVolume, true, _dbClient);
nativeFullCopyMap.put(nativeFullCopyVolume.getId(), nativeFullCopyVolume);
if (nativeSystemURI == null) {
nativeSystemURI = nativeFullCopyVolume.getStorageController();
}
}
// Get the native system.
StorageSystem nativeSystem = getDataObject(StorageSystem.class, nativeSystemURI, _dbClient);
// We'll need a list of the native full copy URIs.
List<URI> nativeFullCopyURIs = new ArrayList<URI>(nativeFullCopyMap.keySet());
// Maps Vplex volume that needs to be flushed to underlying array volume
Map<Volume, Volume> vplexToArrayVolumesToFlush = new HashMap<Volume, Volume>();
for (Volume vplexFullCopyVolume : vplexFullCopyMap.values()) {
Volume arrayVolumeToBeResynced = VPlexUtil.getVPLEXBackendVolume(vplexFullCopyVolume, true, _dbClient);
vplexToArrayVolumesToFlush.put(vplexFullCopyVolume, arrayVolumeToBeResynced);
}
Map<URI, String> vplexVolumeIdToDetachStep = new HashMap<URI, String>();
// Generate pre restore steps
String waitFor = addPreRestoreResyncSteps(workflow, vplexToArrayVolumesToFlush, vplexVolumeIdToDetachStep, null);
// Now create a workflow step to natively resynchronize the
// backend full copy volumes. We execute this after the
// invalidate cache steps.
createWorkflowStepForResyncNativeFullCopy(workflow, nativeSystem, nativeFullCopyURIs, waitFor, rollbackMethodNullMethod());
// Generate post restore steps
waitFor = addPostRestoreResyncSteps(workflow, vplexToArrayVolumesToFlush, vplexVolumeIdToDetachStep, waitFor);
// Execute the workflow.
_log.info("Executing workflow plan");
String successMsg = String.format("Resynchronize full copy volumes %s completed successfully", fullCopyURIs);
FullCopyOperationCompleteCallback wfCompleteCB = new FullCopyOperationCompleteCallback();
workflow.executePlan(completer, successMsg, wfCompleteCB, new Object[] { fullCopyURIs }, null, null);
_log.info("Workflow plan executing");
} catch (Exception e) {
String failMsg = String.format("Resynchronize full copy volumes %s failed", fullCopyURIs);
_log.error(failMsg, e);
ServiceCoded sc = VPlexApiException.exceptions.resyncFullCopyFailed(fullCopyURIs.toString(), e);
failStep(completer, opId, sc);
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneResyncCompleter in project coprhd-controller by CoprHD.
the class SmisCloneResyncJob method updateStatus.
@Override
public void updateStatus(JobContext jobContext) throws Exception {
log.info("START updateStatus for resync clone");
CloseableIterator<CIMObjectPath> iterator = null;
DbClient dbClient = jobContext.getDbClient();
JobStatus jobStatus = getJobStatus();
try {
if (jobStatus == JobStatus.SUCCESS) {
CloneResyncCompleter completer = (CloneResyncCompleter) getTaskCompleter();
List<Volume> cloneVolumes = dbClient.queryObject(Volume.class, completer.getIds());
log.info("Clone resync success");
for (Volume clone : cloneVolumes) {
clone.setReplicaState(ReplicationState.RESYNCED.name());
}
dbClient.persistObject(cloneVolumes);
}
} catch (Exception e) {
String errorMsg = String.format("Encountered an internal error during updating resync clone job status " + "processing: %s", e.getMessage());
setPostProcessingErrorStatus(errorMsg);
log.error("Failed to update status for " + getClass().getSimpleName(), e);
} finally {
if (iterator != null) {
iterator.close();
}
super.updateStatus(jobContext);
log.info("FINISH updateStatus for resync clone");
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneResyncCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method resyncFullCopyStep.
public boolean resyncFullCopyStep(URI storage, List<URI> clone, Boolean updateOpStatus, boolean isCG, String opId) throws ControllerException {
_log.info("Start resync full copy");
CloneResyncCompleter taskCompleter = new CloneResyncCompleter(clone, opId);
try {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
if (checkCloneConsistencyGroup(clone.get(0), _dbClient, taskCompleter)) {
_log.info("resync group full copy");
getDevice(storageSystem.getSystemType()).doResyncGroupClone(storageSystem, clone, taskCompleter);
} else {
getDevice(storageSystem.getSystemType()).doResyncClone(storageSystem, clone.get(0), taskCompleter);
}
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
doFailTask(Volume.class, clone, opId, serviceError);
return false;
}
return true;
}
Aggregations