use of com.emc.storageos.svcs.errorhandling.resources.InternalException in project coprhd-controller by CoprHD.
the class BlockDeviceController method createMetaVolumes.
/**
* {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method createMetaVolumesMethod just above
* (except opId).
*/
@Override
public void createMetaVolumes(URI systemURI, URI poolURI, List<URI> volumeURIs, VirtualPoolCapabilityValuesWrapper capabilities, String opId) throws ControllerException {
boolean opCreateFailed = false;
List<Volume> volumes = new ArrayList<Volume>();
try {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, systemURI);
List<VolumeTaskCompleter> volumeCompleters = new ArrayList<VolumeTaskCompleter>();
Iterator<URI> volumeURIsIter = volumeURIs.iterator();
StringBuilder logMsgBuilder = new StringBuilder(String.format("createMetaVolumes start - Array:%s Pool:%s", systemURI.toString(), poolURI.toString()));
while (volumeURIsIter.hasNext()) {
URI volumeURI = volumeURIsIter.next();
logMsgBuilder.append(String.format("%nVolume:%s", volumeURI.toString()));
Volume volume = _dbClient.queryObject(Volume.class, volumeURI);
volumes.add(volume);
VolumeCreateCompleter volumeCompleter = new VolumeCreateCompleter(volumeURI, opId);
volumeCompleters.add(volumeCompleter);
}
_log.info(logMsgBuilder.toString());
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, poolURI);
MultiVolumeTaskCompleter completer = new MultiVolumeTaskCompleter(volumeURIs, volumeCompleters, opId);
Volume volume = volumes.get(0);
VirtualPool vpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
// All volumes are in the same storage pool with the same capacity. Get recommendation for the first volume.
MetaVolumeRecommendation recommendation = MetaVolumeUtils.getCreateRecommendation(storageSystem, storagePool, volume.getCapacity(), volume.getThinlyProvisioned(), vpool.getFastExpansion(), capabilities);
for (Volume metaVolume : volumes) {
MetaVolumeUtils.prepareMetaVolume(metaVolume, recommendation.getMetaMemberSize(), recommendation.getMetaMemberCount(), recommendation.getMetaVolumeType().toString(), _dbClient);
}
WorkflowStepCompleter.stepExecuting(completer.getOpId());
getDevice(storageSystem.getSystemType()).doCreateMetaVolumes(storageSystem, storagePool, volumes, capabilities, recommendation, completer);
logMsgBuilder = new StringBuilder(String.format("createMetaVolumes end - Array:%s Pool:%s", systemURI.toString(), poolURI.toString()));
volumeURIsIter = volumeURIs.iterator();
while (volumeURIsIter.hasNext()) {
logMsgBuilder.append(String.format("%nVolume:%s", volumeURIsIter.next().toString()));
}
_log.info(logMsgBuilder.toString());
} catch (InternalException e) {
_log.error(String.format("createMetaVolumes Failed - Array: %s Pool:%s Volume:%s", systemURI.toString(), poolURI.toString(), Joiner.on("\t").join(volumeURIs)));
doFailTask(Volume.class, volumeURIs, opId, e);
WorkflowStepCompleter.stepFailed(opId, e);
opCreateFailed = true;
} catch (Exception e) {
_log.error(String.format("createMetaVolumes Failed - Array: %s Pool:%s Volume:%s", systemURI.toString(), poolURI.toString(), Joiner.on("\t").join(volumeURIs)));
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
doFailTask(Volume.class, volumeURIs, opId, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
opCreateFailed = true;
}
if (opCreateFailed) {
for (Volume volume : volumes) {
volume.setInactive(true);
_dbClient.updateObject(volume);
}
}
}
use of com.emc.storageos.svcs.errorhandling.resources.InternalException in project coprhd-controller by CoprHD.
the class BlockDeviceController method rollbackListMirror.
public void rollbackListMirror(URI storage, List<URI> mirrorList, String taskId) {
WorkflowStepCompleter.stepExecuting(taskId);
try {
List<BlockMirror> mirrorsNoRollback = new ArrayList<BlockMirror>();
List<BlockMirror> mirrorsToRollback = new ArrayList<BlockMirror>();
Iterator<BlockMirror> mirrorIterator = _dbClient.queryIterativeObjects(BlockMirror.class, mirrorList);
while (mirrorIterator.hasNext()) {
BlockMirror mirror = mirrorIterator.next();
if (mirror != null && !mirror.getInactive()) {
if (isNullOrEmpty(mirror.getNativeId())) {
mirror.setInactive(true);
mirrorsNoRollback.add(mirror);
} else {
mirrorsToRollback.add(mirror);
}
}
}
if (!mirrorsNoRollback.isEmpty()) {
_dbClient.updateObject(mirrorsNoRollback);
}
if (!mirrorsToRollback.isEmpty()) {
List<URI> mirrorURIsToRollback = new ArrayList<URI>(transform(mirrorsToRollback, FCTN_MIRROR_TO_URI));
String mirrorNativeIds = Joiner.on(", ").join(transform(mirrorsToRollback, fctnBlockObjectToNativeID()));
if (mirrorIsPausable(mirrorsToRollback)) {
_log.info("Attempting to fracture {} for rollback", mirrorNativeIds);
fractureMirror(storage, mirrorURIsToRollback, false, false, generateStepIdForDependentCallDuringRollback());
}
_log.info("Attempting to detach {} for rollback", mirrorNativeIds);
detachMirror(storage, mirrorURIsToRollback, false, false, generateStepIdForDependentCallDuringRollback());
_log.info("Attempting to delete {} for rollback", mirrorNativeIds);
deleteMirror(storage, mirrorURIsToRollback, false, generateStepIdForDependentCallDuringRollback());
}
WorkflowStepCompleter.stepSucceded(taskId);
} catch (InternalException ie) {
_log.error(String.format("rollbackListMirror failed - Array:%s, Mirror:%s", storage, Joiner.on("\t").join(mirrorList)));
doFailTask(BlockMirror.class, mirrorList, taskId, ie);
WorkflowStepCompleter.stepFailed(taskId, ie);
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(taskId, serviceError);
doFailTask(BlockMirror.class, mirrorList, taskId, serviceError);
}
}
use of com.emc.storageos.svcs.errorhandling.resources.InternalException in project coprhd-controller by CoprHD.
the class BlockDeviceController method rollbackListClone.
public void rollbackListClone(URI storage, List<URI> cloneList, String taskId) {
WorkflowStepCompleter.stepExecuting(taskId);
_log.info("Rollback list clone");
List<Volume> clones = _dbClient.queryObject(Volume.class, cloneList);
List<Volume> clonesNoRollback = new ArrayList<Volume>();
List<URI> clonesToRollback = new ArrayList<URI>();
try {
for (Volume clone : clones) {
if (isNullOrEmpty(clone.getNativeId())) {
clone.setInactive(true);
clonesNoRollback.add(clone);
} else {
clonesToRollback.add(clone.getId());
}
}
if (!clonesNoRollback.isEmpty()) {
_dbClient.updateObject(clonesNoRollback);
}
if (!clonesToRollback.isEmpty()) {
_log.info("Detach list clone for rollback");
detachListClone(storage, clonesToRollback, generateStepIdForDependentCallDuringRollback());
_log.info("Delete clones for rollback");
deleteVolumes(storage, clonesToRollback, generateStepIdForDependentCallDuringRollback());
}
WorkflowStepCompleter.stepSucceded(taskId);
} catch (InternalException ie) {
_log.error(String.format("rollbackListClone failed - Array: %s, clones: %s", storage, Joiner.on("\t").join(cloneList)));
_log.error(ie.getMessage(), ie);
doFailTask(Volume.class, cloneList, taskId, ie);
WorkflowStepCompleter.stepFailed(taskId, ie);
} catch (Exception e) {
_log.error(e.getMessage(), e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(taskId, serviceError);
doFailTask(Volume.class, cloneList, taskId, serviceError);
}
}
use of com.emc.storageos.svcs.errorhandling.resources.InternalException 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.resources.InternalException in project coprhd-controller by CoprHD.
the class MaskingWorkflowEntryPoints method doExportMaskZoningMapUpdate.
/**
* Zoning map update entry point
*/
public void doExportMaskZoningMapUpdate(URI exportGroupURI, URI storageURI, String token) throws ControllerException {
_log.info("START - doExportMaskZoningMapUpdate");
WorkflowStepCompleter.stepExecuting(token);
try {
ExportGroup eg = _dbClient.queryObject(ExportGroup.class, exportGroupURI);
List<ExportMask> exportMasks = ExportMaskUtils.getExportMasks(_dbClient, eg);
// so fetch the 0th URI
if (!exportMasks.isEmpty()) {
ExportMask mask = exportMasks.get(0);
_blockScheduler.updateZoningMap(mask, eg.getVirtualArray(), exportGroupURI);
}
WorkflowStepCompleter.stepSucceded(token);
} catch (final InternalException e) {
_log.error("Encountered an exception", e);
WorkflowStepCompleter.stepFailed(token, e);
} catch (final Exception e) {
_log.error("Encountered an exception", e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(token, serviceError);
}
_log.info("END - doExportMaskZoningMapUpdate");
}
Aggregations