Alona Kaplan has uploaded a new change for review.

Change subject: webadmin: Guide me- select host doesn't show all the needed 
hosts(#856504)
......................................................................

webadmin: Guide me- select host doesn't show all the needed hosts(#856504)

https://bugzilla.redhat.com/856504

- If a host is configured in one of the dc's clusters, all
the other clusters in the dc should show the host in their guide me-
select hosts.
- If there are clusters in the dc that their version is supported by a
host, the host should be in their select host list. (Until now, if
one of the clusters didn't support the host, the host wasn't shown in all
the dc clusters lists).

Change-Id: I6c28984f21a795c48e3c7fa4a9669ec269922337
Signed-off-by: Alona Kaplan <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
2 files changed, 10 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/8327/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
index 4a5acf0..628c1f0 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGuideModel.java
@@ -1,7 +1,6 @@
 package org.ovirt.engine.ui.uicommonweb.models.clusters;
 
 import java.util.ArrayList;
-import java.util.List;
 
 import org.ovirt.engine.core.common.action.AddVdsActionParameters;
 import org.ovirt.engine.core.common.action.ApproveVdsParameters;
@@ -67,7 +66,6 @@
 
     private ArrayList<VDS> hosts;
     private ArrayList<VDS> allHosts;
-    private ArrayList<VDSGroup> clusters;
     private VDS localStorageHost;
     private storage_pool dataCenter;
 
@@ -83,18 +81,6 @@
                         clusterGuideModel.UpdateOptionsNonLocalFS();
                     }
                 }), getEntity().getname());
-
-        AsyncDataProvider.GetClusterList(new AsyncQuery(this,
-                new INewAsyncCallback() {
-                    @Override
-                    public void OnSuccess(Object target, Object returnValue) {
-                        ClusterGuideModel clusterGuideModel = 
(ClusterGuideModel) target;
-                        ArrayList<VDSGroup> clusters = (ArrayList<VDSGroup>) 
returnValue;
-                        ;
-                        clusterGuideModel.clusters = clusters;
-                        clusterGuideModel.UpdateOptionsNonLocalFS();
-                    }
-                }), getEntity().getstorage_pool_id().getValue());
 
         AsyncDataProvider.GetHostList(new AsyncQuery(this,
                 new INewAsyncCallback() {
@@ -124,7 +110,7 @@
     }
 
     private void UpdateOptionsNonLocalFS() {
-        if (clusters == null || hosts == null || allHosts == null) {
+        if (hosts == null || allHosts == null) {
             return;
         }
 
@@ -158,9 +144,9 @@
         ArrayList<VDS> availableHosts = new ArrayList<VDS>();
         for (VDS vds : allHosts)
         {
-            if ((!Linq.IsHostBelongsToAnyOfClusters(clusters, vds))
+            if (!getEntity().getId().equals(vds.getvds_group_id())
                 && (vds.getstatus() == VDSStatus.Maintenance || 
vds.getstatus() == VDSStatus.PendingApproval)
-                && (vds.getVersion() == null || isHostSupported(clusters, 
vds)))
+                && 
vds.getSupportedClusterVersionsSet().contains(getEntity().getcompatibility_version()))
             {
                 availableHosts.add(vds);
             }
@@ -168,7 +154,7 @@
         // Select host action.
         UICommand selectHostAction = new UICommand("SelectHost", this); 
//$NON-NLS-1$
 
-        if (availableHosts.size() > 0 && clusters.size() > 0)
+        if (availableHosts.size() > 0)
         {
             if (hosts.isEmpty())
             {
@@ -183,15 +169,6 @@
         }
 
         StopProgress();
-    }
-
-    private boolean isHostSupported(List<VDSGroup> clusterList, VDS host){
-        for (VDSGroup cluster : clusterList){
-            if 
(!host.getSupportedClusterVersionsSet().contains(cluster.getcompatibility_version())){
-                return false;
-            }
-        }
-        return true;
     }
 
     private void UpdateOptionsLocalFS() {
@@ -252,7 +229,6 @@
     private void ResetData() {
         hosts = null;
         allHosts = null;
-        clusters = null;
         localStorageHost = null;
         dataCenter = null;
     }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
index 86debc9..9ca375c 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
@@ -276,14 +276,14 @@
         for (VDS vds : allHosts)
         {
             if (Linq.IsClusterItemExistInList(clusters, vds.getvds_group_id())
-                && (vds.getVersion() == null || isHostSupported(clusters, 
vds)))
+                && (vds.getVersion() == null || 
doesHostSupportAnyCluster(clusters, vds)))
             {
                 hosts.add(vds);
             }
 
             if ((!Linq.IsHostBelongsToAnyOfClusters(clusters, vds))
                 && (vds.getstatus() == VDSStatus.Maintenance || 
vds.getstatus() == VDSStatus.PendingApproval)
-                && (vds.getVersion() == null || isHostSupported(clusters, 
vds)))
+                && doesHostSupportAnyCluster(clusters, vds))
             {
                 availableHosts.add(vds);
             }
@@ -449,13 +449,13 @@
         StopProgress();
     }
 
-    private boolean isHostSupported(List<VDSGroup> clusterList, VDS host){
+    private boolean doesHostSupportAnyCluster(List<VDSGroup> clusterList, VDS 
host){
         for (VDSGroup cluster : clusterList){
-            if 
(!host.getSupportedClusterVersionsSet().contains(cluster.getcompatibility_version())){
-                return false;
+            if 
(host.getSupportedClusterVersionsSet().contains(cluster.getcompatibility_version())){
+                return true;
             }
         }
-        return true;
+        return false;
     }
 
     private void UpdateOptionsLocalFS() {


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

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

Reply via email to