Search in sources :

Example 1 with MoverNetStats

use of com.emc.nas.vnxfile.xmlapi.MoverNetStats in project coprhd-controller by CoprHD.

the class VNXStoragePortStatsProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final PostMethod result = (PostMethod) resultObj;
    _logger.info("processing moversStats response" + resultObj);
    try {
        List<Stat> newstatsList = null;
        Map<String, List<String>> interPortMap = null;
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        List<Stat> statsList = (List<Stat>) keyMap.get(VNXFileConstants.STATS);
        final DbClient dbClient = (DbClient) keyMap.get(VNXFileConstants.DBCLIENT);
        /*
             * step --> 1 get the interface map for mover and interface map contain values as storage ports
             * <MoverId, Map<interfaceIP, list<physicalPortName>>
             */
        Map<String, Map<String, List<String>>> moverInterMap = (Map<String, Map<String, List<String>>>) keyMap.get(VNXFileConstants.INTREFACE_PORT_MAP);
        ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
        List<Object> moversStats = getQueryStatsResponse(responsePacket);
        Iterator<Object> iterator = moversStats.iterator();
        // get the storagesystem from db
        StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, profile.getSystemId());
        // process Mover stats contains samples for each data mover and calculate port metrics
        while (iterator.hasNext()) {
            MoverNetStats moverNetStats = (MoverNetStats) iterator.next();
            // process mover stats per data mover
            String moverId = moverNetStats.getMover();
            // get interfaces and their list ports for mover id
            interPortMap = moverInterMap.get(moverId);
            // get the sample data of mover or VDM
            List<MoverNetStats.Sample> sampleList = moverNetStats.getSample();
            Map<String, BigInteger> stringMapPortIOs = new HashMap<String, BigInteger>();
            /*
                 * step -->2 get the io-ops of physical ports from samples
                 * <physicalPortName, Big(input + output band)>
                 */
            getPortIOTraffic(sampleList, stringMapPortIOs);
            // stats sample time
            long sampleTime = sampleList.get(0).getTime();
            /* step -->3 process the port metrics and update storageport object and store in db */
            newstatsList = processPortStatsInfo(interPortMap, stringMapPortIOs, storageSystem, dbClient, sampleTime);
            // finally add to stat object
            statsList.addAll(newstatsList);
        }
        // calculate the avg port utilization for VDM and store in db
        portMetricsProcessor.dataMoverAvgPortMetrics(profile.getSystemId());
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the volume stats response due to {}", ex.getMessage());
    } finally {
        result.releaseConnection();
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) PostMethod(org.apache.commons.httpclient.methods.PostMethod) HashMap(java.util.HashMap) AccessProfile(com.emc.storageos.plugins.AccessProfile) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Stat(com.emc.storageos.db.client.model.Stat) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) BigInteger(java.math.BigInteger) ArrayList(java.util.ArrayList) List(java.util.List) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) MoverNetStats(com.emc.nas.vnxfile.xmlapi.MoverNetStats) HashMap(java.util.HashMap) Map(java.util.Map) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

MoverNetStats (com.emc.nas.vnxfile.xmlapi.MoverNetStats)1 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 DbClient (com.emc.storageos.db.client.DbClient)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 Stat (com.emc.storageos.db.client.model.Stat)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 AccessProfile (com.emc.storageos.plugins.AccessProfile)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1