use of com.emc.storageos.svcs.errorhandling.model.ServiceCoded in project coprhd-controller by CoprHD.
the class Documenter method createEntries.
public static Collection<DocumenterEntry> createEntries() {
final List<Class<?>> list = getMessageBundleClasses();
_log.info("found these classes to document: {}", list);
final Collection<DocumenterEntry> entries = new ArrayList<DocumenterEntry>();
for (final Class<?> interfaze : list) {
final Object proxy = ExceptionMessagesProxy.create(interfaze);
final Method[] methods = interfaze.getDeclaredMethods();
for (final Method method : methods) {
StatusType status;
try {
final Object[] parameters = sampleParameters(method);
final ServiceCoded sce = (ServiceCoded) method.invoke(proxy, parameters);
if (sce instanceof StatusCoded) {
status = ((StatusCoded) sce).getStatus();
} else {
status = sce.isRetryable() ? Status.SERVICE_UNAVAILABLE : Status.INTERNAL_SERVER_ERROR;
}
entries.add(new DocumenterEntry(interfaze, method, status, sce, parameters));
} catch (final Exception e) {
_log.error(String.format("Fail to create document entry for method: %s", method), e);
}
}
}
return entries;
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceCoded in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method resumeSnapshot.
/**
* Routine will call SMI-S ModifyReplicaSynchronization to resume a synchronization instance.
* The operation is a counter-intuitive; it will terminate a RESTORE session between
* target and source. This was the suggestion based on input from SMI-S team.
* See OPT 443785.
*
* @param storage [in] - StorageSystem object representing the array
* @param from [in] - Should be the snapshot object
* @param blockObject [in] - Should be the volume object
* @param syncObject [in] - A CIMObjectPath representing the SMI-S synchronization object tying
* from and blockObject together, along with other related consistency group members
* @param taskCompleter [in] - TaskCompleter used for updating status of operation
* @return true if the resume operation was successfully performed on the synchronization
* @throws WBEMException
*/
private boolean resumeSnapshot(StorageSystem storage, BlockObject from, BlockObject blockObject, CIMObjectPath syncObject, TaskCompleter taskCompleter) throws WBEMException {
boolean wasResumed = false;
SmisBlockResumeSnapshotJob job = new SmisBlockResumeSnapshotJob(null, storage.getId(), new TaskCompleter() {
@Override
protected void complete(DbClient dbClient, Operation.Status status, ServiceCoded coded) throws DeviceControllerException {
}
});
CIMArgument[] result = new CIMArgument[5];
try {
if (storage.checkIfVmax3()) {
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerReplicationSvcPath(storage), SmisConstants.MODIFY_SETTINGS_DEFINE_STATE, _helper.getEMCResumeInputArguments(syncObject), result, job);
} else if (storage.getUsingSmis80()) {
/**
* VMAX2 managed by 8.* SMIS
* We need to pass Operation = 16
*/
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerReplicationSvcPath(storage), SmisConstants.MODIFY_REPLICA_SYNCHRONIZATION, _helper.getResumeSnapshotSynchronizationInputArguments(syncObject), result, job);
} else {
/**
* VMAX2 managed by 4.6.2 SMI provider
* We need to pass Operation = 14
*/
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerReplicationSvcPath(storage), SmisConstants.MODIFY_REPLICA_SYNCHRONIZATION, _helper.getResumeSynchronizationInputArguments(syncObject), result, job);
}
} catch (Exception e) {
/*
* May be ignored if message is about invalid device state, since when
* dealing with multiple GroupSynchronized instances, we attempt to resume
* all of them.
*/
_log.info("Encountered exception which may be ignored: {}", e.getMessage());
}
if (job.isSuccess()) {
_log.info("Synchronization was successfully resumed: {}", syncObject);
wasResumed = true;
} else {
_log.info("Synchronization was not resumed and can be ignored: {}", syncObject);
}
return wasResumed;
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceCoded in project coprhd-controller by CoprHD.
the class VPlexDeviceController method establishVolumeAndFullCopyGroupRelation.
@Override
public void establishVolumeAndFullCopyGroupRelation(URI storage, URI sourceVolume, URI fullCopy, String opId) throws InternalException {
try {
// Generate the Workflow.
Workflow workflow = _workflowService.getNewWorkflow(this, VOLUME_FULLCOPY_GROUP_RELATION_WF, false, opId);
_log.info("Created establish volume and full copy group relation workflow with operation id {}", opId);
// Get the VPLEX and backend full copy volumes.
Volume fullCopyVolume = getDataObject(Volume.class, fullCopy, _dbClient);
Volume nativeFullCopyVolume = VPlexUtil.getVPLEXBackendVolume(fullCopyVolume, true, _dbClient);
URI nativeSourceVolumeURI = nativeFullCopyVolume.getAssociatedSourceVolume();
URI nativeSystemURI = nativeFullCopyVolume.getStorageController();
StorageSystem nativeSystem = getDataObject(StorageSystem.class, nativeSystemURI, _dbClient);
Workflow.Method establishRelationMethod = new Workflow.Method(VOLUME_FULLCOPY_RELATION_METHOD, nativeSystemURI, nativeSourceVolumeURI, nativeFullCopyVolume.getId());
workflow.createStep(VOLUME_FULLCOPY_GROUP_RELATION_STEP, "create group relation between Volume group and Full copy group", null, nativeSystemURI, nativeSystem.getSystemType(), BlockDeviceController.class, establishRelationMethod, rollbackMethodNullMethod(), null);
TaskCompleter completer = new CloneTaskCompleter(fullCopy, opId);
String successMsg = String.format("Establish volume and full copy %s group relation completed successfully", fullCopy);
FullCopyOperationCompleteCallback wfCompleteCB = new FullCopyOperationCompleteCallback();
workflow.executePlan(completer, successMsg, wfCompleteCB, new Object[] { Arrays.asList(fullCopy) }, null, null);
_log.info("Workflow plan executing");
} catch (Exception e) {
String failMsg = String.format("Establish volume and full copy %s group relation failed", fullCopy);
_log.error(failMsg, e);
TaskCompleter completer = new CloneTaskCompleter(fullCopy, opId);
ServiceCoded sc = VPlexApiException.exceptions.establishVolumeFullCopyGroupRelationFailed(fullCopy.toString(), e);
failStep(completer, opId, sc);
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceCoded in project coprhd-controller by CoprHD.
the class VPlexDeviceController method restoreFromFullCopy.
/**
* {@inheritDoc}
*/
@Override
public void restoreFromFullCopy(URI vplexURI, List<URI> fullCopyURIs, String opId) throws InternalException {
TaskCompleter completer = null;
try {
completer = new CloneRestoreCompleter(fullCopyURIs, opId);
// Generate the Workflow.
Workflow workflow = _workflowService.getNewWorkflow(this, RESTORE_VOLUME_WF_NAME, false, opId);
_log.info("Created restore volume 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();
}
}
// We'll need a list of the native full copy URIs.
List<URI> nativeFullCopyURIs = new ArrayList<URI>(nativeFullCopyMap.keySet());
// Get the native system.
StorageSystem nativeSystem = getDataObject(StorageSystem.class, nativeSystemURI, _dbClient);
// 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 fcSourceVolume = getDataObject(Volume.class, vplexFullCopyVolume.getAssociatedSourceVolume(), _dbClient);
Volume arrayVolumeToBeRestored = VPlexUtil.getVPLEXBackendVolume(fcSourceVolume, true, _dbClient);
vplexToArrayVolumesToFlush.put(fcSourceVolume, arrayVolumeToBeRestored);
}
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 restore the backend
// source volumes from the backend full copies. We execute this
// after the invalidate cache steps.
waitFor = createWorkflowStepForRestoreNativeFullCopy(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("Restore 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("Restore full copy volumes %s failed", fullCopyURIs);
_log.error(failMsg, e);
ServiceCoded sc = VPlexApiException.exceptions.restoreFromFullCopyFailed(fullCopyURIs.toString(), e);
failStep(completer, opId, sc);
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceCoded in project coprhd-controller by CoprHD.
the class VPlexDeviceController method forgetVolumes.
/**
* Uses the VPLREX client for the VPLEX storage system with the passed URI to
* tell the VPLERX system to forget the volumes with the passed URIs.
*
* @param vplexSystemURI
* The URI of the VPLEX storage system.
* @param volumeInfo
* The native volume information for the volumes to be forgotten.
* @param stepId
* The id of the workflow step that invoked this method.
*/
public void forgetVolumes(URI vplexSystemURI, List<VolumeInfo> volumeInfo, String stepId) {
String warnMsg = null;
String vplexSystemName = null;
try {
// Workflow step is executing.
WorkflowStepCompleter.stepExecuting(stepId);
// Get the VPLEX client for this VPLEX system.
StorageSystem vplexSystem = _dbClient.queryObject(StorageSystem.class, vplexSystemURI);
vplexSystemName = vplexSystem.getLabel();
VPlexApiClient client = getVPlexAPIClient(_vplexApiFactory, vplexSystem, _dbClient);
// Tell the VPLEX system to forget about these volumes.
client.forgetVolumes(volumeInfo);
} catch (Exception ex) {
StringBuffer forgottenVolumeInfo = new StringBuffer();
for (VolumeInfo vInfo : volumeInfo) {
if (forgottenVolumeInfo.length() != 0) {
forgottenVolumeInfo.append(", ");
}
forgottenVolumeInfo.append(vInfo.getVolumeWWN());
}
ServiceCoded sc = VPlexApiException.exceptions.forgetVolumesFailed(forgottenVolumeInfo.toString(), vplexSystemName, ex.getMessage(), ex);
warnMsg = sc.getMessage();
_log.warn(warnMsg);
}
// This is a cleanup step that we don't want to impact the
// workflow execution if it fails.
WorkflowStepCompleter.stepSucceeded(stepId, warnMsg);
}
Aggregations