Search in sources :

Example 86 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class AbstractMirrorOperations method createSingleVolumeMirror.

@Override
public void createSingleVolumeMirror(StorageSystem storage, URI mirror, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("createSingleVolumeMirror operation START");
    try {
        BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
        StoragePool targetPool = _dbClient.queryObject(StoragePool.class, mirrorObj.getPool());
        Volume source = _dbClient.queryObject(Volume.class, mirrorObj.getSource());
        TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, source.getTenant().getURI());
        String tenantName = tenant.getLabel();
        String targetLabelToUse = _nameGenerator.generate(tenantName, mirrorObj.getLabel(), mirror.toString(), '-', SmisConstants.MAX_VOLUME_NAME_LENGTH);
        CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
        CIMArgument[] inArgs = null;
        if (storage.checkIfVmax3()) {
            CIMObjectPath volumeGroupPath = _helper.getVolumeGroupPath(storage, storage, source, targetPool);
            CIMInstance replicaSettingData = getDefaultReplicationSettingData(storage);
            inArgs = _helper.getCreateElementReplicaMirrorInputArguments(storage, source, targetPool, createInactive, targetLabelToUse, volumeGroupPath, replicaSettingData);
        } else {
            inArgs = _helper.getCreateElementReplicaMirrorInputArguments(storage, source, targetPool, createInactive, targetLabelToUse);
        }
        CIMArgument[] outArgs = new CIMArgument[5];
        _helper.invokeMethod(storage, replicationSvcPath, SmisConstants.CREATE_ELEMENT_REPLICA, inArgs, outArgs);
        CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        if (job != null) {
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateMirrorJob(job, storage.getId(), !createInactive, taskCompleter)));
            // Resynchronizing state applies to the initial copy as well as future
            // re-synchronization's.
            mirrorObj.setSyncState(SynchronizationState.RESYNCHRONIZING.toString());
            _dbClient.persistObject(mirrorObj);
        }
    } catch (final InternalException e) {
        _log.info("Problem making SMI-S call: ", e);
        taskCompleter.error(_dbClient, e);
    } catch (Exception e) {
        _log.info("Problem making SMI-S call: ", e);
        ServiceError serviceError = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        taskCompleter.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) StoragePool(com.emc.storageos.db.client.model.StoragePool) CIMObjectPath(javax.cim.CIMObjectPath) SmisBlockCreateMirrorJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateMirrorJob) CIMInstance(javax.cim.CIMInstance) WBEMException(javax.wbem.WBEMException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) Volume(com.emc.storageos.db.client.model.Volume) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CIMArgument(javax.cim.CIMArgument)

Example 87 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class AbstractReplicaOperations method deleteListReplica.

@Override
public void deleteListReplica(StorageSystem storage, List<URI> replicaList, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("deleteListReplica operation START");
    if (!((storage.getUsingSmis80() && storage.deviceIsType(Type.vmax)) || storage.deviceIsType(Type.vnxblock))) {
        throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
    }
    try {
        String[] deviceIds = _helper.getBlockObjectNativeIds(replicaList);
        if (storage.checkIfVmax3()) {
            _helper.removeVolumeFromParkingSLOStorageGroup(storage, deviceIds, false);
            _log.info("Done invoking remove volumes from parking SLO storage group");
        }
        CIMObjectPath[] devicePaths = _cimPath.getVolumePaths(storage, deviceIds);
        CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storage);
        CIMArgument[] inArgs = null;
        if (storage.deviceIsType(Type.vnxblock)) {
            inArgs = _helper.getReturnElementsToStoragePoolArguments(devicePaths);
        } else {
            inArgs = _helper.getReturnElementsToStoragePoolArguments(devicePaths, SmisConstants.CONTINUE_ON_NONEXISTENT_ELEMENT);
        }
        CIMArgument[] outArgs = new CIMArgument[5];
        _helper.invokeMethod(storage, configSvcPath, SmisConstants.RETURN_ELEMENTS_TO_STORAGE_POOL, inArgs, outArgs);
        CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockDeleteListReplicaJob(job, storage.getId(), taskCompleter)));
    } catch (Exception e) {
        _log.error("Problem making SMI-S call: ", e);
        ServiceError serviceError = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        taskCompleter.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) SmisBlockDeleteListReplicaJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockDeleteListReplicaJob) CIMObjectPath(javax.cim.CIMObjectPath) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument)

