Search in sources :

Example 21 with AccessProfile

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

the class FEPortStatsProcessor method processResult.

@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws SMIPluginException {
    try {
        CIMArgument<?>[] outputArguments = (CIMArgument<?>[]) resultObj;
        DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        List<Stat> metricsObjList = (List<Stat>) keyMap.get(Constants._Stats);
        List<String> metricSequence = (List<String>) keyMap.get(Constants.STORAGEOS_FEPORT_MANIFEST);
        String[] feportsMetricValues = ((String[]) outputArguments[0].getValue())[0].split("\n");
        List<StoragePort> systemPorts = ControllerUtils.getSystemPortsOfSystem(dbClient, profile.getSystemId());
        _logger.debug("FEPort metricNames Sequence {}", metricSequence);
        // process the results.
        if (null != metricSequence && !metricSequence.isEmpty()) {
            // Step2: For each feport metric record
            for (String fePortMetricValue : feportsMetricValues) {
                if (fePortMetricValue.isEmpty()) {
                    _logger.debug("Empty FEPort stats returned as part of Statistics Response");
                    continue;
                }
                String[] metrics = fePortMetricValue.split(Constants.SEMI_COLON);
                // Step 3: For each port in db for a given system.
                for (StoragePort port : systemPorts) {
                    // Step 4: if port in db is null just continue.
                    if (null == port) {
                        continue;
                    } else if (!port.getInactive() && metrics[0].endsWith(port.getPortName())) {
                        // Step 5: Check whether provider returned port
                        // exists in db or not. if port exists in db,
                        // then create a PortStat object for it.
                        _logger.debug("found FEPort in db for {}", port.getPortName());
                        createPortStatMetric(metricSequence, port, keyMap, metricsObjList, metrics);
                    }
                }
            }
            // 
            // compute port metric to trigger if any port allocation qualification changed. If there is
            // changes, run vpool matcher
            // 
            portMetricsProcessor.triggerVpoolMatcherIfPortAllocationQualificationChanged(profile.getSystemId(), systemPorts);
            // 
            // compute storage system's average of port metrics. Then, persist it into storage system object.
            // 
            portMetricsProcessor.computeStorageSystemAvgPortMetrics(profile.getSystemId());
            // Compute port group's port metrics for vmax only
            portMetricsProcessor.computePortGroupMetrics(profile.getSystemId());
        } else {
            _logger.error("failed processing FEPOrt Metric values as metric sequence is null.");
        }
    } catch (Exception e) {
        _logger.error("Failed while extracting stats for FEPorts: ", e);
    }
    resultObj = null;
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) StoragePort(com.emc.storageos.db.client.model.StoragePort) AccessProfile(com.emc.storageos.plugins.AccessProfile) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) Stat(com.emc.storageos.db.client.model.Stat) List(java.util.List) CIMArgument(javax.cim.CIMArgument)

Example 22 with AccessProfile

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

the class VNXFileSystemStaticLoadProcessor method processMountList.

/**
 * Process the mountList which are received from XMLAPI server.
 *
 * @param mountList : List of Mount objects.
 * @param keyMap : keyMap.
 */
