Gilad Chaplik has uploaded a new change for review.

Change subject: core: fix for scheduling cluster custom properties
......................................................................

core: fix for scheduling cluster custom properties

problem: when adding scheduling custom property to a cluster
and the cluster policy doesn't have this custom policy set, it
will not be save.

fix: should compare the cluster's custom properties with avialable
custom properties and not with cluster policy custom properties.

Change-Id: I8d1a79b3406b577cd94e9f2e46defe7e3554d5a9
Signed-off-by: Gilad Chaplik <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
1 file changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/18569/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
index 1a66276..f666bfb 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsGroupOperationCommandBase.java
@@ -60,10 +60,11 @@
             }
             getVdsGroup().setClusterPolicyId(clusterPolicy.getId());
         }
-        updateClusterPolicyProperties(getVdsGroup(), clusterPolicy);
+        Map<String, String> customPropertiesRegexMap = 
SchedulingManager.getInstance()
+                .getCustomPropertiesRegexMap(clusterPolicy);
+        updateClusterPolicyProperties(getVdsGroup(), clusterPolicy, 
customPropertiesRegexMap);
         List<ValidationError> validationErrors =
-                
SimpleCustomPropertiesUtil.getInstance().validateProperties(SchedulingManager.getInstance()
-                        .getCustomPropertiesRegexMap(clusterPolicy),
+                
SimpleCustomPropertiesUtil.getInstance().validateProperties(customPropertiesRegexMap,
                         getVdsGroup().getClusterPolicyProperties());
         if (!validationErrors.isEmpty()) {
             
SimpleCustomPropertiesUtil.getInstance().handleCustomPropertiesError(validationErrors,
@@ -75,13 +76,15 @@
 
     /**
      * Updates cluster policy parameters map to contain all default cluster 
properties and remove properties that
-     * doesn't exist in the cluster policy.
+     * doesn't exist in the valid custom properties.
      *
      * @param cluster
      * @param clusterPolicy
+     * @param customPropertiesRegexMap
+     *            - custom properties for all policy unit in cluster policy
      */
     private void updateClusterPolicyProperties(VDSGroup cluster,
-            ClusterPolicy clusterPolicy) {
+            ClusterPolicy clusterPolicy, Map<String, String> 
customPropertiesRegexMap) {
         if (cluster.getClusterPolicyProperties() == null) {
             cluster.setClusterPolicyProperties(new LinkedHashMap<String, 
String>());
         }
@@ -94,7 +97,7 @@
                 }
             }
             for (String key : clusterPolicyProperties.keySet()) {
-                if (!clusterPolicy.getParameterMap().containsKey(key)) {
+                if (!customPropertiesRegexMap.containsKey(key)) {
                     toRemoveKeysList.add(key);
                 }
             }


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

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

Reply via email to