Search in sources :

Example 1 with SmisBlockResumeMirrorJob

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

the class AbstractMirrorOperations method resumeSingleVolumeMirror.

@Override
public void resumeSingleVolumeMirror(StorageSystem storage, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("resumeSingleVolumeMirror operation START");
    CloseableIterator<CIMObjectPath> storageSyncRefs = null;
    try {
        BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
        CIMObjectPath mirrorPath = _cimPath.getBlockObjectPath(storage, mirrorObj);
        // Get reference to the CIM_StorageSynchronized instance
        storageSyncRefs = _helper.getReference(storage, mirrorPath, SmisConstants.CIM_STORAGE_SYNCHRONIZED, null);
        if (!storageSyncRefs.hasNext()) {
            _log.error("No synchronization instance found for {}", mirror);
            taskCompleter.error(_dbClient, DeviceControllerException.exceptions.resumeVolumeMirrorFailed(mirror));
            return;
        }
        boolean isVmax3 = storage.checkIfVmax3();
        while (storageSyncRefs.hasNext()) {
            CIMObjectPath storageSync = storageSyncRefs.next();
            _log.debug(storageSync.toString());
            /**
             * JIRA CTRL-11855
             * User created mirror and did pause operation using SMI 4.6.2.
             * Then He upgraded to SMI 8.0.3. While doing mirror resume getting exception from SMI because of the
             * existing mirrorObj.getSynchronizedInstance() contains SystemName=\"SYMMETRIX+000195701573\""
             * This is wrong with 8.0.3 as SystemName=\"SYMMETRIX-+-000195701573\"".
             * To resolve this issue setting new value collected from current smis provider here.
             */
            mirrorObj.setSynchronizedInstance(storageSync.toString());
            _dbClient.persistObject(mirrorObj);
            CIMArgument[] inArgs = isVmax3 ? _helper.getResumeSynchronizationInputArgumentsWithCopyState(storageSync) : _helper.getResumeSynchronizationInputArguments(storageSync);
            CIMArgument[] outArgs = new CIMArgument[5];
            _helper.callModifyReplica(storage, inArgs, outArgs);
            CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
            if (job != null) {
                ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockResumeMirrorJob(job, storage.getId(), taskCompleter)));
            } else {
                CIMInstance syncObject = _helper.getInstance(storage, storageSync, false, false, new String[] { SmisConstants.CP_SYNC_STATE });
                mirrorObj.setSyncState(CIMPropertyFactory.getPropertyValue(syncObject, SmisConstants.CP_SYNC_STATE));
                _dbClient.persistObject(mirrorObj);
                taskCompleter.ready(_dbClient);
            }
        }
    } catch (Exception e) {
        _log.error("Failed to resume single volume mirror: {}", mirror);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(_dbClient, serviceError);
    } finally {
        if (storageSyncRefs != null) {
            storageSyncRefs.close();
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) CIMObjectPath(javax.cim.CIMObjectPath) SmisBlockResumeMirrorJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockResumeMirrorJob) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CIMInstance(javax.cim.CIMInstance) WBEMException(javax.wbem.WBEMException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument)

Aggregations

BlockMirror (com.emc.storageos.db.client.model.BlockMirror)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1 SmisBlockResumeMirrorJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockResumeMirrorJob)1 CIMArgument (javax.cim.CIMArgument)1 CIMInstance (javax.cim.CIMInstance)1 CIMObjectPath (javax.cim.CIMObjectPath)1 WBEMException (javax.wbem.WBEMException)1