use of org.ovirt.engine.core.common.businessentities.gluster.StatsInfo in project ovirt-engine by oVirt.
the class GlusterVolumeProfileInfoReturn method getStatInfo.
private StatsInfo getStatInfo(Map<String, Object> statsInfoMap, String statType) {
StatsInfo statsInfo = new StatsInfo();
int statsDuration = Integer.parseInt((String) statsInfoMap.get(DURATION));
statsInfo.setDuration(statsDuration);
Pair<Long, TimeUnit> statsDurationFormatted = TimeConverter.autoConvert(statsDuration, TimeUnit.SECONDS);
statsInfo.setDurationFormatted(new Pair<>(statsDurationFormatted.getFirst().intValue(), statsDurationFormatted.getSecond().toString()));
statsInfo.setTotalWrite(Long.parseLong((String) statsInfoMap.get(TOTAL_WRITE)));
statsInfo.setTotalRead(Long.parseLong((String) statsInfoMap.get(TOTAL_READ)));
statsInfo.setBlockStats(getBlockStats((Object[]) statsInfoMap.get(BLOCK_STATS)));
statsInfo.setFopStats(getFopStats((Object[]) statsInfoMap.get(FOP_STATS)));
statsInfo.setProfileStatsType(statType.equals(CUMULATIVE_STATS) ? ProfileStatsType.CUMULATIVE : ProfileStatsType.INTERVAL);
return statsInfo;
}
use of org.ovirt.engine.core.common.businessentities.gluster.StatsInfo in project ovirt-engine by oVirt.
the class GlusterVolumeProfileInfoReturn method prepareBrickProfileDetails.
private List<BrickProfileDetails> prepareBrickProfileDetails(GlusterVolumeEntity volume, Object[] brickProfileDetails) {
List<BrickProfileDetails> brickProfileDetailsList = new ArrayList<>();
for (Object brickProfileObj : brickProfileDetails) {
BrickProfileDetails brickProfileDetail = new BrickProfileDetails();
Map<String, Object> brickProfile = (Map<String, Object>) brickProfileObj;
GlusterBrickEntity brick = GlusterCoreUtil.getBrickByQualifiedName(volume.getBricks(), (String) brickProfile.get(BRICK));
if (brick != null) {
brickProfileDetail.setBrickId(brick.getId());
}
List<StatsInfo> statsInfo = new ArrayList<>();
statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(CUMULATIVE_STATS), CUMULATIVE_STATS));
statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(INTERVAL_STATS), INTERVAL_STATS));
brickProfileDetail.setProfileStats(statsInfo);
brickProfileDetailsList.add(brickProfileDetail);
}
return brickProfileDetailsList;
}
use of org.ovirt.engine.core.common.businessentities.gluster.StatsInfo in project ovirt-engine by oVirt.
the class GlusterVolumeProfileInfoMapper method mapProfileDetails.
private static void mapProfileDetails(List<StatsInfo> statsInfoList, EntityProfileDetail entityprofileDetail) {
for (StatsInfo statsInfo : statsInfoList) {
ProfileDetail profileDetail = new ProfileDetail();
profileDetail.setProfileType(statsInfo.getProfileStatsType().name());
profileDetail.setDuration(statsInfo.getDuration());
profileDetail.setStatistics(new Statistics());
profileDetail.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(TOTAL_READ), statsInfo.getTotalRead()));
profileDetail.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(TOTAL_WRITE), statsInfo.getTotalWrite()));
mapBlockStats(profileDetail, statsInfo);
mapFopStats(profileDetail, statsInfo);
entityprofileDetail.setProfileDetails(new ProfileDetails());
entityprofileDetail.getProfileDetails().getProfileDetails().add(profileDetail);
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.StatsInfo in project ovirt-engine by oVirt.
the class GetGlusterVolumeProfileInfoQueryTest method getStatsInfo.
private List<StatsInfo> getStatsInfo() {
StatsInfo statInfo = new StatsInfo();
statInfo.setDuration(2);
statInfo.setDurationFormatted(new Pair<>(2, TimeUnit.SECONDS.toString()));
statInfo.setTotalRead(0);
statInfo.setTotalWrite(0);
statInfo.setBlockStats(getBlockStats());
statInfo.setFopStats(getFopStats());
return Collections.singletonList(statInfo);
}
use of org.ovirt.engine.core.common.businessentities.gluster.StatsInfo in project ovirt-engine by oVirt.
the class GlusterVolumeProfileInfoReturn method prepareNfsProfileDetails.
private List<GlusterVolumeProfileStats> prepareNfsProfileDetails(Object[] nfsServerProfileDetails) {
List<GlusterVolumeProfileStats> nfsProfileDetails = new ArrayList<>();
for (Object nfsObject : nfsServerProfileDetails) {
GlusterVolumeProfileStats nfsDetails = new GlusterVolumeProfileStats();
Map<String, Object> nfsProfile = (Map<String, Object>) nfsObject;
nfsDetails.setIdentity((String) nfsProfile.get(NFS));
List<StatsInfo> statsInfo = new ArrayList<>();
statsInfo.add(getStatInfo((Map<String, Object>) nfsProfile.get(CUMULATIVE_STATS), CUMULATIVE_STATS));
statsInfo.add(getStatInfo((Map<String, Object>) nfsProfile.get(INTERVAL_STATS), INTERVAL_STATS));
nfsDetails.setProfileStats(statsInfo);
nfsProfileDetails.add(nfsDetails);
}
return nfsProfileDetails;
}
Aggregations