use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class AbstractMaskingFirstOrchestrator method exportGroupCreate.
/**
* Create storage level masking components to support the requested
* ExportGroup object. This operation will be flexible enough to take into
* account initiators that are in some already existent in some
* StorageGroup. In such a case, the underlying masking component will be
* "adopted" by the ExportGroup. Further operations against the "adopted"
* mask will only allow for addition and removal of those initiators/volumes
* that were added by a Bourne request. Existing initiators/volumes will be
* maintained.
*
* @param storageURI - URI referencing underlying storage array
* @param exportGroupURI - URI referencing Bourne-level masking, ExportGroup
* @param initiatorURIs - List of Initiator URIs
* @param volumeMap - Map of Volume URIs to requested Integer URI
* @param token - Identifier for operation
* @throws Exception
*/
@Override
public void exportGroupCreate(URI storageURI, URI exportGroupURI, List<URI> initiatorURIs, Map<URI, Integer> volumeMap, String token) throws Exception {
ExportOrchestrationTask taskCompleter = null;
try {
BlockStorageDevice device = getDevice();
ExportGroup exportGroup = _dbClient.queryObject(ExportGroup.class, exportGroupURI);
StorageSystem storage = _dbClient.queryObject(StorageSystem.class, storageURI);
taskCompleter = new ExportOrchestrationTask(exportGroupURI, token);
if (initiatorURIs != null && !initiatorURIs.isEmpty()) {
_log.info("export_create: initiator list non-empty");
createWorkFlowAndSubmitForExportGroupCreate(initiatorURIs, volumeMap, token, taskCompleter, device, exportGroup, storage);
} else {
_log.info("export_create: initiator list is empty");
taskCompleter.ready(_dbClient);
}
} catch (DeviceControllerException dex) {
if (taskCompleter != null) {
taskCompleter.error(_dbClient, DeviceControllerException.errors.vmaxExportGroupCreateError(dex.getMessage()));
}
} catch (Exception ex) {
_log.error("ExportGroup Orchestration failed.", ex);
// TODO add service code here
if (taskCompleter != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailedMsg(ex.getMessage(), ex);
taskCompleter.error(_dbClient, serviceError);
}
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class NetworkSystemDeviceImpl method getBiosCommandResult.
protected BiosCommandResult getBiosCommandResult(Map<String, String> results) {
BiosCommandResult result = null;
if (hasResult(results, ERROR)) {
ServiceError serviceError = NetworkDeviceControllerException.errors.batchOperationFailed(toMessage(results));
result = BiosCommandResult.createErrorResult(serviceError);
} else {
result = BiosCommandResult.createSuccessfulResult();
}
result.setObjectList(Collections.singletonList((Object) results));
return result;
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class BlockOrchestrationDeviceController method changeVirtualArray.
@Override
public void changeVirtualArray(List<VolumeDescriptor> volumeDescriptors, String taskId) throws ControllerException {
// The descriptors that contain descriptor parameters
// specifying the new target varray are the volumes being
// moved to the new virtual array.
List<URI> changeVArrayVolURIList = new ArrayList<URI>();
List<URI> migrationURIs = new ArrayList<URI>();
for (VolumeDescriptor volumeDescriptor : volumeDescriptors) {
Map<String, Object> descrParams = volumeDescriptor.getParameters();
if ((descrParams != null) && (!descrParams.isEmpty())) {
changeVArrayVolURIList.add(volumeDescriptor.getVolumeURI());
}
URI migrationURI = volumeDescriptor.getMigrationId();
if (!NullColumnValueGetter.isNullURI(migrationURI)) {
migrationURIs.add(migrationURI);
}
}
// Create a completer that will update the task status for these
// volumes and associated migrations when the workflow completes.
VolumeVarrayChangeTaskCompleter completer = new VolumeVarrayChangeTaskCompleter(VolumeDescriptor.getVolumeURIs(volumeDescriptors), migrationURIs, taskId);
try {
// Validate the volume identities before proceeding
validator.volumeURIs(changeVArrayVolURIList, true, true, ValCk.ID, ValCk.VPLEX);
// Generate the Workflow.
String waitFor = null;
Workflow workflow = _workflowService.getNewWorkflow(this, CHANGE_VARRAY_WF_NAME, true, taskId);
// First, call the BlockDeviceController to add its steps.
// This will create the migration target volumes.
waitFor = _blockDeviceController.addStepsForCreateVolumes(workflow, waitFor, volumeDescriptors, taskId);
// Then call the VPlexDeviceController to add change virtual array steps.
waitFor = _vplexDeviceController.addStepsForChangeVirtualArray(workflow, waitFor, volumeDescriptors, taskId);
// Finish up and execute the plan.
// The Workflow will handle the TaskCompleter
String successMessage = String.format("Change virtual array suceeded for volumes: %s", changeVArrayVolURIList);
Object[] callbackArgs = new Object[] { changeVArrayVolURIList };
workflow.executePlan(completer, successMessage, new WorkflowCallback(), callbackArgs, null, null);
} catch (Exception ex) {
s_logger.error("Could not change virtual array for volumes: " + changeVArrayVolURIList, ex);
String opName = ResourceOperationTypeEnum.CHANGE_BLOCK_VOLUME_VARRAY.getName();
ServiceError serviceError = DeviceControllerException.errors.changeVirtualArrayFailed(changeVArrayVolURIList.toString(), opName, ex);
completer.error(s_dbClient, _locker, serviceError);
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class BlockOrchestrationDeviceController method deleteVolumes.
/*
* (non-Javadoc)
*
* @see com.emc.storageos.blockorchestrationcontroller.BlockOrchestrationController#deleteVolumes(java.util.List,
* java.lang.String)
*/
@Override
public void deleteVolumes(List<VolumeDescriptor> volumes, String taskId) throws ControllerException {
List<URI> volUris = VolumeDescriptor.getVolumeURIs(volumes);
VolumeWorkflowCompleter completer = new VolumeWorkflowCompleter(volUris, taskId);
Workflow workflow = null;
try {
// Validate the volume identities before proceeding
validator.volumeURIs(volUris, true, true, ValCk.ID, ValCk.VPLEX);
// Generate the Workflow.
workflow = _workflowService.getNewWorkflow(this, DELETE_VOLUMES_WF_NAME, true, taskId);
// the wait for key returned by previous call
String waitFor = null;
// Call the RPDeviceController to add its methods if there are RP protections.
waitFor = _rpDeviceController.addStepsForDeleteVolumes(workflow, waitFor, volumes, taskId);
// Call the ReplicaDeviceController to add its methods if volumes are removed from,
// and the CG associated with replication group(s)
waitFor = _replicaDeviceController.addStepsForDeleteVolumes(workflow, waitFor, volumes, taskId);
// Call the VPlexDeviceController to add its methods if there are VPLEX volumes.
waitFor = _vplexDeviceController.addStepsForDeleteVolumes(workflow, waitFor, volumes, taskId);
// Call the RPDeviceController to add its post-delete methods.
waitFor = _rpDeviceController.addStepsForPostDeleteVolumes(workflow, waitFor, volumes, taskId, completer, _blockDeviceController);
// Call the SRDFDeviceController to add its methods if there are SRDF volumes.
waitFor = _srdfDeviceController.addStepsForDeleteVolumes(workflow, waitFor, volumes, taskId);
// Next, call the BlockDeviceController to add its methods.
waitFor = _blockDeviceController.addStepsForDeleteVolumes(workflow, waitFor, volumes, taskId);
// Next, call the BlockDeviceController to add post deletion methods.
waitFor = _blockDeviceController.addStepsForPostDeleteVolumes(workflow, waitFor, volumes, taskId, completer);
// Call the VPlexDeviceController to add its post-delete methods.
waitFor = _vplexDeviceController.addStepsForPostDeleteVolumes(workflow, waitFor, volumes, taskId, completer);
// Finish up and execute the plan.
// The Workflow will handle the TaskCompleter
String successMessage = "Delete volumes successful for: " + volUris.toString();
Object[] callbackArgs = new Object[] { volUris };
workflow.executePlan(completer, successMessage, new WorkflowCallback(), callbackArgs, null, null);
} catch (Exception ex) {
s_logger.error("Could not delete volumes: " + volUris, ex);
releaseWorkflowLocks(workflow);
String opName = ResourceOperationTypeEnum.DELETE_BLOCK_VOLUME.getName();
ServiceError serviceError = DeviceControllerException.errors.deleteVolumesFailed(volUris.toString(), opName, ex);
completer.error(s_dbClient, _locker, serviceError);
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class BlockOrchestrationDeviceController method restoreFromFullCopy.
@Override
public void restoreFromFullCopy(URI storage, List<URI> fullCopyURIs, String taskId) throws InternalException {
CloneRestoreCompleter completer = new CloneRestoreCompleter(fullCopyURIs, taskId);
// add the CG to the completer if this is a CG restore
Iterator<Volume> iter = getDbClient().queryIterativeObjects(Volume.class, fullCopyURIs);
while (iter.hasNext()) {
Volume fc = iter.next();
if (!NullColumnValueGetter.isNullURI(fc.getAssociatedSourceVolume())) {
BlockObject firstSource = BlockObject.fetch(getDbClient(), fc.getAssociatedSourceVolume());
if (firstSource != null) {
if (firstSource instanceof Volume && !NullColumnValueGetter.isNullURI(firstSource.getConsistencyGroup())) {
completer.addConsistencyGroupId(firstSource.getConsistencyGroup());
}
break;
}
}
}
s_logger.info("Creating steps for restore from full copy.");
try {
// Validate the volume identities before proceeding
validator.volumeURIs(fullCopyURIs, true, true, ValCk.ID, ValCk.VPLEX);
// Generate the Workflow.
Workflow workflow = _workflowService.getNewWorkflow(this, RESTORE_FROM_FULLCOPY_WF_NAME, true, taskId);
// the wait for key returned by previous call
String waitFor = null;
// First, call the RP controller to add RP steps for volume restore
waitFor = _rpDeviceController.addPreRestoreFromFullcopySteps(workflow, waitFor, storage, fullCopyURIs, taskId);
// Call the VplexDeviceController to add its steps for restore volume from full copy
waitFor = _vplexDeviceController.addStepsForRestoreFromFullcopy(workflow, waitFor, storage, fullCopyURIs, taskId, completer);
// Call the BlockDeviceController to add its steps for restore volume from full copy
waitFor = _blockDeviceController.addStepsForRestoreFromFullcopy(workflow, waitFor, storage, fullCopyURIs, taskId, completer);
// Call the RPDeviceController to add its steps for post restore volume from full copy
waitFor = _rpDeviceController.addPostRestoreFromFullcopySteps(workflow, waitFor, storage, fullCopyURIs, taskId);
// Finish up and execute the plan.
// The Workflow will handle the TaskCompleter
String successMessage = "Restore from full copy completed successfully";
Object[] callbackArgs = new Object[] { new ArrayList<URI>(fullCopyURIs) };
workflow.executePlan(completer, successMessage, new WorkflowCallback(), callbackArgs, null, null);
} catch (Exception ex) {
s_logger.error("Could not restore volume: ", ex);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
completer.error(s_dbClient, _locker, serviceError);
}
}
Aggregations