Search in sources :

Example 1 with SmisBlockSnapshotSessionRelinkTargetJob

use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionRelinkTargetJob in project coprhd-controller by CoprHD.

the class VmaxSnapshotOperations method relinkSnapshotSessionTarget.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("rawtypes")
@Override
public void relinkSnapshotSessionTarget(StorageSystem system, URI tgtSnapSessionURI, URI snapshotURI, TaskCompleter completer) throws DeviceControllerException {
    // Only supported for VMAX3 storage systems.
    if (!system.checkIfVmax3()) {
        throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
    }
    try {
        _log.info("Re-link target {} to snapshot session {} START", snapshotURI, tgtSnapSessionURI);
        BlockSnapshotSession tgtSnapSession = _dbClient.queryObject(BlockSnapshotSession.class, tgtSnapSessionURI);
        BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
        URI sourceURI = tgtSnapSession.getParent().getURI();
        BlockObject sourceObj = BlockObject.fetch(_dbClient, sourceURI);
        CIMObjectPath sourcePath = _cimPath.getVolumePath(system, sourceObj.getNativeId());
        CIMObjectPath syncObjPath = getSyncObject(system, snapshot, sourceObj);
        boolean targetLinkedInCopyMode = isTargetOrGroupCopyMode(system, syncObjPath);
        CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(system);
        String syncAspectPath = tgtSnapSession.getSessionInstance();
        CIMObjectPath settingsStatePath = _cimPath.getSyncSettingsPath(system, sourcePath, syncAspectPath);
        CIMObjectPath targetDevicePath = _cimPath.getBlockObjectPath(system, snapshot);
        CIMArgument[] inArgs = null;
        CIMArgument[] outArgs = new CIMArgument[5];
        inArgs = _helper.getModifySettingsDefinedStateForRelinkTargets(system, settingsStatePath, targetDevicePath, targetLinkedInCopyMode);
        _helper.invokeMethod(system, replicationSvcPath, SmisConstants.MODIFY_SETTINGS_DEFINE_STATE, inArgs, outArgs);
        CIMObjectPath jobPath = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockSnapshotSessionRelinkTargetJob(jobPath, system.getId(), completer)));
    } catch (Exception e) {
        _log.error("Exception re-linking snapshot session", e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        completer.error(_dbClient, error);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) SmisBlockSnapshotSessionRelinkTargetJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionRelinkTargetJob) BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMObjectPath(javax.cim.CIMObjectPath) URI(java.net.URI) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) BlockObject(com.emc.storageos.db.client.model.BlockObject) CIMArgument(javax.cim.CIMArgument)

Example 2 with SmisBlockSnapshotSessionRelinkTargetJob

use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionRelinkTargetJob in project coprhd-controller by CoprHD.

the class VmaxSnapshotOperations method relinkSnapshotSessionTargetGroup.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("rawtypes")
@Override
public void relinkSnapshotSessionTargetGroup(StorageSystem system, URI tgtSnapSessionURI, URI snapshotURI, TaskCompleter completer) throws DeviceControllerException {
    // Only supported for VMAX3 storage systems.
    if (!system.checkIfVmax3()) {
        throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
    }
    try {
        _log.info("Re-link target {} to snapshot session {} START", snapshotURI, tgtSnapSessionURI);
        BlockSnapshotSession tgtSnapSession = _dbClient.queryObject(BlockSnapshotSession.class, tgtSnapSessionURI);
        String syncAspectPath = tgtSnapSession.getSessionInstance();
        BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
        String groupName = ControllerUtils.extractGroupName(snapshot.getReplicationGroupInstance());
        CIMObjectPath replicationGroupPath = _cimPath.getReplicationGroupPath(system, groupName);
        // get source group name from the session.
        String sourceGroupName = tgtSnapSession.getReplicationGroupInstance();
        CIMObjectPath settingsStatePath = _cimPath.getGroupSynchronizedSettingsPath(system, sourceGroupName, syncAspectPath);
        // We need to know if the group was linked in copy mode or nocopy mode.
        CIMObjectPath groupSyncPath = _cimPath.getGroupSynchronizedPath(system, sourceGroupName, groupName);
        boolean targetGroupLinkedInCopyMode = isTargetOrGroupCopyMode(system, groupSyncPath);
        CIMArgument[] inArgs = null;
        CIMArgument[] outArgs = new CIMArgument[5];
        inArgs = _helper.getModifySettingsDefinedStateForRelinkTargetGroups(system, settingsStatePath, replicationGroupPath, targetGroupLinkedInCopyMode);
        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 SmisBlockSnapshotSessionRelinkTargetJob(jobPath, system.getId(), completer)));
    } catch (Exception e) {
        _log.error("Exception re-linking snapshot session", e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        completer.error(_dbClient, error);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) SmisBlockSnapshotSessionRelinkTargetJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockSnapshotSessionRelinkTargetJob) BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMObjectPath(javax.cim.CIMObjectPath) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) CIMArgument(javax.cim.CIMArgument)

Aggregations

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