Search in sources :

Example 1 with Sample

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

the class VNXVolumeStatsProcessor method processVolumeSampleList.

/**
 * Process the each Volume sample list and inject
 * bwIn, bwOut for each fileshare. We also have a one-to-one
 * mapping between volume to Fileshare.
 *
 * @param sampleList : List of Sample objects of a volume
 * @param keyMap : keyMap
 * @param volFileMap : Volume-to-Fileshare Mapping
 * @param statsList : StatsList to update.
 */
private void processVolumeSampleList(List<Sample> sampleList, Map<String, Object> keyMap, Map<String, String> volFileMap, List<Stat> statsList) {
    Iterator<Sample> itemItr = sampleList.iterator();
    while (itemItr.hasNext()) {
        Sample volSample = itemItr.next();
        List<Item> volItems = volSample.getItem();
        Iterator<Item> volItemsItr = volItems.iterator();
        while (volItemsItr.hasNext()) {
            Item volItem = volItemsItr.next();
            if (volFileMap.containsKey(volItem.getVolume())) {
                String fileSystem = volFileMap.get(volItem.getVolume());
                // No filesystem found for volume then skip
                if (null != fileSystem) {
                    injectBWInOut(fileSystem, keyMap, volItem, statsList);
                }
            }
        }
    }
}
Also used : Item(com.emc.nas.vnxfile.xmlapi.VolumeSetStats.Sample.Item) Sample(com.emc.nas.vnxfile.xmlapi.VolumeSetStats.Sample)

Example 2 with Sample

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

the class VNXVolumeStatsProcessor method processResult.

@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final PostMethod result = (PostMethod) resultObj;
    _logger.info("processing volumeStats response" + resultObj);
    try {
        ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
        List<Object> volumeStats = getQueryStatsResponse(responsePacket);
        Iterator<Object> iterator = volumeStats.iterator();
        Map<String, String> volFileMap = (Map<String, String>) keyMap.get(VNXFileConstants.VOLFILESHAREMAP);
        List<Stat> statsList = (List<Stat>) keyMap.get(VNXFileConstants.STATS);
        // and proceed with rest of the Mover stats.
        while (iterator.hasNext()) {
            VolumeSetStats volStats = (VolumeSetStats) iterator.next();
            List<Sample> sampleList = volStats.getSample();
            processVolumeSampleList(sampleList, keyMap, volFileMap, statsList);
        }
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the volume stats response due to {}", ex.getMessage());
    } finally {
        result.releaseConnection();
    }
}
Also used : PostMethod(org.apache.commons.httpclient.methods.PostMethod) Sample(com.emc.nas.vnxfile.xmlapi.VolumeSetStats.Sample) VolumeSetStats(com.emc.nas.vnxfile.xmlapi.VolumeSetStats) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Stat(com.emc.storageos.db.client.model.Stat) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) List(java.util.List) Map(java.util.Map)

Aggregations

Sample (com.emc.nas.vnxfile.xmlapi.VolumeSetStats.Sample)2 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 VolumeSetStats (com.emc.nas.vnxfile.xmlapi.VolumeSetStats)1 Item (com.emc.nas.vnxfile.xmlapi.VolumeSetStats.Sample.Item)1 Stat (com.emc.storageos.db.client.model.Stat)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 List (java.util.List)1 Map (java.util.Map)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1