Change in ovirt-engine[master]: restapi: Avoid empty statistic values

juan.hernandez at redhat.com juan.hernandez at redhat.com
Mon Feb 8 17:16:23 UTC 2016


Juan Hernandez has submitted this change and it was merged.

Change subject: restapi: Avoid empty statistic values
......................................................................


restapi: Avoid empty statistic values

Currently when the value returned by the backend for an statistic is
"null" the RESTAPI creates an "statistic" element with an empty "value"
inner element, like this:

  <statistic href="..." id="..">
    <name>data.total.tx</name>
    <description>Total transmitted data</description>
    <kind>COUNTER</kind>
    <type>INTEGER</type>
    <unit>BYTES</unit>
    <values>
      <value/>
    </values>
  </statistic>

This is contrary to the XML schema, as it specifies that the "value"
element should contain at least one "datum" element.

This patch fixes the API so that in these cases it will create an empty
"values" element instead:

  <statistic href="..." id="..">
    <name>data.total.tx</name>
    <description>Total transmitted data</description>
    <kind>COUNTER</kind>
    <type>INTEGER</type>
    <unit>BYTES</unit>
    <values/>
  </statistic>

Change-Id: I22090f89a608b6a2b3454191d55de38beeed2708
Bug-Url: https://bugzilla.redhat.com/1303346
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/utils/StatisticResourceUtils.java
1 file changed, 18 insertions(+), 5 deletions(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/52916
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I22090f89a608b6a2b3454191d55de38beeed2708
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Ori Liel <oliel at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list