private void processMountList(final List<Object> mountList, Map<String, Object> keyMap) throws VNXFilePluginException {
    _logger.info("Processing file system mount response....");
    final DbClient dbClient = (DbClient) keyMap.get(VNXFileConstants.DBCLIENT);
    // step -1 get the filesystem capacity map < filesystemid, size>
    Map<String, Long> fsCapList = (HashMap<String, Long>) keyMap.get(VNXFileConstants.FILE_CAPACITY_MAP);
    Map<String, Map<String, Long>> snapCapFsMap = (HashMap<String, Map<String, Long>>) keyMap.get(VNXFileConstants.SNAP_CAPACITY_MAP);
    // step-2 get the snapshot checkpoint size for give filesystem and it is map of filesystem and map <snapshot, checkpointsize>>
    AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
    // get the storagesystem from db
    StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, profile.getSystemId());
    List<String> fsList = null;
    Map<String, List<String>> fsMountvNASMap = new HashMap<String, List<String>>();
    Map<String, List<String>> fsMountPhyNASMap = new HashMap<String, List<String>>();
    // step -3 we will get filesystem on VDM or DM
    Iterator<Object> iterator = mountList.iterator();
    if (iterator.hasNext()) {
        Status status = (Status) iterator.next();
        if (status.getMaxSeverity() == Severity.OK) {
            // step -4 get the filesystem list for each mover or VDM in Map
            while (iterator.hasNext()) {
                Mount mount = (Mount) iterator.next();
                if (mount.isMoverIdIsVdm() == true) {
                    fsList = fsMountvNASMap.get(mount.getMover());
                    if (null == fsList) {
                        fsList = new ArrayList<String>();
                    }
                    fsList.add(mount.getFileSystem());
                    // get filesystem list for VDM or vNAS
                    fsMountvNASMap.put(mount.getMover(), fsList);
                    _logger.debug("Filestem or Snapshot {} mounted on vdm {} ", mount.getFileSystem(), mount.getMover());
                } else {
                    fsList = fsMountPhyNASMap.get(mount.getMover());
                    if (null == fsList) {
                        fsList = new ArrayList<String>();
                    }
                    fsList.add(mount.getFileSystem());
                    // get filesystem list for DM or mover
                    fsMountPhyNASMap.put(mount.getMover(), fsList);
                    _logger.debug("Filestem or Snapshot {} mounted on data mover {} ", mount.getFileSystem(), mount.getMover());
                }
            }
            // Log the number of objects mounted on each data mover and virtual data mover!!!
            for (Entry<String, List<String>> eachVNas : fsMountvNASMap.entrySet()) {
                _logger.info(" Virtual data mover {} has Filestem or Snapshot mounts {} ", eachVNas.getKey(), eachVNas.getValue().size());
            }
            for (Entry<String, List<String>> eachNas : fsMountPhyNASMap.entrySet()) {
                _logger.info(" Data mover {} has Filestem or Snapshot mounts {} ", eachNas.getKey(), eachNas.getValue().size());
            }
            Map<String, Long> vdmCapacityMap = new HashMap<String, Long>();
            Map<String, Long> dmCapacityMap = new HashMap<String, Long>();
            vdmCapacityMap = computeMoverCapacity(fsMountvNASMap, fsCapList, snapCapFsMap);
            dmCapacityMap = computeMoverCapacity(fsMountPhyNASMap, fsCapList, snapCapFsMap);
            prepareDBMetrics(storageSystem, dbClient, fsMountPhyNASMap, dmCapacityMap, fsMountvNASMap, vdmCapacityMap);
        } else {
            throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
        }
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) DbClient(com.emc.storageos.db.client.DbClient) HashMap(java.util.HashMap) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) Mount(com.emc.nas.vnxfile.xmlapi.Mount) AccessProfile(com.emc.storageos.plugins.AccessProfile) ArrayList(java.util.ArrayList) List(java.util.List) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) HashMap(java.util.HashMap) Map(java.util.Map) StringMap(com.emc.storageos.db.client.model.StringMap) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 23 with AccessProfile

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

the class ConnectionManagerUtils method disallowReaping.

public void disallowReaping(Object profile, Object client) throws BaseCollectionException {
    AccessProfile accessProfile = (AccessProfile) profile;
    DbClient dbClient = (DbClient) client;
    try {
        final CIMConnectionFactory connectionFactory = (CIMConnectionFactory) accessProfile.getCimConnectionFactory();
        StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, accessProfile.getSystemId());
        connectionFactory.setKeepAliveForConnection(storageSystem);
    } catch (final IllegalStateException ex) {
        log.error("Not able to get CIMOM Client instance for ip {} due to ", accessProfile.getIpAddress(), ex);
        throw new SMIPluginException(SMIPluginException.ERRORCODE_NO_WBEMCLIENT, ex.fillInStackTrace(), ex.getMessage());
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) CIMConnectionFactory(com.emc.storageos.volumecontroller.impl.smis.CIMConnectionFactory) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) AccessProfile(com.emc.storageos.plugins.AccessProfile) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 24 with AccessProfile

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

the class SMICommunicationInterfaceTest method createAccessProfile.

// SYMMETRIX+000187910031
private AccessProfile createAccessProfile() {
    AccessProfile _profile = new AccessProfile();
    _profile.setInteropNamespace("interop");
    _profile.setIpAddress(providerIP);
    _profile.setPassword(providerPassword);
    _profile.setProviderPort(providerPortStr);
    _profile.setnamespace("Performance");
    _profile.setelementType("Array");
    _profile.setUserName(providerUser);
    // need to set Array serial ID;
    _profile.setSslEnable(providerUseSsl);
    _profile.setserialID(providerArraySerial);
    return _profile;
}
Also used : AccessProfile(com.emc.storageos.plugins.AccessProfile)

Example 25 with AccessProfile

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

the class VNXFileCommunicationInterfaceTest method createAccessProfile.

/**
 * Create a VNX File Access Credentials.
 *
 * @return : AccessProfile.
 */
private AccessProfile createAccessProfile() {
    final AccessProfile profile = new AccessProfile();
    String host = EnvConfig.get("sanity", "vnx.host");
    String userName = EnvConfig.get("sanity", "vnx.username");
    String password = EnvConfig.get("sanity", "vnx.password");
    String portNumber = EnvConfig.get("sanity", "vnx.port");
    profile.setIpAddress(host);
    profile.setUserName(userName);
    profile.setPassword(password);
    profile.setPortNumber(Integer.parseInt(portNumber));
    profile.setSystemType("vnxfile");
    profile.setProfileName("VNXFileProfile");
    Map<String, String> props = new HashMap<String, String>();
    props.put("metering-dump", "true");
    props.put("metering-dump-location", "/tmp");
    profile.setProps(props);
    // need to set Array serial ID;
    profile.setserialID(serialNumber);
    return profile;
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) AccessProfile(com.emc.storageos.plugins.AccessProfile)

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