Alona Kaplan has uploaded a new change for review.

Change subject: webadmin: Setup Network- default boot protocol wasn't none.
......................................................................

webadmin: Setup Network- default boot protocol wasn't none.

https://bugzilla.redhat.com/875724

When doing the following-
1. Opening the Setup Network Dialog.
1. Dragging "unattached", "non vlan" Network on a Nic.
2. Detaching the Network.
3. Attaching another "unattached", "non vlan" Network to the Nic.

Result- The default boot protocol of the network is empty- there is no
selected radio button.

Change-Id: Ie1d2d8525bcf20d9cd907b0c80a34bd82b1e4d9d
Signed-off-by: Alona Kaplan <alkap...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java
1 file changed, 31 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/94/9194/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java
index b726240..07bea25 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java
@@ -47,11 +47,20 @@
 
         NetworkParameters netParams = 
getSetupModel().getNetworkToLastDetachParams().get(getName());
 
-        if (netParams != null && !hasVlan()){
-            targetNic.getEntity().setBootProtocol(netParams.getBootProtocol());
-            targetNic.getEntity().setAddress(netParams.getAddress());
-            targetNic.getEntity().setSubnet(netParams.getSubnet());
-            targetNic.getEntity().setGateway(netParams.getGateway());
+        if (!hasVlan()) {
+            if (netParams != null) {
+                
targetNic.getEntity().setBootProtocol(netParams.getBootProtocol());
+                targetNic.getEntity().setAddress(netParams.getAddress());
+                targetNic.getEntity().setSubnet(netParams.getSubnet());
+                targetNic.getEntity().setGateway(netParams.getGateway());
+            } else {
+                if (!isManagement()) {
+                    
targetNic.getEntity().setBootProtocol(NetworkBootProtocol.None);
+                } else {
+                    
targetNic.getEntity().setBootProtocol(NetworkBootProtocol.Dhcp);
+                }
+
+            }
         }
 
         if (isManagement()) {
@@ -73,13 +82,17 @@
             bridge.setVdsId(targetNicEntity.getVdsId());
             bridge.setVdsName(targetNicEntity.getVdsName());
             bridge.setBridged(getEntity().isVmNetwork());
-            if (netParams != null){
+            if (netParams != null) {
                 bridge.setBootProtocol(netParams.getBootProtocol());
                 bridge.setAddress(netParams.getAddress());
                 bridge.setSubnet(netParams.getSubnet());
                 bridge.setGateway(netParams.getGateway());
-            }else{
-                bridge.setBootProtocol(NetworkBootProtocol.None);
+            } else {
+                if (!isManagement()) {
+                    bridge.setBootProtocol(NetworkBootProtocol.None);
+                } else {
+                    bridge.setBootProtocol(NetworkBootProtocol.Dhcp);
+                }
             }
             return bridge;
         } else {
@@ -92,7 +105,7 @@
 
     public void detach() {
         boolean syncNetworkValues = false;
-        if (!isInSync() && isManaged()){
+        if (!isInSync() && isManaged()) {
             getSetupModel().getNetworksToSync().add(getName());
             syncNetworkValues = true;
         }
@@ -107,17 +120,17 @@
         VdsNetworkInterface nicEntity = attachingNic.getEntity();
 
         NetworkParameters netParams = new NetworkParameters();
-        if (!hasVlan()){
+        if (!hasVlan()) {
             netParams.setBootProtocol(nicEntity.getBootProtocol());
             netParams.setAddress(nicEntity.getAddress());
             netParams.setSubnet(nicEntity.getSubnet());
-        }else{
+        } else {
             netParams.setBootProtocol(vlanNic.getEntity().getBootProtocol());
             netParams.setAddress(vlanNic.getEntity().getAddress());
             netParams.setSubnet(vlanNic.getEntity().getSubnet());
         }
 
-        if (isManagement()){
+        if (isManagement()) {
             netParams.setGateway(nicEntity.getGateway());
         }
 
@@ -137,7 +150,7 @@
             nicEntity.setType(0);
         }
 
-        if (syncNetworkValues){
+        if (syncNetworkValues) {
             syncNetworkValues();
         }
 
@@ -146,7 +159,7 @@
     private void syncNetworkValues() {
         DcNetworkParams dcNetParams = 
getSetupModel().getNetDcParams(getName());
 
-        if (dcNetParams != null){
+        if (dcNetParams != null) {
             getEntity().setvlan_id(dcNetParams.getVlanId());
             getEntity().setMtu(dcNetParams.getMtu());
             getEntity().setVmNetwork(dcNetParams.isVmNetwork());
@@ -210,19 +223,18 @@
         this.selected = selected;
     }
 
-
     public boolean isInSync() {
         NetworkImplementationDetails details = 
getNetworkImplementationDetails();
         return details != null ? details.isInSync() : true;
     }
 
-    public boolean isManaged(){
+    public boolean isManaged() {
         NetworkImplementationDetails details = 
getNetworkImplementationDetails();
-        return details != null? details.isManaged() : true;
+        return details != null ? details.isManaged() : true;
     }
 
-    public NetworkImplementationDetails getNetworkImplementationDetails(){
-        if (!isAttached()){
+    public NetworkImplementationDetails getNetworkImplementationDetails() {
+        if (!isAttached()) {
             return null;
         }
 


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

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

Reply via email to