Search in sources :

Example 1 with StatsInfo

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;
}
Also used : StatsInfo(org.ovirt.engine.core.common.businessentities.gluster.StatsInfo) TimeUnit(java.util.concurrent.TimeUnit)

Example 2 with 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;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) StatsInfo(org.ovirt.engine.core.common.businessentities.gluster.StatsInfo) BrickProfileDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickProfileDetails) ArrayList(java.util.ArrayList) Map(java.util.Map)

Example 3 with StatsInfo

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);
    }
}
Also used : StatsInfo(org.ovirt.engine.core.common.businessentities.gluster.StatsInfo) BrickProfileDetail(org.ovirt.engine.api.model.BrickProfileDetail) NfsProfileDetail(org.ovirt.engine.api.model.NfsProfileDetail) ProfileDetail(org.ovirt.engine.api.model.ProfileDetail) EntityProfileDetail(org.ovirt.engine.api.model.EntityProfileDetail) BlockStatistics(org.ovirt.engine.api.model.BlockStatistics) Statistics(org.ovirt.engine.api.model.Statistics) FopStatistics(org.ovirt.engine.api.model.FopStatistics) BrickProfileDetails(org.ovirt.engine.api.model.BrickProfileDetails) GlusterVolumeProfileDetails(org.ovirt.engine.api.model.GlusterVolumeProfileDetails) NfsProfileDetails(org.ovirt.engine.api.model.NfsProfileDetails) ProfileDetails(org.ovirt.engine.api.model.ProfileDetails)

Example 4 with StatsInfo

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);
}
Also used : StatsInfo(org.ovirt.engine.core.common.businessentities.gluster.StatsInfo)

Example 5 with StatsInfo

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;
}
Also used : StatsInfo(org.ovirt.engine.core.common.businessentities.gluster.StatsInfo) ArrayList(java.util.ArrayList) GlusterVolumeProfileStats(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileStats) Map(java.util.Map)

Aggregations

StatsInfo (org.ovirt.engine.core.common.businessentities.gluster.StatsInfo)7 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 BrickProfileDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickProfileDetails)2 GlusterVolumeProfileStats (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileStats)2 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)2 TimeUnit (java.util.concurrent.TimeUnit)1 BlockStatistics (org.ovirt.engine.api.model.BlockStatistics)1 BrickProfileDetail (org.ovirt.engine.api.model.BrickProfileDetail)1 BrickProfileDetails (org.ovirt.engine.api.model.BrickProfileDetails)1 EntityProfileDetail (org.ovirt.engine.api.model.EntityProfileDetail)1 FopStatistics (org.ovirt.engine.api.model.FopStatistics)1 GlusterVolumeProfileDetails (org.ovirt.engine.api.model.GlusterVolumeProfileDetails)1 NfsProfileDetail (org.ovirt.engine.api.model.NfsProfileDetail)1 NfsProfileDetails (org.ovirt.engine.api.model.NfsProfileDetails)1 ProfileDetail (org.ovirt.engine.api.model.ProfileDetail)1 ProfileDetails (org.ovirt.engine.api.model.ProfileDetails)1 Statistics (org.ovirt.engine.api.model.Statistics)1 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)1