use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionDeleteJob in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method deleteSnapshotSession.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
public void deleteSnapshotSession(StorageSystem system, URI snapSessionURI, String groupName, TaskCompleter completer) throws DeviceControllerException {
if (system.checkIfVmax3()) {
// Only supported for VMAX3 storage systems.
try {
_log.info("Delete snapshot session {} START", snapSessionURI);
BlockSnapshotSession snapSession = _dbClient.queryObject(BlockSnapshotSession.class, snapSessionURI);
String syncAspectPath = snapSession.getSessionInstance();
if (NullColumnValueGetter.isNullValue(syncAspectPath)) {
// If there is no session instance, it must have failed creation and
// this is method is being called due to a rollback.
_log.info("No session instance specified for snapshot session {}", snapSessionURI);
completer.ready(_dbClient);
} else {
CIMObjectPath settingsStatePath = null;
if (snapSession.hasConsistencyGroup() && NullColumnValueGetter.isNotNullValue(groupName)) {
settingsStatePath = _cimPath.getGroupSynchronizedSettingsPath(system, groupName, syncAspectPath);
} else {
BlockObject sourceObj = BlockObject.fetch(_dbClient, snapSession.getParent().getURI());
CIMObjectPath sourcePath = _cimPath.getBlockObjectPath(system, sourceObj);
settingsStatePath = _cimPath.getSyncSettingsPath(system, sourcePath, syncAspectPath);
}
CIMArgument[] inArgs = null;
CIMArgument[] outArgs = new CIMArgument[5];
inArgs = _helper.getDeleteSettingsForSnapshotInputArguments(settingsStatePath, false);
CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(system);
_helper.invokeMethod(system, replicationSvcPath, SmisConstants.MODIFY_SETTINGS_DEFINE_STATE, inArgs, outArgs);
CIMObjectPath jobPath = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockSnapshotSessionDeleteJob(jobPath, system.getId(), completer)));
}
} catch (Exception e) {
_log.error("Exception deleting snapshot session", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
completer.error(_dbClient, error);
}
} else {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
}
Aggregations