use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class BlockDeviceController method scanProvider.
private boolean scanProvider(StorageProvider provider, StorageSystem storageSystem, boolean activeProvider, String opId) throws DatabaseException, BaseCollectionException, ControllerException {
Map<String, StorageSystemViewObject> storageCache = new HashMap<String, StorageSystemViewObject>();
_dbClient.createTaskOpStatus(StorageProvider.class, provider.getId(), opId, ResourceOperationTypeEnum.SCAN_SMISPROVIDER);
ScanTaskCompleter scanCompleter = new ScanTaskCompleter(StorageProvider.class, provider.getId(), opId);
try {
scanCompleter.statusPending(_dbClient, "Scan for storage system is Initiated");
provider.setLastScanStatusMessage("");
_dbClient.updateObject(provider);
ControllerServiceImpl.performScan(provider.getId(), scanCompleter, storageCache);
scanCompleter.statusReady(_dbClient, "Scan for storage system has completed");
} catch (Exception ex) {
_log.error("Scan failed for {}--->", provider, ex);
scanCompleter.statusError(_dbClient, DeviceControllerErrors.dataCollectionErrors.scanFailed(ex.getLocalizedMessage(), ex));
throw DeviceControllerException.exceptions.scanProviderFailed(storageSystem.getNativeGuid(), provider.getId().toString());
}
if (!storageCache.containsKey(storageSystem.getNativeGuid())) {
return false;
} else {
StorageSystemViewObject vo = storageCache.get(storageSystem.getNativeGuid());
String model = vo.getProperty(StorageSystemViewObject.MODEL);
if (StringUtils.isNotBlank(model)) {
storageSystem.setModel(model);
}
String serialNo = vo.getProperty(StorageSystemViewObject.SERIAL_NUMBER);
if (StringUtils.isNotBlank(serialNo)) {
storageSystem.setSerialNumber(serialNo);
}
String version = vo.getProperty(StorageSystemViewObject.VERSION);
if (StringUtils.isNotBlank(version)) {
storageSystem.setMajorVersion(version);
}
String name = vo.getProperty(StorageSystemViewObject.STORAGE_NAME);
if (StringUtils.isNotBlank(name)) {
storageSystem.setLabel(name);
}
provider.addStorageSystem(_dbClient, storageSystem, activeProvider);
return true;
}
}
use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class BlockDeviceController method restoreVolumeStep.
public boolean restoreVolumeStep(URI storage, URI pool, URI volume, URI snapshot, Boolean updateOpStatus, String opId) throws ControllerException {
TaskCompleter completer = null;
try {
StorageSystem storageDevice = _dbClient.queryObject(StorageSystem.class, storage);
BlockSnapshot snapObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
completer = new BlockSnapshotRestoreCompleter(snapObj, opId, updateOpStatus);
getDevice(storageDevice.getSystemType()).doRestoreFromSnapshot(storageDevice, volume, snapshot, completer);
} catch (Exception e) {
_log.error(String.format("restoreVolume failed - storage: %s, pool: %s, volume: %s, snapshot: %s", storage.toString(), pool.toString(), volume.toString(), snapshot.toString()));
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
doFailTask(BlockSnapshot.class, snapshot, opId, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
return false;
}
return true;
}
use of com.emc.storageos.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class BlockDeviceController method deleteConsistencyGroup.
@Override
public void deleteConsistencyGroup(URI storage, URI consistencyGroup, Boolean markInactive, String opId) throws ControllerException {
_log.info("START delete consistency group");
TaskCompleter wfCompleter = null;
try {
Workflow workflow = _workflowService.getNewWorkflow(this, "deleteReplicationGroupInConsistencyGroup", true, opId);
wfCompleter = new SimpleTaskCompleter(BlockConsistencyGroup.class, consistencyGroup, opId);
StorageSystem system = _dbClient.queryObject(StorageSystem.class, storage);
BlockConsistencyGroup cg = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroup);
Set<String> groupNames = BlockConsistencyGroupUtils.getGroupNamesForSystemCG(cg, system);
String stepId = null;
for (String groupName : groupNames) {
Workflow.Method deleteStep = new Workflow.Method("deleteReplicationGroupInConsistencyGroup", storage, consistencyGroup, groupName, false, markInactive, true);
stepId = workflow.createStep("DeleteReplicationGroup", "Deleting replication group", stepId, storage, system.getSystemType(), this.getClass(), deleteStep, rollbackMethodNullMethod(), null);
}
String successMsg = String.format("Successfully deleted replication groups %s", Joiner.on(',').join(groupNames));
workflow.executePlan(wfCompleter, successMsg);
} catch (Exception e) {
if (wfCompleter != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
wfCompleter.error(_dbClient, serviceError);
}
throw DeviceControllerException.exceptions.deleteConsistencyGroupFailed(e);
}
}
use of com.emc.storageos.volumecontroller.ControllerException 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.volumecontroller.ControllerException in project coprhd-controller by CoprHD.
the class BlockDeviceController method detachListClone.
public void detachListClone(URI storage, List<URI> cloneList, String taskId) throws ControllerException {
_log.info("START detachListClone: {}", Joiner.on("\t").join(cloneList));
try {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
TaskCompleter taskCompleter = new VolumeDetachCloneCompleter(cloneList, taskId);
getDevice(storageSystem.getSystemType()).doDetachListReplica(storageSystem, cloneList, taskCompleter);
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(taskId, serviceError);
doFailTask(Volume.class, cloneList, taskId, serviceError);
}
}
Aggregations