Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Fixed bond-related flows in Setup Networks
......................................................................

webadmin: Fixed bond-related flows in Setup Networks

Previously the free bonds on a host were queried every time the Setup
Networks dialog was redrawn, where they could in fact only change when
backend data was retrieved. Moreover, the computation of the next free
bond name was performed by mistake several times whenever the dialog
was redrawn, instead of just once.

Change-Id: I9eacb27404eca28bb890973545f08fec9b983c4e
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
1 file changed, 17 insertions(+), 14 deletions(-)


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

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
index 2d3f1d4..ee32404 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
@@ -469,7 +469,6 @@
 
     protected void onNicsChanged() {
         operationFactory = new NetworkOperationFactory(getNetworks(), 
getNics());
-        queryFreeBonds();
         validate();
         getNetworksChangedEvent().raise(this, EventArgs.EMPTY);
     }
@@ -608,17 +607,17 @@
                     netToBeforeSyncParams.put(networkName, new 
NetworkParameters(nic));
                 }
             }
+        }
 
-            // calculate the next available bond name
-            List<String> bondNames = new ArrayList<String>(bondToNic.keySet());
-            Collections.sort(bondNames, new LexoNumericComparator());
-            nextBondName = BusinessEntitiesDefinitions.BOND_NAME_PREFIX + 0;
-            for (int i=0; i<bondNames.size(); ++i) {
-                if (nextBondName.equals(bondNames.get(i))) {
-                    nextBondName = 
BusinessEntitiesDefinitions.BOND_NAME_PREFIX + (i + 1);
-                } else {
-                    break;
-                }
+        // calculate the next available bond name
+        List<String> bondNames = new ArrayList<String>(bondToNic.keySet());
+        Collections.sort(bondNames, new LexoNumericComparator());
+        nextBondName = BusinessEntitiesDefinitions.BOND_NAME_PREFIX + 0;
+        for (int i=0; i<bondNames.size(); ++i) {
+            if (nextBondName.equals(bondNames.get(i))) {
+                nextBondName = BusinessEntitiesDefinitions.BOND_NAME_PREFIX + 
(i + 1);
+            } else {
+                break;
             }
         }
 
@@ -659,7 +658,7 @@
     }
 
     private void queryFreeBonds() {
-        // query for all bonds on the host
+        // query for all unused, existing bonds on the host
         AsyncQuery asyncQuery = new AsyncQuery();
         asyncQuery.setModel(this);
         asyncQuery.asyncCallback = new INewAsyncCallback() {
@@ -669,6 +668,9 @@
                 List<VdsNetworkInterface> bonds =
                         (List<VdsNetworkInterface>) ((VdcQueryReturnValue) 
returnValue).getReturnValue();
                 allBonds = bonds;
+
+                initNicModels();
+                stopProgress();
             }
         };
 
@@ -688,8 +690,9 @@
                 Object returnValue2 = returnValue.getReturnValue();
                 List<VdsNetworkInterface> allNics = 
(List<VdsNetworkInterface>) returnValue2;
                 HostSetupNetworksModel.this.allNics = allNics;
-                initNicModels();
-                stopProgress();
+
+                // chain the free bonds query
+                queryFreeBonds();
             }
         };
 


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

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

Reply via email to