use of com.emc.nas.vnxfile.xmlapi.QueryStats in project coprhd-controller by CoprHD.
the class VNXFileArgsCreator method fetchFileSystemUsageStats.
/**
* create a FileSystemUsage XML request and returns a stream after marshalling.
*
* @param argument
* @param keyMap
* @param index
* @return
* @throws VNXFilePluginException
*/
public InputStream fetchFileSystemUsageStats(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
_logger.info("Creating filesystem usage query");
InputStream iStream = null;
try {
QueryStats queryStats = new QueryStats();
FileSystemUsageSet fsUsageSet = new FileSystemUsageSet();
queryStats.setFileSystemUsage(fsUsageSet);
iStream = _vnxFileInputRequestBuilder.getSingleQueryStatsPacket(queryStats);
} catch (JAXBException jaxbException) {
throw new VNXFilePluginException("Exception occurred while generating input xml for fileSystem usage info", jaxbException.getCause());
}
return iStream;
}
use of com.emc.nas.vnxfile.xmlapi.QueryStats in project coprhd-controller by CoprHD.
the class VNXFileArgsCreator method fetchMoverStats.
/**
* create Mover stats query and returns its stream after marshalling.
*
* @param argument
* @param keyMap
* @param index
* @return
* @throws VNXFilePluginException
*/
public InputStream fetchMoverStats(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
_logger.info("VNX Mover Stats query");
InputStream iStream = null;
List<QueryStats> statsList = 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();
MoverStatsSetQueryParams moverStatsSetQueryParams = new MoverStatsSetQueryParams();
moverStatsSetQueryParams.setStatsSet(MoverStatsSetType.NETWORK_DEVICES);
moverStatsSetQueryParams.setMover(moverID);
queryStats.setMoverStats(moverStatsSetQueryParams);
statsList.add(queryStats);
}
iStream = _vnxFileInputRequestBuilder.getMultiRequestQueryStatsPacket(statsList);
} else {
_logger.error("No movers found to construct volumeStats query.");
}
} catch (JAXBException jaxbException) {
throw new VNXFilePluginException("Exception occurred while generating input xml for celerra mover stats", jaxbException.getCause());
}
return iStream;
}
use of com.emc.nas.vnxfile.xmlapi.QueryStats 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;
}
use of com.emc.nas.vnxfile.xmlapi.QueryStats in project coprhd-controller by CoprHD.
the class VNXFileInputRequestBuilder method getMultiRequestQueryStatsPacket.
/**
* This method responsible to generate a multiple request packets
* for the given list of QueryStats.
*
* @param stats : list of QueryStats.
* @return : stream
*/
public InputStream getMultiRequestQueryStatsPacket(List<QueryStats> stats) throws JAXBException {
InputStream inputStream = null;
List<Request> requests = new ArrayList<Request>(stats.size());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
RequestPacket requestPacket = new RequestPacket();
try {
// Create a new Request object for each QueryStat
for (QueryStats querStat : stats) {
Request request = new Request();
request.setQueryStats(querStat);
requests.add(request);
}
requestPacket.getRequestOrRequestEx().addAll(requests);
_marshaller.marshal(requestPacket, outputStream);
inputStream = new ByteArrayInputStream(outputStream.toByteArray());
} finally {
try {
outputStream.close();
} catch (IOException e) {
_logger.error("IOException occurred while querying due to ", e);
}
}
return inputStream;
}
Aggregations