Martin Peřina has uploaded a new change for review.

Change subject: core: Unifies testing devices are bridges
......................................................................

core: Unifies testing devices are bridges

Utilizes VmDeviceCommonUtils.isBridge() on all places where testing if
device is a bridge.

Change-Id: I9ae36ff5055bf86ae25c14080920f4e72893d417
Signed-off-by: Martin Perina <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
3 files changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/59/18159/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
index 0504038..7a3bf14 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
@@ -977,8 +977,6 @@
     }
 
     private static boolean isDiskOrInterface(VmDevice vmDevice) {
-        return VmDeviceCommonUtils.isDisk(vmDevice) ||
-        (vmDevice.getDevice().equals(VmDeviceType.BRIDGE.getName())
-                && vmDevice.getType() == VmDeviceGeneralType.INTERFACE);
+        return VmDeviceCommonUtils.isDisk(vmDevice) || 
VmDeviceCommonUtils.isBridge(vmDevice);
     }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java
index 4ea0eee..d46c342 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceCommonUtils.java
@@ -38,6 +38,10 @@
                 && device.getDevice().equals(VmDeviceType.CDROM.getName());
     }
 
+    public static boolean isBridge(VmDevice device) {
+        return device.getType() == VmDeviceGeneralType.INTERFACE
+                && device.getDevice().equals(VmDeviceType.BRIDGE.getName());
+    }
     /**
      * updates given devices boot order
      *
@@ -135,9 +139,7 @@
      */
     private static int setNetworkBootOrder(List<VmDevice> devices, int 
bootOrder) {
         for (VmDevice device : devices) {
-            if (device.getType() == VmDeviceGeneralType.INTERFACE
-                    && device.getDevice().equals(
-                            VmDeviceType.BRIDGE.getName())) {
+            if (isBridge(device)) {
                 if (device.getIsPlugged()) {
                     device.setBootOrder(++bootOrder);
                 }
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
index 1e4884a..3dcfcc6 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
@@ -1209,9 +1209,7 @@
     }
 
     private boolean devicePluggable(VmDevice device) {
-        return VmDeviceCommonUtils.isDisk(device)
-                || (VmDeviceType.BRIDGE.getName().equals(device.getDevice())
-                && VmDeviceGeneralType.INTERFACE == device.getType());
+        return VmDeviceCommonUtils.isDisk(device) || 
VmDeviceCommonUtils.isBridge(device);
     }
 
     /**


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

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

Reply via email to