Search in sources :

Example 6 with AccessProfile

use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.

the class ProtocolEndPointToPortProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        CIMObjectPath protocolEndPointPath = getObjectPathfromCIMArgument(args);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        StorageSystem device = _dbClient.queryObject(StorageSystem.class, profile.getSystemId());
        String protocolEndPointId = protocolEndPointPath.getKey(Constants.NAME).getValue().toString();
        _log.info("Protocol End Point ID :" + protocolEndPointId);
        @SuppressWarnings("unchecked") Map<String, URI> volumeToRAGroupMap = (Map<String, URI>) keyMap.get(Constants.RAGROUP);
        URI remoteRAGroupUri = volumeToRAGroupMap.get(protocolEndPointId);
        _log.info("Remote RA Group URI :" + remoteRAGroupUri);
        String sourceSystemSerialId = keyMap.get(Constants._serialID).toString();
        _log.info("Source Serial ID :" + sourceSystemSerialId);
        RemoteDirectorGroup remoteGroup = _dbClient.queryObject(RemoteDirectorGroup.class, remoteRAGroupUri);
        if (remoteGroup == null) {
            _log.info("RA Group Not Found {}", remoteRAGroupUri);
        }
        while (it.hasNext()) {
            CIMInstance portInstance = it.next();
            StoragePort port = checkStoragePortExistsInDB(portInstance, device, _dbClient);
            if (null == port) {
                _log.info("RA Group Port Not Found {}", portInstance.getObjectPath());
                continue;
            }
            if (portInstance.getObjectPath().toString().contains(sourceSystemSerialId)) {
                remoteGroup.setSourcePort(port.getId());
                _log.info("Source Port added :" + portInstance.getObjectPath());
            } else {
                remoteGroup.setRemotePort(port.getId());
                _log.info("Remote Port added :" + portInstance.getObjectPath());
            }
            _dbClient.persistObject(remoteGroup);
        }
    } catch (Exception e) {
        _log.error("Discovering Ports for RA Groups failed", e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) StoragePort(com.emc.storageos.db.client.model.StoragePort) AccessProfile(com.emc.storageos.plugins.AccessProfile) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Iterator(java.util.Iterator) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) Map(java.util.Map) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 7 with AccessProfile

use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.

the class RemoteConnectivityCollectionProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    StorageSystem device = null;
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        device = getStorageSystem(_dbClient, profile.getSystemId());
        @SuppressWarnings("unchecked") Iterator<CIMInstance> iterator = (Iterator<CIMInstance>) resultObj;
        Set<String> remoteConnectedStorageSystems = new HashSet<String>();
        boolean srdfSupported = false;
        while (iterator.hasNext()) {
            srdfSupported = true;
            CIMInstance instance = iterator.next();
            RemoteDirectorGroup remoteRAGroup = checkRAGroupExistsInDB(_dbClient, instance);
            remoteRAGroup = createRAGroup(instance, remoteRAGroup, device);
            raGroupIds.add(remoteRAGroup.getNativeGuid());
            addRemoteConnectedStorageSystems(instance, device, remoteConnectedStorageSystems);
            addPath(keyMap, operation.getResult(), instance.getObjectPath());
        }
        updateSupportedCopyModes(srdfSupported, device);
        updateRemoteConnectedStorageSystems(device, remoteConnectedStorageSystems);
        _dbClient.persistObject(device);
        if (!newlyAddedGroups.isEmpty()) {
            _dbClient.createObject(newlyAddedGroups);
        }
        if (!modifiedGroups.isEmpty()) {
            _dbClient.persistObject(modifiedGroups);
        }
        performRAGroupsBookKeeping(raGroupIds, device.getId());
    } catch (Exception e) {
        _log.error("Finding out Active RA Groups Failed.SRDF will not be supported on this Array {} ", device.getNativeGuid(), e);
    } finally {
        raGroupIds = null;
        newlyAddedGroups = null;
        modifiedGroups = null;
    }
}
Also used : Iterator(java.util.Iterator) AccessProfile(com.emc.storageos.plugins.AccessProfile) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) HashSet(java.util.HashSet)

Example 8 with AccessProfile

use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.

the class ScannerProcessor method processResult.

