use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class BlockDeviceController method connectStorage.
/**
* Creates a connection to monitor events generated by the storage
* identified by the passed URI.
*
* @param storage
* A database client URI that identifies the storage to be
* monitored.
*
* @throws ControllerException
* When errors occur connecting the storage for
* event monitoring.
*/
@Override
public void connectStorage(URI storage) throws ControllerException {
// Retrieve the storage device info from the database.
StorageSystem storageObj = null;
try {
storageObj = _dbClient.queryObject(StorageSystem.class, storage);
} catch (Exception e) {
throw DeviceControllerException.exceptions.connectStorageFailedDb(e);
}
// Verify non-null storage device returned from the database client.
if (storageObj == null) {
throw DeviceControllerException.exceptions.connectStorageFailedNull();
}
// Get the block device reference for the type of block device managed
// by the controller.
BlockStorageDevice storageDevice = getDevice(storageObj.getSystemType());
storageDevice.doConnect(storageObj);
_log.info("Adding to storage device to work pool: {}", storageObj.getId());
}
use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class BlockDeviceController method deleteSelectedSnapshot.
public void deleteSelectedSnapshot(URI storage, URI snapshot, String opId) throws ControllerException {
_log.info("START deleteSelectedSnapshot");
TaskCompleter completer = null;
WorkflowStepCompleter.stepExecuting(opId);
try {
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
BlockSnapshot snapObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
completer = BlockSnapshotDeleteCompleter.createCompleter(_dbClient, snapObj, opId);
getDevice(storageObj.getSystemType()).doDeleteSelectedSnapshot(storageObj, snapshot, completer);
} catch (Exception e) {
if (completer != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(opId, serviceError);
completer.error(_dbClient, serviceError);
} else {
throw DeviceControllerException.exceptions.deleteVolumeSnapshotFailed(e);
}
}
}
use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class BlockDeviceController method resumeNativeContinuousCopy.
public void resumeNativeContinuousCopy(URI storage, List<URI> mirrorList, Boolean isCG, String opId) throws ControllerException {
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
TaskCompleter completer = new BlockMirrorResumeCompleter(mirrorList, opId);
if (!isCG) {
getDevice(storageObj.getSystemType()).doResumeNativeContinuousCopy(storageObj, mirrorList.get(0), completer);
} else {
completer.addConsistencyGroupId(ConsistencyGroupUtils.getMirrorsConsistencyGroup(mirrorList, _dbClient).getId());
getDevice(storageObj.getSystemType()).doResumeGroupNativeContinuousCopies(storageObj, mirrorList, completer);
}
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(opId, serviceError);
}
}
use of com.emc.storageos.volumecontroller.ControllerException 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.ControllerException in project coprhd-controller by CoprHD.
the class BlockDeviceController method expandBlockSnapshot.
@Override
public void expandBlockSnapshot(URI storageURI, URI snapshotURI, Long newSize, String opId) throws ControllerException {
Volume volumeObj = null;
try {
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storageURI);
BlockSnapshot snapObj = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
volumeObj = _dbClient.queryObject(Volume.class, snapObj.getParent().getURI());
_log.info("expandBlockSnapshot start - Array: {} Pool:{} BlockSnapshot:{}, OldSize: {}, NewSize: {}", storageURI.toString(), volumeObj.getPool().toString(), snapshotURI.toString(), snapObj.getProvisionedCapacity(), newSize);
StoragePool poolObj = _dbClient.queryObject(StoragePool.class, volumeObj.getPool());
BlockSnapshotExpandCompleter completer = new BlockSnapshotExpandCompleter(snapshotURI, newSize, opId);
// expand as regular BlockSnapshot
InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_080);
getDevice(storageObj.getSystemType()).doExpandSnapshot(storageObj, poolObj, snapObj, newSize, completer);
_log.info("expandBlockSnapshot end - Array: {} Pool:{} BlockSnapshot:{}", storageURI.toString(), volumeObj.getPool().toString(), snapshotURI.toString());
} catch (Exception e) {
_log.error("expandBlockSnapshot Failed - Array:{} Pool:{} BlockSnapshot:{}", storageURI.toString(), (volumeObj == null) ? "" : volumeObj.getPool().toString(), snapshotURI.toString(), e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
List<URI> snapshotURIs = Arrays.asList(snapshotURI);
doFailTask(BlockSnapshot.class, snapshotURIs, opId, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
}
}
Aggregations