Tomas Jelinek has uploaded a new change for review.

Change subject: frontend: handling clusters without DC in VM dialogs
......................................................................

frontend: handling clusters without DC in VM dialogs

There is a chance that there will be a cluster which does
not have a DC (e.g. the DC has been deleted but the cluster
was not). If this happened the UnitVmModel failed on NPE
for new/edit VM if some DC has been selected in the system
tree.

Fixed by ignoring this clusters in the cluster selection dialog.

Change-Id: Iab60c088d2299b9f7a9153e917c3a9ceaaa0e2fc
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=988018
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/17976/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
index 328acb2..b476810 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
@@ -1929,7 +1929,7 @@
                 new ArrayList<DataCenterWithCluster>();
 
         for (VDSGroup cluster : possibleClusters) {
-            if (cluster.getStoragePoolId().equals(dataCenter.getId())) {
+            if (cluster.getStoragePoolId() != null && 
cluster.getStoragePoolId().equals(dataCenter.getId())) {
                 dataCentersWithClusters.add(new 
DataCenterWithCluster(dataCenter, cluster));
             }
         }
@@ -1945,6 +1945,10 @@
 
         Map<Guid, List<VDSGroup>> dataCenterToCluster = new HashMap<Guid, 
List<VDSGroup>>();
         for (VDSGroup cluster : clusters) {
+            if (cluster.getStoragePoolId() == null) {
+                continue;
+            }
+
             if (!dataCenterToCluster.containsKey(cluster.getStoragePoolId())) {
                 dataCenterToCluster.put(cluster.getStoragePoolId(), new 
ArrayList<VDSGroup>());
             }
@@ -2006,6 +2010,10 @@
     }
 
     private StoragePool findDataCenterById(List<StoragePool> list, Guid id) {
+        if (id == null) {
+            return null;
+        }
+
         for (StoragePool dc : list) {
             if (dc.getId().equals(id)) {
                 return dc;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab60c088d2299b9f7a9153e917c3a9ceaaa0e2fc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <tjeli...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to