Search in sources :

Example 81 with CIMObjectPath

use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.

the class VNXVolumesToPoolProcessor method processResult.

/**
 * {@inheritDoc}
 */
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        @SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
        // values previously set
        Object[] arguments = (Object[]) _args.get(0);
        CIMObjectPath volumePath = (CIMObjectPath) arguments[0];
        // Mapping had been already constructed between Volumes --> Policy in previous SMI-S Call
        // while getting Policy--->Volumes for VNX
        CIMObjectPath policyPath = (CIMObjectPath) keyMap.get(volumePath.getKey(Constants.DEVICEID).getValue());
    // add Pools to POlicy
    // addStoragePoolstoPolicy(policyPath, it, _dbClient,keyMap);
    } catch (Exception e) {
        _logger.error("Extracting Pools from Volumnes failed on FAST Polciy Discovery", e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) Iterator(java.util.Iterator) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 82 with CIMObjectPath

use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.

the class SPProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final Iterator<?> it = (Iterator<?>) resultObj;
    while (it.hasNext()) {
        try {
            final CIMInstance allocatedfrompool = (CIMInstance) it.next();
            CIMObjectPath path = (CIMObjectPath) allocatedfrompool.getProperty("Dependent").getValue();
            if (path.getObjectName().contains(_volume)) {
                String key = createKeyfromPath(path);
                // this check means, validating whether this Volume is
                // managed by Bourne
                Stat metrics = (Stat) getMetrics(keyMap, key);
                _logger.debug("Processing Volume to extract Allocated Capacity: {}", key);
                // Allocated Capacity =
                // CIM_AllocatedFromStoragePool.SpaceConsumed (in bytes)
                metrics.setAllocatedCapacity(Long.parseLong(allocatedfrompool.getProperty(_spaceConsumed).getValue().toString()));
            }
        } catch (Exception e) {
            if (!(e instanceof BaseCollectionException)) {
                _logger.error(" Allocated Capacity : ", e);
            }
        }
    }
    resultObj = null;
}
Also used : Stat(com.emc.storageos.db.client.model.Stat) Iterator(java.util.Iterator) CIMObjectPath(javax.cim.CIMObjectPath) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException)

Example 83 with CIMObjectPath

use of javax.cim.CIMObjectPath 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 84 with CIMObjectPath

use of javax.cim.CIMObjectPath 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 85 with CIMObjectPath

use of javax.cim.CIMObjectPath 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

CIMObjectPath (javax.cim.CIMObjectPath)582 CIMInstance (javax.cim.CIMInstance)254 WBEMException (javax.wbem.WBEMException)236 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)208 CIMArgument (javax.cim.CIMArgument)190 ArrayList (java.util.ArrayList)139 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)118 Volume (com.emc.storageos.db.client.model.Volume)108 URI (java.net.URI)108 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)82 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)76 WBEMClient (javax.wbem.client.WBEMClient)75 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)72 HashSet (java.util.HashSet)68 HashMap (java.util.HashMap)63 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)57 CIMProperty (javax.cim.CIMProperty)57 IOException (java.io.IOException)55 BlockObject (com.emc.storageos.db.client.model.BlockObject)52 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)52