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();
}
}
Aggregations