use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeDetachCloneCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method detachListClone.
public void detachListClone(URI storage, List<URI> cloneList, String taskId) throws ControllerException {
_log.info("START detachListClone: {}", Joiner.on("\t").join(cloneList));
try {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
TaskCompleter taskCompleter = new VolumeDetachCloneCompleter(cloneList, taskId);
getDevice(storageSystem.getSystemType()).doDetachListReplica(storageSystem, cloneList, taskCompleter);
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(taskId, serviceError);
doFailTask(Volume.class, cloneList, taskId, serviceError);
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeDetachCloneCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method detachFullCopies.
public void detachFullCopies(URI storage, List<URI> fullCopyVolumes, String taskId) throws ControllerException {
_log.info("detach FullCopy: {}", fullCopyVolumes);
try {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
TaskCompleter taskCompleter = new VolumeDetachCloneCompleter(fullCopyVolumes, taskId);
if (checkCloneConsistencyGroup(fullCopyVolumes.get(0), _dbClient, taskCompleter)) {
_log.info("detach group full copy");
getDevice(storageSystem.getSystemType()).doDetachGroupClone(storageSystem, fullCopyVolumes, taskCompleter);
} else {
getDevice(storageSystem.getSystemType()).doDetachClone(storageSystem, fullCopyVolumes.get(0), taskCompleter);
}
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(taskId, serviceError);
doFailTask(Volume.class, fullCopyVolumes, taskId, serviceError);
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeDetachCloneCompleter in project coprhd-controller by CoprHD.
the class SmisBlockDetachCloneJob method updateStatus.
@Override
public void updateStatus(JobContext jobContext) throws Exception {
_log.info("START updateStatus for clone detach");
JobStatus jobStatus = getJobStatus();
super.updateStatus(jobContext);
if (jobStatus == JobStatus.IN_PROGRESS) {
return;
}
DbClient dbClient = jobContext.getDbClient();
VolumeDetachCloneCompleter taskCompleter = (VolumeDetachCloneCompleter) getTaskCompleter();
Volume cloneVolume = dbClient.queryObject(Volume.class, taskCompleter.getId());
Operation.Status op = Operation.Status.pending;
String message = "Detaching volume clone";
if (jobStatus == JobStatus.SUCCESS) {
op = Operation.Status.ready;
message = "Successfully detached volume clone";
} else if (jobStatus == JobStatus.ERROR || jobStatus == JobStatus.FAILED || jobStatus == JobStatus.FATAL_ERROR) {
op = Operation.Status.error;
message = "Failed to detached volume clone";
}
// set to terminal status to stop polling job
if (jobStatus == JobStatus.ERROR) {
setFatalErrorStatus(message);
}
dbClient.updateTaskOpStatus(Volume.class, cloneVolume.getId(), taskCompleter.getOpId(), new Operation(op.name(), message));
WorkflowStepCompleter.updateState(taskCompleter.getOpId(), op, message);
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeDetachCloneCompleter in project coprhd-controller by CoprHD.
the class VPlexDeviceController method detachFullCopy.
/**
* {@inheritDoc}
*/
@Override
public void detachFullCopy(URI vplexURI, List<URI> fullCopyURIs, String opId) throws InternalException {
TaskCompleter completer = null;
try {
completer = new VolumeDetachCloneCompleter(fullCopyURIs, opId);
// Generate the Workflow.
Workflow workflow = _workflowService.getNewWorkflow(this, DETACH_FULL_COPY_WF_NAME, false, opId);
_log.info("Created detach 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 native full copy volumes.
URI nativeSystemURI = null;
Map<URI, Volume> nativeFullCopyMap = new HashMap<URI, Volume>();
for (URI fullCopyURI : fullCopyURIs) {
Volume fullCopyVolume = getDataObject(Volume.class, fullCopyURI, _dbClient);
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());
// Create a workflow step to detach the native
// full copies.
createWorkflowStepForDetachNativeFullCopy(workflow, nativeSystem, nativeFullCopyURIs, null, null);
// Execute the workflow.
_log.info("Executing workflow plan");
String successMsg = String.format("Detach 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("detach full copy volumes %s failed", fullCopyURIs);
_log.error(failMsg, e);
ServiceCoded sc = VPlexApiException.exceptions.detachFullCopyFailed(fullCopyURIs.toString(), e);
failStep(completer, opId, sc);
}
}
Aggregations