Tomas Jelinek has uploaded a new change for review. Change subject: restapi: migration progress ......................................................................
restapi: migration progress Enriches the statistics by the migration progres field. Change-Id: I4b65c756588aec9bfa1d1d36f74324d1b6d6f15a Bug-Url: https://bugzilla.redhat.com/1083049 Signed-off-by: Tomas Jelinek <[email protected]> --- M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java M backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java M backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmsResourceTest.java 3 files changed, 7 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/26828/1 diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java index 5d5bb30..176dbfb 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/VmStatisticalQuery.java @@ -15,6 +15,7 @@ private static final Statistic CPU_GUEST = create("cpu.current.guest", "CPU used by guest", GAUGE, PERCENT, DECIMAL); private static final Statistic CPU_OVERHEAD = create("cpu.current.hypervisor", "CPU overhead", GAUGE, PERCENT, DECIMAL); private static final Statistic CPU_TOTAL = create("cpu.current.total", "Total CPU used", GAUGE, PERCENT, DECIMAL); + private static final Statistic MIGRATION_PROGRESS = create("migration.progress", "Migration Progress", GAUGE, PERCENT, DECIMAL); protected VmStatisticalQuery(VM parent) { this(null, parent); @@ -35,7 +36,8 @@ setDatum(clone(MEM_USED), memUsedByCent/100), setDatum(clone(CPU_GUEST), cpuUser), setDatum(clone(CPU_OVERHEAD), cpuSys), - setDatum(clone(CPU_TOTAL), cpuUser + cpuSys)); + setDatum(clone(CPU_TOTAL), cpuUser + cpuSys), + setDatum(clone(MIGRATION_PROGRESS), entity.getMigrationProgressPercent())); } public Statistic adopt(Statistic statistic) { diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java index d6f0437..0bec2d2 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java @@ -915,8 +915,8 @@ List<Statistic> statistics = query.getStatistics(entity); verifyStatistics(statistics, new String[] {"memory.installed", "memory.used", "cpu.current.guest", - "cpu.current.hypervisor", "cpu.current.total"}, - new BigDecimal[] {asDec(10*Mb), asDec(2*Mb), asDec(30), asDec(40), asDec(70)}); + "cpu.current.hypervisor", "cpu.current.total", "migration.progress"}, + new BigDecimal[] {asDec(10*Mb), asDec(2*Mb), asDec(30), asDec(40), asDec(70), asDec(50)}); Statistic adopted = query.adopt(new Statistic()); assertTrue(adopted.isSetVm()); assertEquals(GUIDS[0].toString(), adopted.getVm().getId()); diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmsResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmsResourceTest.java index e8e8b40..8a6108f 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmsResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmsResourceTest.java @@ -99,6 +99,7 @@ vmStatistics.setusage_mem_percent(0); vmStatistics.setusage_network_percent(0); vm.setStatisticsData(vmStatistics); + vm.setMigrationProgressPercent(50); for (int i=0; i<GUIDS.length-1; i++) { setUpGetEntityExpectations(VdcQueryType.GetVmByVmId, IdQueryParameters.class, @@ -1351,6 +1352,7 @@ expect(statistics.getcpu_user()).andReturn(Double.valueOf(30L)).anyTimes(); expect(statistics.getcpu_sys()).andReturn(Double.valueOf(40L)).anyTimes(); expect(statistics.getusage_cpu_percent()).andReturn(50).anyTimes(); + expect(entity.getMigrationProgressPercent()).andReturn(50).anyTimes(); return entity; } -- To view, visit http://gerrit.ovirt.org/26828 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4b65c756588aec9bfa1d1d36f74324d1b6d6f15a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tomas Jelinek <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
