Gilad Chaplik has uploaded a new change for review.

Change subject: restapi: fix cluster's schedulingpolicy back-compat
......................................................................

restapi: fix cluster's schedulingpolicy back-compat

Ignores old (still supported) behavior (thresholds).

Change-Id: I4a5fa4d95bc55bed36d800532b81eb4340e4083d
Bug-Url: https://bugzilla.redhat.com/1118384
Signed-off-by: Gilad Chaplik <[email protected]>
---
M 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/42/30042/1

diff --git 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
index 6c4579e..22e7f0f 100644
--- 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
+++ 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/ClusterMapper.java
@@ -198,11 +198,13 @@
     @Mapping(from = SchedulingPolicy.class, to = VDSGroup.class)
     public static VDSGroup map(SchedulingPolicy model, VDSGroup template) {
         VDSGroup entity = template != null ? template : new VDSGroup();
-        if (model.isSetId()) {
-            entity.setClusterPolicyId(GuidUtils.asGuid(model.getId()));
-        }
         if (model.isSetPolicy() || model.isSetName()) {
             entity.setClusterPolicyName(model.isSetName() ? model.getName() : 
model.getPolicy());
+            entity.setClusterPolicyId(null);
+        }
+        // id will override name
+        if (model.isSetId()) {
+            entity.setClusterPolicyId(GuidUtils.asGuid(model.getId()));
         }
         if (model.isSetThresholds()) {
             SchedulingPolicyThresholds thresholds = model.getThresholds();
@@ -220,6 +222,10 @@
                 
entity.getClusterPolicyProperties().put(CPU_OVER_COMMIT_DURATION_MINUTES, 
Integer.toString(round));
             }
         }
+        // properties will override thresholds
+        if (model.isSetProperties()) {
+            
entity.setClusterPolicyProperties(CustomPropertiesParser.toMap(model.getProperties()));
+        }
         return entity;
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a5fa4d95bc55bed36d800532b81eb4340e4083d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Gilad Chaplik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to