Search in sources :

Example 1 with SmisBlockSnapshotSessionDeleteJob

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();
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) SmisBlockSnapshotSessionDeleteJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionDeleteJob) CIMObjectPath(javax.cim.CIMObjectPath) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) BlockObject(com.emc.storageos.db.client.model.BlockObject) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) CIMArgument(javax.cim.CIMArgument)

Aggregations

BlockObject (com.emc.storageos.db.client.model.BlockObject)1 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)1 SmisBlockSnapshotSessionDeleteJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionDeleteJob)1 CIMArgument (javax.cim.CIMArgument)1 CIMObjectPath (javax.cim.CIMObjectPath)1 WBEMException (javax.wbem.WBEMException)1