/**
 * {@inheritDoc}
 */
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    AccessProfile profile = null;
    try {
        profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        while (it.hasNext()) {
            try {
                final CIMInstance instance = it.next();
                final CIMObjectPath path = instance.getObjectPath();
                if (isIBMInstance(instance) || path.toString().toLowerCase().contains(Constants.CLARIION) || !isRemoteSystem(instance)) {
                    addPath(keyMap, operation.getResult(), path);
                } else {
                    _logger.info("Skipping Detection of Remote System {}", instance.getPropertyValue(Constants.NAME));
                }
            } catch (Exception e) {
                _logger.error("Scanner Failed to scan Provider : {}-->{}", profile.getserialID(), getMessage(e));
            }
        }
    } catch (Exception e) {
        _logger.error("Scanner Failed to scan Provider : {}-->{}", profile.getIpAddress(), getMessage(e));
    }
}
Also used : Iterator(java.util.Iterator) CIMObjectPath(javax.cim.CIMObjectPath) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 9 with AccessProfile

use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.

the class SoftwareIdentityProcessor method processResult.

/**
 * {@inheritDoc}
 */
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    AccessProfile profile = null;
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        coordinator = (CoordinatorClient) keyMap.get(Constants.COORDINATOR_CLIENT);
        profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        if (it.hasNext()) {
            CIMInstance softwareInstance = it.next();
            String providerId = profile.getIpAddress() + "-" + profile.getProviderPort();
            List<StorageProvider> providers = CustomQueryUtility.getActiveStorageProvidersByProviderId(_dbClient, providerId);
            if (!providers.isEmpty()) {
                checkProviderVersion(softwareInstance, providers.get(0));
            }
        } else {
            String errMsg = String.format("No information obtained from Provider %s for Provider version", profile.getIpAddress());
            throw new SMIPluginException(errMsg, SMIPluginException.ERRORCODE_OPERATIONFAILED);
        }
    } catch (SMIPluginException e) {
        throw e;
    } catch (Exception e) {
        String errMsg = String.format("An error occurred while verifying Provider version: %s", e.getMessage());
        throw new SMIPluginException(SMIPluginException.ERRORCODE_OPERATIONFAILED, e, errMsg);
    }
}
Also used : Iterator(java.util.Iterator) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) AccessProfile(com.emc.storageos.plugins.AccessProfile) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException)

Example 10 with AccessProfile

use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method getRequestParamsMap.

private Map<String, Object> getRequestParamsMap(final StorageSystem system) {
    Map<String, Object> reqAttributeMap = new ConcurrentHashMap<String, Object>();
    reqAttributeMap.put(VNXFileConstants.DEVICETYPE, system.getSystemType());
    reqAttributeMap.put(VNXFileConstants.DBCLIENT, _dbClient);
    reqAttributeMap.put(VNXFileConstants.USERNAME, system.getUsername());
    reqAttributeMap.put(VNXFileConstants.USER_PASS_WORD, system.getPassword());
    reqAttributeMap.put(VNXFileConstants.PORTNUMBER, system.getPortNumber());
    AccessProfile profile = new AccessProfile();
    profile.setIpAddress(system.getIpAddress());
    reqAttributeMap.put(VNXFileConstants.URI, getServerUri(profile));
    reqAttributeMap.put(VNXFileConstants.AUTHURI, getLoginUri(profile));
    return reqAttributeMap;
}
Also used : DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) UnManagedDiscoveredObject(com.emc.storageos.db.client.model.UnManagedDiscoveredObject) AccessProfile(com.emc.storageos.plugins.AccessProfile) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

AccessProfile (com.emc.storageos.plugins.AccessProfile)49 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)33 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)30 Iterator (java.util.Iterator)25 CIMInstance (javax.cim.CIMInstance)24 CIMObjectPath (javax.cim.CIMObjectPath)16 URI (java.net.URI)14 DbClient (com.emc.storageos.db.client.DbClient)12 List (java.util.List)11 IOException (java.io.IOException)9 ArrayList (java.util.ArrayList)9 Map (java.util.Map)9 Stat (com.emc.storageos.db.client.model.Stat)8 StoragePool (com.emc.storageos.db.client.model.StoragePool)7 SMIPluginException (com.emc.storageos.plugins.metering.smis.SMIPluginException)7 StoragePort (com.emc.storageos.db.client.model.StoragePort)6 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 CIMArgument (javax.cim.CIMArgument)4