def _set_network_bridge(self, params): params['forward'] = {'mode': 'bridge'} # Bridges cannot be the trunk device of a VLAN iface = params['interfaces'][0] if 'vlan_id' in params and netinfo.is_bridge(iface): raise InvalidParameter('KCHNET0019E', {'name': iface}) # User specified bridge interface, simply use it self._ensure_iface_up(iface) params['ovs'] = False if netinfo.is_bridge(iface): params['bridge'] = iface if netinfo.is_ovs_bridge(iface): params['ovs'] = True # connection == macvtap and iface is not bridge elif netinfo.is_bare_nic(iface) or netinfo.is_bonding(iface): # libvirt bridge creation will fail with NetworkManager enabled if FeatureTests.is_nm_running(): raise InvalidParameter('KCHNET0027E') if 'vlan_id' in params: params['bridge'] = \ self._create_vlan_tagged_bridge(str(iface), str(params['vlan_id'])) else: # create Linux bridge interface and use it as actual iface iface = self._create_linux_bridge(iface) params['bridge'] = iface # unrecognized interface type: fail else: raise InvalidParameter("KCHNET0007E")
def _set_network_macvtap(self, params): iface = params['interfaces'][0] if ('vlan_id' in params or not (netinfo.is_bare_nic(iface) or netinfo.is_bonding(iface))): raise InvalidParameter('KCHNET0028E', {'name': iface}) # set macvtap network params['forward'] = {'mode': 'bridge', 'dev': iface}
def _set_network_multiple_interfaces(self, params): for iface in params['interfaces']: if 'vlan_id' in params or not ( netinfo.is_bare_nic(iface) or netinfo.is_bonding(iface) ): raise InvalidParameter('KCHNET0028E', {'name': iface}) params['forward'] = {'mode': params['connection'], 'devs': params['interfaces']}
def _set_network_multiple_interfaces(self, params): for iface in params['interfaces']: if ('vlan_id' in params or not (netinfo.is_bare_nic(iface) or netinfo.is_bonding(iface))): raise InvalidParameter('KCHNET0028E', {'name': iface}) params['forward'] = { 'mode': params["connection"], 'devs': params['interfaces'] }