Change in ovirt-engine-cli[master]: cli: Don't write integer statistics as float

juan.hernandez at redhat.com juan.hernandez at redhat.com
Mon May 12 07:35:56 UTC 2014


Juan Hernandez has submitted this change and it was merged.

Change subject: cli: Don't write integer statistics as float
......................................................................


cli: Don't write integer statistics as float

Currently when we write a an statistic value that is declared to be
integer we use the floating point representation used by default by
Python. This happens because all the statistics are represented as as
xs:decimal, regardless of their declared type, so the generateDS.py tool
converts them to float. This has the inconvenient that integer types are
displayed with a .0 suffix. For example:

  # show statistic memory.total --host-identifier myhost
  id                : 7816602b-c05c-3db7-a4da-3769f7ad8896
  name              : memory.total
  description       : Total memory
  host-id           : d3560912-f2ad-11e1-8f5f-001a4a169798
  type              : GAUGE
  unit              : BYTES
  values-type       : INTEGER
  values-value-datum: 33658241024.0

This patch changes the CLI so that it will convert statistics declared
as integer to Python long before rendering, so the .0 suffix will not be
present.

Change-Id: I21490ec50e3a7433331e981162de800c7d548f27
Bug-Url: https://bugzilla.redhat.com/855724
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M src/ovirtcli/format/text.py
1 file changed, 20 insertions(+), 8 deletions(-)

Approvals:
  Michael Pasternak: Looks good to me, approved
  Juan Hernandez: Verified



-- 
To view, visit http://gerrit.ovirt.org/26864
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I21490ec50e3a7433331e981162de800c7d548f27
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Michael Pasternak <mishka8520 at yahoo.com>
Gerrit-Reviewer: Ravi Nori <rnori at redhat.com>
Gerrit-Reviewer: automation at ovirt.org



More information about the Engine-commits mailing list