Hello Sergey Gotliv,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/36548

to review the following change.

Change subject: engine: Send net_ifacename to VDSM when connecting iSCSI server
......................................................................

engine: Send net_ifacename to VDSM when connecting iSCSI server

In order to properly configure iSCSI multipathing each iSCSI iface
should be related to the real network interface. Software iSCSI knows
how to relate iface to the network interface when all network interfaces
on that host reside on different subnets see [1].

However if multiple NICs reside on the same subnet iSCSI iface
configuration must contain a "iface.net_ifacename" representing a name
of the network layer interface, in case this network is bridged then it
should be a name of the bridge.

[1] http://www.open-iscsi.org/docs/README section 5.1.1.

Change-Id: I3e2f3549fa08741f719eeb8d70209ab298e09da3
Bug-Url: https://bugzilla.redhat.com/1112861
Signed-off-by: Sergey Gotliv <[email protected]>
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageServerConnections.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java
3 files changed, 24 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/36548/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
index b8fae9e..f199c33 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ISCSIStorageHelper.java
@@ -89,14 +89,15 @@
                     .getIscsiIfacesByHostIdAndStorageTargetId(vdsId, 
conn.getid());
 
             if (!ifaces.isEmpty()) {
-                conn.setIface(ifaces.remove(0).getName());
+                VdsNetworkInterface removedInterface = ifaces.remove(0);
+                setInterfaceProperties(conn, removedInterface);
 
                 // Iscsi target is represented by connection object, therefore 
if this target is approachable
                 // from more than one endpoint(initiator) we have to clone 
this connection per endpoint.
                 for (VdsNetworkInterface iface : ifaces) {
                     StorageServerConnections newConn = 
StorageServerConnections.copyOf(conn);
                     newConn.setid(Guid.newGuid().toString());
-                    newConn.setIface(iface.getName());
+                    setInterfaceProperties(newConn, iface);
                     res.add(newConn);
                 }
             }
@@ -105,6 +106,11 @@
         return res;
     }
 
+    private static void setInterfaceProperties(StorageServerConnections conn, 
VdsNetworkInterface iface) {
+        conn.setIface(iface.getName());
+        conn.setNetIfaceName(iface.isBridged() ? iface.getNetworkName() : 
iface.getName());
+    }
+
     @SuppressWarnings("unchecked")
     @Override
     protected List<StorageServerConnections> filterConnectionsUsedByOthers(
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageServerConnections.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageServerConnections.java
index dcca1e9..ebdce6b 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageServerConnections.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageServerConnections.java
@@ -189,6 +189,16 @@
         this.iface = iface;
     }
 
+    private String netIfaceName;
+
+    public String getNetIfaceName() {
+        return netIfaceName;
+    }
+
+    public void setNetIfaceName(String netIfaceName) {
+        this.netIfaceName = netIfaceName;
+    }
+
     @Override
     public boolean equals(Object obj) {
         boolean returnValue = super.equals(obj);
@@ -244,10 +254,14 @@
         sb.append(this.getNfsRetrans());
         sb.append(", nfsTimeo: ");
         sb.append(this.getNfsTimeo());
-        if (getIface() != null) {
+        if (this.getIface() != null) {
             sb.append(", iface: ");
             sb.append(this.getIface());
         }
+        if (getNetIfaceName() != null) {
+            sb.append(", netIfaceName: ");
+            sb.append(this.getNetIfaceName());
+        }
         sb.append(" };");
         return sb.toString();
     }
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java
index 16077cc..8602d44 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/ConnectStorageServerVDSCommand.java
@@ -79,6 +79,7 @@
         con.put("user", connection.getuser_name(), "");
         con.put("password", connection.getpassword(), "");
         con.putIfNotEmpty("ifaceName", connection.getIface());
+        con.putIfNotEmpty("netIfaceName", connection.getNetIfaceName());
 
         // storage_pool can be null when discovering iscsi send targets or 
when connecting
         // through vds which has no storage pool


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e2f3549fa08741f719eeb8d70209ab298e09da3
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Sergey Gotliv <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to