Alon Bar-Lev has uploaded a new change for review.

Change subject: vdsm: bridge: support bridge over bond interface
......................................................................

vdsm: bridge: support bridge over bond interface

Change-Id: Iace6ca78e494811f91b9df94b5312a0518cfcf78
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M ChangeLog
M src/plugins/ovirt-host-deploy/vdsm/bridge.py
2 files changed, 33 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-host-deploy refs/changes/41/9741/1

diff --git a/ChangeLog b/ChangeLog
index e8e0efc..d929301 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,8 @@
 
  * legacy-removed: do not use mac address for vdsm id.
 
+ * legacy-change: support for management bridge creation over bond.
+
  * legacy-change: use optional /etc/vdsm/vdsm.id for vdsm id, for use by
    >=vdsm-4.9.6.
 
diff --git a/src/plugins/ovirt-host-deploy/vdsm/bridge.py 
b/src/plugins/ovirt-host-deploy/vdsm/bridge.py
index d4f5db3..b23ac79 100644
--- a/src/plugins/ovirt-host-deploy/vdsm/bridge.py
+++ b/src/plugins/ovirt-host-deploy/vdsm/bridge.py
@@ -282,6 +282,21 @@
             )
         )
 
+    def _interfacesOfBonding(self, name):
+        interfaces = []
+        with open(
+            os.path.join(
+                '/sys/class/net',
+                name,
+                'bonding/slaves',
+            ),
+            'r'
+        ) as f:
+            s = f.read().strip()
+            if s:
+                interfaces = s.split(' ')
+        return interfaces
+
     def _getInterfaceForDestination(self, address):
 
         self.logger.debug('determine interface for %s', address)
@@ -500,7 +515,18 @@
             self.services.state('firewalld', False)
         # WORKAROUND-END
 
+        bond = None
+
+        # resolve master vlan interface
         interface, vlanid = self._getVlanMasterDevice(name=interface)
+
+        # resolve bond interface
+        if self._interfaceIsBonding(name=interface):
+            bond = interface
+            interface = ','.join(
+                self._interfacesOfBonding(name=interface)
+            )
+
         parameters = parameters[:] + ['blockingdhcp=true']
         self.execute(
             (
@@ -511,7 +537,7 @@
                     ),
                     name,
                     util.getDefault(vlanid, ''),
-                    '',     # bonding is not supported
+                    util.getDefault(bond, ''),
                     util.getDefault(interface, ''),
                 ] +
                 parameters
@@ -711,25 +737,11 @@
                     install = False
 
             if install:
-                if self._interfaceIsBonding(name=interface):
-                    self._setIncomplete(
-                        _(
-                            'Management channel interface {interface} '
-                            'is bonding interface. Please configure manually '
-                            'bridge on this device with name {bridge}'
-                        ).format(
-                            interface=interface,
-                            bridge=self.environment[
-                                odeploycons.VdsmEnv.MANAGEMENT_BRIDGE_NAME
-                            ],
-                        )
-                    )
-                else:
-                    # this is here to raise exception
-                    # if any error we stop before performing change
-                    self._getVlanMasterDevice(name=interface)
+                # this is here to raise exception
+                # if any error we stop before performing change
+                self._getVlanMasterDevice(name=interface)
 
-                    self._active = True
+                self._active = True
 
     @plugin.event(
         stage=plugin.Stages.STAGE_MISC,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iace6ca78e494811f91b9df94b5312a0518cfcf78
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-host-deploy
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to