Sandro Bonazzola has uploaded a new change for review. Change subject: packaging: setup: bridge: support tagged VLANs ......................................................................
packaging: setup: bridge: support tagged VLANs Added support for tagged VLANs Change-Id: I0abd18b3ae36265406afb80a1ee082d2d14d4a92 Bug-Url: https://bugzilla.redhat.com/1072027 Bug-Url: https://bugzilla.redhat.com/1076944 Signed-off-by: Sandro Bonazzola <[email protected]> --- M src/plugins/ovirt-hosted-engine-setup/network/bridge.py 1 file changed, 45 insertions(+), 17 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup refs/changes/94/25894/1 diff --git a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py index befd04d..f819236 100644 --- a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py +++ b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py @@ -194,22 +194,44 @@ ) def _misc(self): self.logger.info(_('Configuring the management bridge')) - nics = self.environment[ohostedcons.NetworkEnv.BRIDGE_IF] - iface = nics - caps = self.environment[ + selected = self.environment[ohostedcons.NetworkEnv.BRIDGE_IF] + vds_caps = self.environment[ ohostedcons.VDSMEnv.VDS_CLI - ].s.getVdsCapabilities()['info']['nics'][nics] - self.logger.debug( - 'getVdsCaps for {iface}: {caps}'.format( - iface=iface, - caps=caps, + ].s.getVdsCapabilities()['info'] + nics_caps = vds_caps['nics'] + vlan_caps = vds_caps['vlans'] + + iface = selected + vlan = '' + caps = None + if selected in vlan_caps: + iface = vlan_caps[selected]['iface'] + vlan = vlan_caps[selected]['vlanid'] + caps = vlan_caps[selected] + self.logger.debug( + 'getVdsCaps for {iface}: {ncaps}; {vcaps}'.format( + iface=iface, + ncaps=nics_caps[iface], + vcaps=vlan_caps[selected], + ) ) - ) + else: + caps = nics_caps[selected] + self.logger.debug( + 'getVdsCaps for {iface}: {caps}'.format( + iface=iface, + caps=caps, + ) + ) bond = '' - if netinfo.isbonding(nics): - bond = nics - nics = ','.join(netinfo.slaves(bond)) + if netinfo.isbonding(iface): + bond = iface + iface = ','.join(netinfo.slaves(bond)) bridge = self.environment[ohostedcons.NetworkEnv.BRIDGE_NAME] + #TODO: try if implementing this with vdsmcli API still works: + # from vdsm import vdscli + # connection = vdscli.connect() + # connection.setupNetworks(...) cmd = [self.command.get('vdsClient')] if self.environment[ohostedcons.VDSMEnv.USE_SSL]: cmd.append('-s') @@ -217,15 +239,18 @@ 'localhost', 'addNetwork', 'bridge=%s' % bridge, - 'vlan=', + 'vlan=%s' % vlan, 'bond=%s' % bond, - 'nics=%s' % nics, + 'nics=%s' % iface, 'force=False', 'bridged=True', 'ONBOOT=yes', ] - boot_proto = caps['cfg']['BOOTPROTO'] - cmd += ['bootproto=%s' % boot_proto] + boot_proto = None + if 'BOOTPROTO' in caps['cfg']: + boot_proto = caps['cfg']['BOOTPROTO'] + cmd += ['bootproto=%s' % boot_proto] + if boot_proto in ('dhcp', 'bootp'): cmd += [ 'blockingdhcp=true', @@ -235,8 +260,11 @@ cmd += [ 'ipaddr=%s' % caps['addr'], 'netmask=%s' % caps['netmask'], - 'gateway=%s' % caps['cfg']['GATEWAY'], ] + if 'GATEWAY' in caps['cfg']: + cmd += [ + 'gateway=%s' % caps['cfg']['GATEWAY'], + ] self.execute( cmd, raiseOnError=True -- To view, visit http://gerrit.ovirt.org/25894 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0abd18b3ae36265406afb80a1ee082d2d14d4a92 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
