Lior Vernia has uploaded a new change for review.

Change subject: engine,webadmin: Minimize usage of "new VdsNetworkInterface()"
......................................................................

engine,webadmin: Minimize usage of "new VdsNetworkInterface()"

Tried to replace existing calls with calls to the more specific
subclasses. Remaining invocations (excluding test code) are an edge
case that can't be ruled out in InterfaceDaoDbFacadeImpl, and some
code that should be removed in the not-so-distant future in
HostSetupNetworksModel.

Change-Id: Ie00542f8af75fa3a0a7fde599f4260d7835005a0
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/network/LogicalNetworkModel.java
3 files changed, 8 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/14/36214/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
index 8681db7..4313c49 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
@@ -50,12 +50,15 @@
 import org.ovirt.engine.core.common.businessentities.VmPauseStatus;
 import org.ovirt.engine.core.common.businessentities.VmRngDevice;
 import org.ovirt.engine.core.common.businessentities.VmStatistics;
+import org.ovirt.engine.core.common.businessentities.network.Bond;
 import org.ovirt.engine.core.common.businessentities.network.InterfaceStatus;
 import org.ovirt.engine.core.common.businessentities.network.Network;
 import 
org.ovirt.engine.core.common.businessentities.network.NetworkBootProtocol;
+import org.ovirt.engine.core.common.businessentities.network.Nic;
 import org.ovirt.engine.core.common.businessentities.network.VdsInterfaceType;
 import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface;
 import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics;
+import org.ovirt.engine.core.common.businessentities.network.Vlan;
 import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
@@ -1327,7 +1330,7 @@
         Map<String, Object> bonds = (Map<String, Object>) 
xmlRpcStruct.get(VdsProperties.NETWORK_BONDINGS);
         if (bonds != null) {
             for (Entry<String, Object> entry : bonds.entrySet()) {
-                VdsNetworkInterface iface = new VdsNetworkInterface();
+                VdsNetworkInterface iface = new Bond();
                 VdsNetworkStatistics iStats = new VdsNetworkStatistics();
                 iface.setStatistics(iStats);
                 iStats.setId(Guid.newGuid());
@@ -1376,7 +1379,7 @@
         Map<String, Object> vlans = (Map<String, Object>) 
xmlRpcStruct.get(VdsProperties.NETWORK_VLANS);
         if (vlans != null) {
             for (Entry<String, Object> entry : vlans.entrySet()) {
-                VdsNetworkInterface iface = new VdsNetworkInterface();
+                VdsNetworkInterface iface = new Vlan();
                 VdsNetworkStatistics iStats = new VdsNetworkStatistics();
                 iface.setStatistics(iStats);
                 iStats.setId(Guid.newGuid());
@@ -1423,7 +1426,7 @@
         Map<String, Object> nics = (Map<String, Object>) 
xmlRpcStruct.get(VdsProperties.NETWORK_NICS);
         if (nics != null) {
             for (Entry<String, Object> entry : nics.entrySet()) {
-                VdsNetworkInterface iface = new VdsNetworkInterface();
+                VdsNetworkInterface iface = new Nic();
                 VdsNetworkStatistics iStats = new VdsNetworkStatistics();
                 iface.setStatistics(iStats);
                 iStats.setId(Guid.newGuid());
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java
index ed4cec8..0965ad6 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Cloner.java
@@ -18,7 +18,6 @@
 import org.ovirt.engine.core.common.businessentities.network.NetworkCluster;
 import org.ovirt.engine.core.common.businessentities.network.NetworkStatistics;
 import org.ovirt.engine.core.common.businessentities.network.ProviderNetwork;
-import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface;
 import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics;
 import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
 import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics;
@@ -28,7 +27,6 @@
 import org.ovirt.engine.core.compat.NotImplementedException;
 import org.ovirt.engine.core.compat.Version;
 
-@SuppressWarnings("unused")
 public final class Cloner
 {
     public static Object clone(Object instance)
@@ -76,10 +74,6 @@
         if (instance instanceof VmNetworkInterface)
         {
             return cloneVmNetworkInterface((VmNetworkInterface) instance);
-        }
-        if (instance instanceof VdsNetworkInterface)
-        {
-            return cloneVdsNetworkInterface((VdsNetworkInterface) instance);
         }
         if (instance instanceof VmStatic)
         {
@@ -532,27 +526,6 @@
 
         cloneNetworkStatisticss(instance, obj);
         obj.setVdsId(instance.getVdsId());
-
-        return obj;
-    }
-
-    private static Object cloneVdsNetworkInterface(VdsNetworkInterface 
vdsNetworkInterface)
-    {
-        VdsNetworkInterface obj = new VdsNetworkInterface();
-
-        obj.setAddress(vdsNetworkInterface.getAddress());
-        obj.setBonded(vdsNetworkInterface.getBonded());
-        obj.setBondName(vdsNetworkInterface.getBondName());
-        obj.setBondOptions(vdsNetworkInterface.getBondOptions());
-        obj.setBondType(vdsNetworkInterface.getBondType());
-        obj.setBootProtocol(vdsNetworkInterface.getBootProtocol());
-        obj.setGateway(vdsNetworkInterface.getGateway());
-        obj.setId(vdsNetworkInterface.getId());
-        obj.setMacAddress(vdsNetworkInterface.getMacAddress());
-        obj.setName(vdsNetworkInterface.getName());
-        obj.setNetworkName(vdsNetworkInterface.getNetworkName());
-        obj.setSpeed(vdsNetworkInterface.getSpeed());
-        
obj.setStatistics(cloneVdsNetworkStatistics(vdsNetworkInterface.getStatistics()));
 
         return obj;
     }
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 49dfcb1..27192d6 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
@@ -7,6 +7,7 @@
 import org.ovirt.engine.core.common.businessentities.network.NetworkStatus;
 import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface;
 import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface.NetworkImplementationDetails;
+import org.ovirt.engine.core.common.businessentities.network.Vlan;
 import org.ovirt.engine.ui.uicommonweb.models.hosts.DcNetworkParams;
 import org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterfaceListModel;
 import org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel;
@@ -62,7 +63,7 @@
 
         if (hasVlan()) {
             // create vlan bridge (eth0.1)
-            VdsNetworkInterface bridge = new VdsNetworkInterface();
+            VdsNetworkInterface bridge = new Vlan();
             bridge.setName(targetNic.getName() + "." + getVlanId()); 
//$NON-NLS-1$
             bridge.setNetworkName(getName());
             bridge.setBaseInterface(targetNic.getName());


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie00542f8af75fa3a0a7fde599f4260d7835005a0
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