Change in ovirt-engine[master]: restapi: Don't add host statistics by default

Code Review gerrit at ovirt.org
Wed Apr 5 15:41:13 UTC 2017


>From Juan Hernandez <juan.hernandez at redhat.com>:

Juan Hernandez has submitted this change and it was merged.

Change subject: restapi: Don't add host statistics by default
......................................................................


restapi: Don't add host statistics by default

In version 3 of the API the hosts used to have the statistics included
inline by default. For example a request like this:

  GET /ovirt-engine/api/hosts/123

Produced a response like this:

  <host id="123" href="/ovirt-engine/api/hosts/123">
    <name>myhost</name>
    ...
    <link rel="statistics" href="/ovirt-engine/api/hosts/123/statistics"/>
    ...
    <statistics>
      <statitstic id="..." href="...">
        <name>memory.total</name>
        <description>Total memory</description>
        ...
      </statistic>
      ...
    </statistics>
 </host>

For the collection of hosts the behaviour was sligthly different: the
statistics were included only if the 'detail' parameter was used to
request it:

  GET /ovirt-engine/api/hosts?detail=statistics

In version 4 of the API the support for this kind of aggregation, and
support for this 'detail' parameter was removed from almost all places,
except from hosts. This has a negative side effect in the SDKs: the XML
tag that contains the statistics doesn't contain a valid 'href'
attribute, and as a result the 'follow_link' method of the SDKs
generates an exception. The workaround for that is to check before
calling the 'follow_link' method. For example, in the Ruby SDK:

  statistics = connection.link?(host.statistics)
    ? connection.follow_link(host.statistics)
    : host.statistics

To avoid this abnormality in the API this patch removes this mechanism
from version 4 of the API, and moves it to the version 3 compatibility
layer.

Change-Id: I5aa6075195e1479746a063acb89f582efa006a14
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostsResource.java
A backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/helpers/V3HostHelper.java
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3HostServer.java
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/servers/V3HostsServer.java
M backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostResourceTest.java
M backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendHostsResourceTest.java
7 files changed, 66 insertions(+), 69 deletions(-)

Approvals:
  Piotr Kliczewski: Looks good to me, but someone else must approve
  Juan Hernandez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5aa6075195e1479746a063acb89f582efa006a14
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Boris Odnopozov <bodnopoz at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the Engine-commits mailing list