Search in sources :

Example 1 with SmisCloneResyncJob

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

the class AbstractCloneOperations method resyncSingleClone.

@Override
@SuppressWarnings("rawtypes")
public void resyncSingleClone(StorageSystem storageSystem, URI cloneVolume, TaskCompleter taskCompleter) {
    _log.info("START resyncSingleClone operation");
    Volume clone = null;
    try {
        callEMCRefreshIfRequired(_dbClient, _helper, storageSystem, Arrays.asList(cloneVolume));
        clone = _dbClient.queryObject(Volume.class, cloneVolume);
        URI sourceUri = clone.getAssociatedSourceVolume();
        Volume sourceObj = _dbClient.queryObject(Volume.class, sourceUri);
        StorageSystem sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceObj.getStorageController());
        CIMObjectPath syncObject = _cimPath.getStorageSynchronized(sourceSystem, sourceObj, storageSystem, clone);
        CIMInstance instance = _helper.checkExists(storageSystem, syncObject, false, false);
        if (instance != null) {
            CIMArgument[] inArgs = _helper.getResyncReplicaInputArguments(syncObject);
            CIMArgument[] outArgs = new CIMArgument[5];
            _helper.callModifyReplica(storageSystem, inArgs, outArgs);
            CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
            if (job != null) {
                ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCloneResyncJob(job, storageSystem.getId(), taskCompleter)));
            }
        } else {
            String errorMsg = "The clone is already detached. resync will not be performed.";
            _log.info(errorMsg);
            ServiceError error = DeviceControllerErrors.smis.methodFailed("resyncSingleClone", errorMsg);
            taskCompleter.error(_dbClient, error);
        }
    } catch (Exception e) {
        String errorMsg = String.format(RESYNC_ERROR_MSG_FORMAT, cloneVolume);
        _log.error(errorMsg, e);
        taskCompleter.error(_dbClient, DeviceControllerException.exceptions.resynchronizeFullCopyFailed(e));
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) SmisCloneResyncJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCloneResyncJob) CIMObjectPath(javax.cim.CIMObjectPath) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CIMInstance(javax.cim.CIMInstance) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) CIMArgument(javax.cim.CIMArgument)

Example 2 with SmisCloneResyncJob

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

the class VmaxCloneOperations method resyncGroupClones.

/**
 * Implementation for resync clones in CG.
 *
 * @param storage [required] - StorageSystem object representing the array
 * @param clones [required] - URIs representing the previously created clones
 * @param taskCompleter - TaskCompleter object used for the updating operation status.
 */
@Override
@SuppressWarnings("rawtypes")
public void resyncGroupClones(StorageSystem storage, List<URI> clones, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("START resync group clone operation");
    try {
        callEMCRefreshIfRequired(_dbClient, _helper, storage, clones);
        Volume clone = _dbClient.queryObject(Volume.class, clones.get(0));
        Volume sourceVol = _dbClient.queryObject(Volume.class, clone.getAssociatedSourceVolume());
        String consistencyGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(sourceVol, _dbClient);
        String replicationGroupName = clone.getReplicationGroupInstance();
        CIMObjectPath groupSynchronized = _cimPath.getGroupSynchronizedPath(storage, consistencyGroupName, replicationGroupName);
        if (_helper.checkExists(storage, groupSynchronized, false, false) != null) {
            CIMObjectPath cimJob = null;
            CIMArgument[] resyncCGCloneInput = _helper.getResyncReplicaInputArguments(groupSynchronized);
            cimJob = _helper.callModifyReplica(storage, resyncCGCloneInput);
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCloneResyncJob(cimJob, storage.getId(), taskCompleter)));
        } else {
            ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(consistencyGroupName);
            taskCompleter.error(_dbClient, error);
        }
    } catch (Exception e) {
        String message = String.format("Exception when trying to resync clones from consistency group on array %s", storage.getSerialNumber());
        _log.error(message, e);
        taskCompleter.error(_dbClient, DeviceControllerException.exceptions.resynchronizeFullCopyFailed(e));
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) SmisCloneResyncJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCloneResyncJob) CIMObjectPath(javax.cim.CIMObjectPath) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument)

Example 3 with SmisCloneResyncJob

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

the class VmaxCloneOperations method fractureGroupClones.

@Override
@SuppressWarnings("rawtypes")
public void fractureGroupClones(StorageSystem storage, List<URI> clones, TaskCompleter completer) {
    _log.info("START fracture group clone operation");
    try {
        callEMCRefreshIfRequired(_dbClient, _helper, storage, clones);
        CIMObjectPath groupSynchronized = ReplicationUtils.getCloneGroupSynchronizedPath(storage, clones.get(0), _dbClient, _helper, _cimPath);
        if (_helper.checkExists(storage, groupSynchronized, false, false) != null) {
            if (_helper.groupHasReplicasInSplitState(storage, clones, Volume.class)) {
                SmisCloneResyncJob job = new SmisCloneResyncJob(null, storage.getId(), completer);
                CIMArgument[] resyncCGCloneInput = _helper.getResyncReplicaInputArguments(groupSynchronized);
                _log.info("Resync group clones with mixed states");
                _helper.callModifyReplicaSynchronously(storage, resyncCGCloneInput, job);
            }
            CIMArgument[] fractureCGCloneInput = _helper.getFractureMirrorInputArguments(groupSynchronized, null);
            _helper.callModifyReplica(storage, fractureCGCloneInput);
            List<Volume> cloneVolumes = _dbClient.queryObject(Volume.class, clones);
            for (Volume theClone : cloneVolumes) {
                theClone.setReplicaState(ReplicationState.SYNCHRONIZED.name());
            }
            _dbClient.persistObject(cloneVolumes);
            completer.ready(_dbClient);
        } else {
            Volume clone = _dbClient.queryObject(Volume.class, clones.get(0));
            ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(clone.getReplicationGroupInstance());
            completer.error(_dbClient, error);
        }
    } catch (Exception e) {
        String message = String.format("Exception when trying to fracture clones from consistency group on array %s", storage.getSerialNumber());
        _log.error(message, e);
        completer.error(_dbClient, DeviceControllerException.exceptions.fractureFullCopyFailed(e));
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) SmisCloneResyncJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCloneResyncJob) CIMObjectPath(javax.cim.CIMObjectPath) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument)

Aggregations

Volume (com.emc.storageos.db.client.model.Volume)3 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)3 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)3 SmisCloneResyncJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisCloneResyncJob)3 CIMArgument (javax.cim.CIMArgument)3 CIMObjectPath (javax.cim.CIMObjectPath)3 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)2 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 URI (java.net.URI)1 CIMInstance (javax.cim.CIMInstance)1 WBEMException (javax.wbem.WBEMException)1