Example 88 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class VmaxMirrorOperations method detachGroupMirrors.

@Override
public void detachGroupMirrors(StorageSystem storage, List<URI> mirrorList, Boolean deleteGroup, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("START detach group mirror operation");
    if (!storage.getUsingSmis80()) {
        throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
    }
    try {
        callEMCRefreshIfRequired(_dbClient, _helper, storage, mirrorList);
        CIMObjectPath groupSynchronized = ReplicationUtils.getMirrorGroupSynchronizedPath(storage, mirrorList.get(0), _dbClient, _helper, _cimPath);
        if (_helper.checkExists(storage, groupSynchronized, false, false) != null) {
            CIMArgument[] detachCGMirrorInput = _helper.getDetachSynchronizationInputArguments(groupSynchronized);
            // Invoke method to detach local mirrors
            UnsignedInteger32 result = (UnsignedInteger32) _helper.callModifyReplica(storage, detachCGMirrorInput, new CIMArgument[5]);
            if (JOB_COMPLETED_NO_ERROR.equals(result)) {
                List<BlockMirror> mirrors = _dbClient.queryObject(BlockMirror.class, mirrorList);
                if (deleteGroup) {
                    ReplicationUtils.deleteReplicationGroup(storage, mirrors.get(0).getReplicationGroupInstance(), _dbClient, _helper, _cimPath);
                }
                // Set mirrors replication group to null
                for (BlockMirror mirror : mirrors) {
                    if (deleteGroup) {
                        mirror.setConsistencyGroup(NullColumnValueGetter.getNullURI());
                        mirror.setReplicationGroupInstance(NullColumnValueGetter.getNullStr());
                    }
                    mirror.setSyncState(NullColumnValueGetter.getNullStr());
                }
                _dbClient.persistObject(mirrors);
                taskCompleter.ready(_dbClient);
            } else {
                String msg = String.format("SMI-S call returned unsuccessfully: %s", result);
                taskCompleter.error(_dbClient, DeviceControllerException.errors.smis.jobFailed(msg));
            }
        } else {
            _log.error("Unable to find group synchronized {}", groupSynchronized.toString());
            BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, mirrorList.get(0));
            ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(mirror.getReplicationGroupInstance());
            taskCompleter.error(_dbClient, error);
        }
    } catch (Exception e) {
        _log.error("Problem making SMI-S call: ", e);
        ServiceError error = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(_dbClient, error);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) WBEMException(javax.wbem.WBEMException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument)

Example 89 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class VmaxMirrorOperations method establishVolumeNativeContinuousCopyGroupRelation.

