Change in ovirt-engine[master]: restapi: Fix cluster scheduling policy update

juan.hernandez at redhat.com juan.hernandez at redhat.com
Fri May 13 15:43:55 UTC 2016


Juan Hernandez has submitted this change and it was merged.

Change subject: restapi: Fix cluster scheduling policy update
......................................................................


restapi: Fix cluster scheduling policy update

Since version 3.5 the correct way to change the scheduling policy of a
cluster is to create/edit the policy object using the
/schedulingpolicies collection, and then assign the policy to the
cluster:

  PUT /clusters/{cluster:id}
  <cluster>
    <scheduling_policy id="123"/>
  </cluster>

For backwards compatibility we also need to support usage of the old
"policy" attribute instead of the "id":

  PUT /clusters/{cluster:id}
  <cluster>
    <scheduling_policy>
      <policy>power_saving</policy>
    </scheduling_policy>
  </cluster>

This has been implemented in the V3 compatibility layer. But some
clients are using a mix of the old and new mechanisms, using the "name"
attribute instead of "policy":

  PUT /clusters/{cluster:id}
  <cluster>
    <scheduling_policy>
      <name>power_saving</name>
    </scheduling_policy>
  </cluster>

In this case the V3 compatibility layer isn't using the backwards
compatibility layer, as the use of "name" isn't taken as indication of
an old client.

To handle this situation this patch changes the V3 compatibility layer
so that the attribute "name" can be used in the same way that "policy".

In addition the comparision of attributes used to select a compatible
scheduling policy doesn't take into account that the client may provide
an icomplete set of attributes. This patch fixes that as well.

Change-Id: I36e23b7109e12c63ce6579a216069fc75d9b3862
Bug-Url: https://bugzilla.redhat.com/1334098
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/v3/helpers/V3ClusterHelper.java
1 file changed, 19 insertions(+), 5 deletions(-)

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



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I36e23b7109e12c63ce6579a216069fc75d9b3862
Gerrit-PatchSet: 2
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: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list