anmolbabu has uploaded a new change for review. Change subject: engine: TimeConversions in GlusterVolumeProfileInfoReturnForXmlRpc ......................................................................
engine: TimeConversions in GlusterVolumeProfileInfoReturnForXmlRpc Change-Id: I19065777b2cdd2b592677769ac23512f2c36b3d3 Signed-off-by: Anmol Babu <anb...@redhat.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/FopStats.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StatsInfo.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java 3 files changed, 55 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/45/27945/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/FopStats.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/FopStats.java index d076800..77332e6 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/FopStats.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/FopStats.java @@ -8,8 +8,27 @@ private String name; private int hits; private double avgLatency; + private String avgLatencyUnit; private double minLatency; + private String minLatencyUnit; private double maxLatency; + private String maxLatencyString; + + public String getMinLatencyUnit() { + return minLatencyUnit; + } + + public void setMinLatencyUnit(String minLatencyUnit) { + this.minLatencyUnit = minLatencyUnit; + } + + public String getMaxLatencyString() { + return maxLatencyString; + } + + public void setMaxLatencyString(String maxLatencyString) { + this.maxLatencyString = maxLatencyString; + } public String getName() { return name; @@ -50,4 +69,12 @@ public void setMaxLatency(double maxLatency) { this.maxLatency = maxLatency; } + + public String getAvgLatencyUnit() { + return avgLatencyUnit; + } + + public void setAvgLatencyUnit(String avgLatencyUnit) { + this.avgLatencyUnit = avgLatencyUnit; + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StatsInfo.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StatsInfo.java index d1221c5..96917e9 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StatsInfo.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/StatsInfo.java @@ -10,6 +10,7 @@ private List<BlockStats> blockStats; private List<FopStats> fopStats; private int duration; + private String durationUnit; private int totalRead; private int totalWrite; private ProfileStatsType profileStatsType; @@ -61,4 +62,12 @@ public void setProfileStatsType(ProfileStatsType profileStatsType) { this.profileStatsType = profileStatsType; } + + public String getDurationUnit() { + return durationUnit; + } + + public void setDurationUnit(String durationUnit) { + this.durationUnit = durationUnit; + } } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java index a91490a..187e1f3 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import org.ovirt.engine.core.common.businessentities.gluster.BlockStats; import org.ovirt.engine.core.common.businessentities.gluster.BrickProfileDetails; @@ -13,6 +14,8 @@ import org.ovirt.engine.core.common.businessentities.gluster.NfsProfileDetails; import org.ovirt.engine.core.common.businessentities.gluster.ProfileStatsType; import org.ovirt.engine.core.common.businessentities.gluster.StatsInfo; +import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.core.common.utils.TimeConverter; import org.ovirt.engine.core.common.utils.gluster.GlusterCoreUtil; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; @@ -112,7 +115,9 @@ private StatsInfo getStatInfo(Map<String, Object> statsInfoMap, String statType) { StatsInfo statsInfo = new StatsInfo(); - statsInfo.setDuration(Integer.valueOf((String) statsInfoMap.get(DURATION))); + Pair<Long, TimeUnit> statsDuration = new TimeConverter(Integer.valueOf((String) statsInfoMap.get(DURATION)), TimeUnit.SECONDS).autoConvert(); + statsInfo.setDuration(statsDuration.getFirst().intValue()); + statsInfo.setDurationUnit(statsDuration.getSecond().toString()); statsInfo.setTotalWrite(Integer.valueOf((String) statsInfoMap.get(TOTAL_WRITE))); statsInfo.setTotalRead(Integer.valueOf((String) statsInfoMap.get(TOTAL_READ))); statsInfo.setBlockStats(getBlockStats((Object[]) statsInfoMap.get(BLOCK_STATS))); @@ -129,9 +134,19 @@ Map<String, Object> fopStatsMap = (Map<String, Object>) fopStatsObj; fopStats.setHits(Integer.valueOf((String) fopStatsMap.get(HITS))); fopStats.setName((String) fopStatsMap.get(NAME)); - fopStats.setMinLatency(Double.valueOf((String) fopStatsMap.get(LATENCY_MIN))); - fopStats.setMaxLatency(Double.valueOf((String) fopStatsMap.get(LATENCY_MAX))); - fopStats.setAvgLatency(Double.valueOf((String) fopStatsMap.get(LATENCY_AVG))); + + Pair<Long, TimeUnit> minLatencyConverted = new TimeConverter(Long.valueOf((String) fopStatsMap.get(LATENCY_MIN)), TimeUnit.MICROSECONDS).autoConvert(); + fopStats.setMinLatency(minLatencyConverted.getFirst()); + fopStats.setMinLatencyUnit(minLatencyConverted.getSecond().toString()); + + Pair<Long, TimeUnit> maxLatencyConverted = new TimeConverter(Long.valueOf((String) fopStatsMap.get(LATENCY_MAX)), TimeUnit.MICROSECONDS).autoConvert(); + fopStats.setMaxLatency(maxLatencyConverted.getFirst()); + fopStats.setMaxLatencyString(maxLatencyConverted.getSecond().toString()); + + Pair<Long, TimeUnit> avgLatencyConverted = new TimeConverter(Long.valueOf((String) fopStatsMap.get(LATENCY_AVG)), TimeUnit.MICROSECONDS).autoConvert(); + fopStats.setAvgLatency(avgLatencyConverted.getFirst()); + fopStats.setAvgLatencyUnit(avgLatencyConverted.getSecond().toString()); + fopStatsList.add(fopStats); } return fopStatsList; -- To view, visit http://gerrit.ovirt.org/27945 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I19065777b2cdd2b592677769ac23512f2c36b3d3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <anb...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches