Search in sources :

Example 1 with VolumeStatsSetQueryParams

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

the class VNXFileArgsCreator method fetchVolumeStats.

/**
 * Create volume stats XML request query and returns a stream after marshalling.
 *
 * @param argument
 * @param keyMap
 * @param index
 * @return
 * @throws VNXFilePluginException
 */
@SuppressWarnings("unchecked")
public InputStream fetchVolumeStats(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
    _logger.info("Creating volume stats query");
    InputStream iStream = null;
    List<QueryStats> statList = new ArrayList<QueryStats>();
    try {
        Set<String> movers = (Set<String>) keyMap.get(VNXFileConstants.MOVERLIST);
        if (null != movers && !movers.isEmpty()) {
            for (String moverID : movers) {
                QueryStats queryStats = new QueryStats();
                VolumeStatsSetQueryParams params = new VolumeStatsSetQueryParams();
                params.setStatsSet(VolumeStatsSetType.ALL);
                params.setMover(moverID);
                queryStats.setVolumeStats(params);
                statList.add(queryStats);
            }
            iStream = _vnxFileInputRequestBuilder.getMultiRequestQueryStatsPacket(statList);
        } else {
            _logger.error("No movers found to construct volumeStats query.");
        }
    } catch (JAXBException jaxbException) {
        throw new VNXFilePluginException("Exception occurred while fetching fileSystem info", jaxbException.getCause());
    }
    return iStream;
}
Also used : FileSystemUsageSet(com.emc.nas.vnxfile.xmlapi.FileSystemUsageSet) Set(java.util.Set) QueryStats(com.emc.nas.vnxfile.xmlapi.QueryStats) InputStream(java.io.InputStream) JAXBException(javax.xml.bind.JAXBException) ArrayList(java.util.ArrayList) VolumeStatsSetQueryParams(com.emc.nas.vnxfile.xmlapi.VolumeStatsSetQueryParams)

Aggregations

FileSystemUsageSet (com.emc.nas.vnxfile.xmlapi.FileSystemUsageSet)1 QueryStats (com.emc.nas.vnxfile.xmlapi.QueryStats)1 VolumeStatsSetQueryParams (com.emc.nas.vnxfile.xmlapi.VolumeStatsSetQueryParams)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Set (java.util.Set)1 JAXBException (javax.xml.bind.JAXBException)1