use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class BlockDeviceController method rollbackMirror.
/**
* {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method rollbackMirrorMethod just above
* (except opId).
*/
public void rollbackMirror(URI storage, List<URI> mirrorList, String taskId) {
WorkflowStepCompleter.stepExecuting(taskId);
try {
List<BlockMirror> mirrors = _dbClient.queryObject(BlockMirror.class, mirrorList);
boolean isCG = isCGMirror(mirrorList.get(0), _dbClient);
List<BlockMirror> mirrorsNoRollback = new ArrayList<BlockMirror>();
for (BlockMirror mirror : mirrors) {
// for non CG mirror, filter out mirror with no native Id
if ((isCG && NullColumnValueGetter.isNullValue(mirror.getReplicationGroupInstance()) || (!isCG && isNullOrEmpty(mirror.getNativeId())))) {
mirror.setInactive(true);
mirrorsNoRollback.add(mirror);
}
}
if (!mirrorsNoRollback.isEmpty()) {
_dbClient.updateObject(mirrorsNoRollback);
mirrors.removeAll(mirrorsNoRollback);
}
if (!mirrors.isEmpty()) {
List<URI> mirrorURIsToRollback = new ArrayList<URI>(transform(mirrors, FCTN_MIRROR_TO_URI));
String mirrorNativeIds = Joiner.on(", ").join(transform(mirrors, fctnBlockObjectToNativeID()));
if (mirrorIsPausable(mirrors)) {
_log.info("Attempting to fracture {} for rollback", mirrorNativeIds);
fractureMirror(storage, mirrorURIsToRollback, isCG, false, taskId);
}
_log.info("Attempting to detach {} for rollback", mirrorNativeIds);
detachMirror(storage, mirrorURIsToRollback, isCG, false, taskId);
_log.info("Attempting to delete {} for rollback", mirrorNativeIds);
deleteMirror(storage, mirrorURIsToRollback, isCG, taskId);
}
WorkflowStepCompleter.stepSucceded(taskId);
} catch (InternalException ie) {
_log.error(String.format("rollbackMirror Failed - Array:%s, Mirror:%s", storage, Joiner.on("\t").join(mirrorList)));
doFailTask(Volume.class, mirrorList, taskId, ie);
WorkflowStepCompleter.stepFailed(taskId, ie);
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(taskId, serviceError);
doFailTask(Volume.class, mirrorList, taskId, serviceError);
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class BlockDeviceController method rollbackFullCopyVolume.
public void rollbackFullCopyVolume(URI storage, List<URI> fullCopy, String taskId) {
WorkflowStepCompleter.stepExecuting(taskId);
List<Volume> volumes = _dbClient.queryObject(Volume.class, fullCopy);
try {
if (!isNullOrEmpty(volumes.get(0).getNativeId()) && !volumes.get(0).getInactive()) {
_log.info("Attempting to detach for rollback");
detachFullCopies(storage, fullCopy, taskId);
_log.info("Attempting to delete for rollback");
deleteVolumes(storage, fullCopy, taskId);
} else {
for (Volume volume : volumes) {
volume.setInactive(true);
_dbClient.updateObject(volume);
}
WorkflowStepCompleter.stepSucceded(taskId);
}
} catch (InternalException ie) {
_log.error(String.format("rollbackFullCopyVolume Failed - Array:%s, Volume:%s", storage, fullCopy));
doFailTask(Volume.class, fullCopy, taskId, ie);
WorkflowStepCompleter.stepFailed(taskId, ie);
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(taskId, serviceError);
doFailTask(Volume.class, fullCopy, taskId, serviceError);
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class BlockDeviceController method deleteReplicationGroup.
/**
* Delete array clone replication group
*
* @param storage
* storage system
* @param consistencyGroup
* consistency group URI
* @param groupName
* clone group name
* @param keepRGName
* @param markInactive
* @param sourceGroupName
* source group name
* @return the created workflow Method
*/
public void deleteReplicationGroup(URI storage, URI consistencyGroup, String groupName, Boolean keepRGName, Boolean markInactive, String sourceGroupName, String opId) throws ControllerException {
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
completer = new BlockConsistencyGroupDeleteCompleter(consistencyGroup, storage, groupName, keepRGName, markInactive, opId);
getDevice(storageObj.getSystemType()).doDeleteConsistencyGroup(storageObj, consistencyGroup, groupName, keepRGName, markInactive, sourceGroupName, completer);
} catch (Exception e) {
if (completer != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
}
throw DeviceControllerException.exceptions.deleteConsistencyGroupFailed(e);
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class BlockDeviceController method createConsistencyGroup.
@Override
public void createConsistencyGroup(URI storage, URI consistencyGroup, String opId) throws ControllerException {
TaskCompleter completer = new BlockConsistencyGroupCreateCompleter(consistencyGroup, opId);
try {
WorkflowStepCompleter.stepExecuting(opId);
// Lock the CG for the step duration.
List<String> lockKeys = new ArrayList<String>();
lockKeys.add(ControllerLockingUtil.getConsistencyGroupStorageKey(_dbClient, consistencyGroup, storage));
_workflowService.acquireWorkflowStepLocks(opId, lockKeys, LockTimeoutValue.get(LockType.ARRAY_CG));
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
// Check if already created, if not create, if so just complete.
BlockConsistencyGroup cg = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroup);
String groupName = ControllerUtils.generateReplicationGroupName(storageObj, cg, null, _dbClient);
if (!cg.created(storage, groupName)) {
getDevice(storageObj.getSystemType()).doCreateConsistencyGroup(storageObj, consistencyGroup, groupName, completer);
} else {
_log.info(String.format("Consistency group %s (%s) already created", cg.getLabel(), cg.getId()));
completer.ready(_dbClient);
}
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
throw DeviceControllerException.exceptions.createConsistencyGroupFailed(e);
}
}
use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.
the class BlockDeviceController method createMetaVolume.
/**
* {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method createMetaVolumeMethod just above
* (except opId).
*/
@Override
public void createMetaVolume(URI systemURI, URI poolURI, URI volumeURI, VirtualPoolCapabilityValuesWrapper capabilities, String opId) throws ControllerException {
try {
StringBuilder logMsgBuilder = new StringBuilder(String.format("createMetaVolume start - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
_log.info(logMsgBuilder.toString());
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, systemURI);
Volume volume = _dbClient.queryObject(Volume.class, volumeURI);
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, poolURI);
VirtualPool vpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
MetaVolumeRecommendation recommendation = MetaVolumeUtils.getCreateRecommendation(storageSystem, storagePool, volume.getCapacity(), volume.getThinlyProvisioned(), vpool.getFastExpansion(), capabilities);
MetaVolumeUtils.prepareMetaVolume(volume, recommendation.getMetaMemberSize(), recommendation.getMetaMemberCount(), recommendation.getMetaVolumeType().toString(), _dbClient);
VolumeCreateCompleter completer = new VolumeCreateCompleter(volumeURI, opId);
WorkflowStepCompleter.stepExecuting(completer.getOpId());
getDevice(storageSystem.getSystemType()).doCreateMetaVolume(storageSystem, storagePool, volume, capabilities, recommendation, completer);
logMsgBuilder = new StringBuilder(String.format("createMetaVolume end - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
_log.info(logMsgBuilder.toString());
} catch (InternalException e) {
_log.error(String.format("createMetaVolume Failed - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
doFailTask(Volume.class, volumeURI, opId, e);
WorkflowStepCompleter.stepFailed(opId, e);
} catch (Exception e) {
_log.error(String.format("createMetaVolume Failed - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
doFailTask(Volume.class, volumeURI, opId, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
}
}
Aggregations