@Override
public void establishVolumeNativeContinuousCopyGroupRelation(StorageSystem storage, URI sourceVolume, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("establishVolumeNativeContinuousCopyGroupRelation operation START");
    try {
        /**
         * get groupPath for source volume
         * get groupPath for mirror
         * get mirrors belonging to the same Replication Group
         * get Element synchronizations between volumes and mirrors
         * call CreateGroupReplicaFromElementSynchronizations
         */
        BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
        Volume volumeObj = _dbClient.queryObject(Volume.class, sourceVolume);
        CIMObjectPath srcRepSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
        String volumeGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(volumeObj, _dbClient);
        CIMObjectPath volumeGroupPath = _cimPath.getReplicationGroupPath(storage, volumeGroupName);
        CIMObjectPath mirrorGroupPath = _cimPath.getReplicationGroupPath(storage, mirrorObj.getReplicationGroupInstance());
        CIMObjectPath groupSynchronizedPath = _cimPath.getGroupSynchronized(volumeGroupPath, mirrorGroupPath);
        CIMInstance syncInstance = _helper.checkExists(storage, groupSynchronizedPath, false, false);
        if (syncInstance == null) {
            // List<Volume> volumes = ControllerUtils.getVolumesPartOfCG(sourceVolume.getConsistencyGroup(), _dbClient);
            // get all mirrors belonging to a Replication Group. There may be multiple mirrors available for a Volume
            List<BlockMirror> mirrors = ControllerUtils.getMirrorsPartOfReplicationGroup(mirrorObj.getReplicationGroupInstance(), _dbClient);
            List<CIMObjectPath> elementSynchronizations = new ArrayList<CIMObjectPath>();
            for (BlockMirror mirrorObject : mirrors) {
                Volume volume = _dbClient.queryObject(Volume.class, mirrorObject.getSource());
                elementSynchronizations.add(_cimPath.getStorageSynchronized(storage, volume, storage, mirrorObject));
            }
            _log.info("Creating Group synchronization between volume group and mirror group");
            CIMArgument[] inArgs = _helper.getCreateGroupReplicaFromElementSynchronizationsForSRDFInputArguments(volumeGroupPath, mirrorGroupPath, elementSynchronizations);
            CIMArgument[] outArgs = new CIMArgument[5];
            _helper.invokeMethod(storage, srcRepSvcPath, SmisConstants.CREATE_GROUP_REPLICA_FROM_ELEMENT_SYNCHRONIZATIONS, inArgs, outArgs);
        // No Job returned
        } else {
            _log.info("Link already established..");
        }
        taskCompleter.ready(_dbClient);
    } catch (Exception e) {
        _log.error("Failed to establish group relation between volume group and mirror group. Volume: {}, Mirror: {}", sourceVolume, mirror);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) CIMObjectPath(javax.cim.CIMObjectPath) ArrayList(java.util.ArrayList) CIMInstance(javax.cim.CIMInstance) WBEMException(javax.wbem.WBEMException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument)

Example 90 with DeviceControllerException

use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.

the class VmaxMirrorOperations method resumeGroupMirrors.

@Override
public void resumeGroupMirrors(StorageSystem storage, List<URI> mirrorList, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("resumeGroupMirrors operation START");
    if (!storage.getUsingSmis80()) {
        throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
    }
    try {
        callEMCRefreshIfRequired(_dbClient, _helper, storage, mirrorList);
        CIMObjectPath groupSynchronized = ReplicationUtils.getMirrorGroupSynchronizedPath(storage, mirrorList.get(0), _dbClient, _helper, _cimPath);
        if (null == _helper.checkExists(storage, groupSynchronized, false, false)) {
            _log.error("Unable to find group synchronized {}", groupSynchronized.toString());
            BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, mirrorList.get(0));
            ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(mirror.getReplicationGroupInstance());
            taskCompleter.error(_dbClient, error);
            return;
        }
        resumeGroupMirrors(storage, mirrorList);
        taskCompleter.ready(_dbClient);
    } catch (Exception e) {
        _log.error("Problem making SMI-S call", e);
        ServiceError error = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(_dbClient, error);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) CIMObjectPath(javax.cim.CIMObjectPath) WBEMException(javax.wbem.WBEMException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Aggregations

DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)393 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)211 URI (java.net.URI)157 Volume (com.emc.storageos.db.client.model.Volume)115 ArrayList (java.util.ArrayList)115 WBEMException (javax.wbem.WBEMException)113 CIMObjectPath (javax.cim.CIMObjectPath)104 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)85 ExportMask (com.emc.storageos.db.client.model.ExportMask)83 CIMArgument (javax.cim.CIMArgument)81 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)75 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)63 BlockObject (com.emc.storageos.db.client.model.BlockObject)55 HashMap (java.util.HashMap)54 Initiator (com.emc.storageos.db.client.model.Initiator)52 HashSet (java.util.HashSet)52 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)48 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)46 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)46 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)43