Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: handle bond and bridge interfaces
......................................................................

packaging: setup: handle bond and bridge interfaces

Previously all existing bond and bridge interfaces where
listed as possible nics for creating the management bridge.
If a bond interface was specified the bridge creation failed.

Now the bridge are not listed anymore and bonds are listed
only if they have slave interfaces.
If a bond interface with slaves is specified now should work
correctly.

Change-Id: If19dfa2c2b9b02ba8d997ad1758614fad3470eb5
Bug-Url: https://bugzilla.redhat.com/999577
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M ovirt-hosted-engine-setup.spec.in
M src/plugins/ovirt-hosted-engine-setup/network/bridge.py
2 files changed, 18 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/06/18406/1

diff --git a/ovirt-hosted-engine-setup.spec.in 
b/ovirt-hosted-engine-setup.spec.in
index 5cb5bc4..00387f0 100644
--- a/ovirt-hosted-engine-setup.spec.in
+++ b/ovirt-hosted-engine-setup.spec.in
@@ -43,6 +43,7 @@
 Requires:       vdsm >= 4.11.0
 Requires:       vdsm-cli >= 4.11.0
 Requires:       vdsm-gluster >= 4.11.0
+Requires:       vdsm-python >= 4.11.0
 Requires:       ovirt-host-deploy >= 1.1.0
 Requires:       openssh-server
 Requires:       virt-viewer
diff --git a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py 
b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
index cf0494f..7c4d2cd 100644
--- a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
+++ b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py
@@ -31,6 +31,7 @@
 
 from otopi import util
 from otopi import plugin
+from vdsm import netinfo
 
 
 from ovirt_hosted_engine_setup import constants as ohostedcons
@@ -101,6 +102,15 @@
             flags = ethtool.get_flags(nic)
             if flags & ethtool.IFF_LOOPBACK:
                 self.logger.debug('Detected loopback device %s' % nic)
+            elif ethtool.get_module(nic) == 'bridge':
+                self.logger.debug('Detected bridge device %s' % nic)
+            elif (
+                netinfo.isbonding(nic) and
+                not netinfo.slaves(nic)
+            ):
+                self.logger.debug(
+                    'Detected bond device %s without slaves' % nic
+                )
             else:
                 validValues.append(nic)
         if not validValues:
@@ -140,7 +150,11 @@
     )
     def _misc(self):
         self.logger.info(_('Configuring the management bridge'))
-        nic = self.environment[ohostedcons.NetworkEnv.BRIDGE_IF]
+        nics = self.environment[ohostedcons.NetworkEnv.BRIDGE_IF]
+        bond = ''
+        if netinfo.isbonding(nics):
+            bond = nics
+            nics = ','.join(netinfo.slaves(bond))
         bridge = self.environment[ohostedcons.NetworkEnv.BRIDGE_NAME]
         cmd = [self.command.get('vdsClient')]
         if self.environment[ohostedcons.VDSMEnv.USE_SSL]:
@@ -150,8 +164,8 @@
             'addNetwork',
             'bridge=%s' % bridge,
             'vlan=',
-            'bond=',
-            'nics=%s' % nic,
+            'bond=%s' % bond,
+            'nics=%s' % nics,
             'force=False',
             'bridged=True',
             'BOOTPROTO=dhcp',


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If19dfa2c2b9b02ba8d997ad1758614fad3470eb5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to