Revert "Use vif_type='tap' for LinuxBridge for consistency"
This reverts commit 1b987be2b5
.
This probably triggered a race between nova and l2 agent when
hot-detaching VIFs.
Change-Id: I2fc20666d43942446878da358ccf4472e04ad94c
Related-Bug: #1696125
This commit is contained in:
parent
8d9fcb2d30
commit
6ad51779f3
neutron
plugins/ml2/drivers/linuxbridge
tests/unit/plugins/ml2/drivers/linuxbridge
releasenotes/notes
@ -523,15 +523,25 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
|
|||||||
# inherit from the bridge its plugged into, which will be 1500
|
# inherit from the bridge its plugged into, which will be 1500
|
||||||
# at the time. See bug/1684326 for details.
|
# at the time. See bug/1684326 for details.
|
||||||
self._set_tap_mtu(tap_device_name, mtu)
|
self._set_tap_mtu(tap_device_name, mtu)
|
||||||
# Check if device needs to be added to bridge
|
# Avoid messing with plugging devices into a bridge that the agent
|
||||||
if not bridge_lib.BridgeDevice.get_interface_bridge(
|
# does not own
|
||||||
tap_device_name):
|
if not device_owner.startswith(constants.DEVICE_OWNER_COMPUTE_PREFIX):
|
||||||
|
# Check if device needs to be added to bridge
|
||||||
|
if not bridge_lib.BridgeDevice.get_interface_bridge(
|
||||||
|
tap_device_name):
|
||||||
|
data = {'tap_device_name': tap_device_name,
|
||||||
|
'bridge_name': bridge_name}
|
||||||
|
LOG.debug("Adding device %(tap_device_name)s to bridge "
|
||||||
|
"%(bridge_name)s", data)
|
||||||
|
if bridge_lib.BridgeDevice(bridge_name).addif(tap_device_name):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
data = {'tap_device_name': tap_device_name,
|
data = {'tap_device_name': tap_device_name,
|
||||||
|
'device_owner': device_owner,
|
||||||
'bridge_name': bridge_name}
|
'bridge_name': bridge_name}
|
||||||
LOG.debug("Adding device %(tap_device_name)s to bridge "
|
LOG.debug("Skip adding device %(tap_device_name)s to "
|
||||||
"%(bridge_name)s", data)
|
"%(bridge_name)s. It is owned by %(device_owner)s and "
|
||||||
if bridge_lib.BridgeDevice(bridge_name).addif(tap_device_name):
|
"thus added elsewhere.", data)
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _set_tap_mtu(self, tap_device_name, mtu):
|
def _set_tap_mtu(self, tap_device_name, mtu):
|
||||||
@ -768,8 +778,8 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
|
|||||||
|
|
||||||
def get_agent_configurations(self):
|
def get_agent_configurations(self):
|
||||||
configurations = {'bridge_mappings': self.bridge_mappings,
|
configurations = {'bridge_mappings': self.bridge_mappings,
|
||||||
'interface_mappings': self.interface_mappings,
|
'interface_mappings': self.interface_mappings
|
||||||
'wires_compute_ports': True}
|
}
|
||||||
if self.vxlan_mode != lconst.VXLAN_NONE:
|
if self.vxlan_mode != lconst.VXLAN_NONE:
|
||||||
configurations['tunneling_ip'] = self.local_ip
|
configurations['tunneling_ip'] = self.local_ip
|
||||||
configurations['tunnel_types'] = [p_const.TYPE_VXLAN]
|
configurations['tunnel_types'] = [p_const.TYPE_VXLAN]
|
||||||
|
@ -36,7 +36,7 @@ class LinuxbridgeMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
|||||||
sg_enabled = securitygroups_rpc.is_firewall_enabled()
|
sg_enabled = securitygroups_rpc.is_firewall_enabled()
|
||||||
super(LinuxbridgeMechanismDriver, self).__init__(
|
super(LinuxbridgeMechanismDriver, self).__init__(
|
||||||
constants.AGENT_TYPE_LINUXBRIDGE,
|
constants.AGENT_TYPE_LINUXBRIDGE,
|
||||||
portbindings.VIF_TYPE_TAP,
|
portbindings.VIF_TYPE_BRIDGE,
|
||||||
{portbindings.CAP_PORT_FILTER: sg_enabled})
|
{portbindings.CAP_PORT_FILTER: sg_enabled})
|
||||||
lb_qos_driver.register()
|
lb_qos_driver.register()
|
||||||
|
|
||||||
@ -50,13 +50,6 @@ class LinuxbridgeMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
|||||||
**agent['configurations'].get('bridge_mappings', {}))
|
**agent['configurations'].get('bridge_mappings', {}))
|
||||||
return mappings
|
return mappings
|
||||||
|
|
||||||
def get_vif_type(self, context, agent, segment):
|
|
||||||
# TODO(kevinbenton): remove this function after we no longer support
|
|
||||||
# Ocata agents
|
|
||||||
if not agent['configurations'].get('wires_compute_ports'):
|
|
||||||
return portbindings.VIF_TYPE_BRIDGE
|
|
||||||
return self.vif_type
|
|
||||||
|
|
||||||
def check_vlan_transparency(self, context):
|
def check_vlan_transparency(self, context):
|
||||||
"""Linuxbridge driver vlan transparency support."""
|
"""Linuxbridge driver vlan transparency support."""
|
||||||
return True
|
return True
|
||||||
|
@ -527,6 +527,15 @@ class TestLinuxBridgeManager(base.BaseTestCase):
|
|||||||
p_const.TYPE_VLAN, "physnet1", None, "tap1",
|
p_const.TYPE_VLAN, "physnet1", None, "tap1",
|
||||||
"foo", None)
|
"foo", None)
|
||||||
|
|
||||||
|
def test_add_tap_interface_owner_compute(self):
|
||||||
|
with mock.patch.object(ip_lib, "device_exists"):
|
||||||
|
with mock.patch.object(self.lbm, "ensure_local_bridge"):
|
||||||
|
self.assertTrue(self.lbm.add_tap_interface("123",
|
||||||
|
p_const.TYPE_LOCAL,
|
||||||
|
"physnet1", None,
|
||||||
|
"tap1",
|
||||||
|
"compute:1", None))
|
||||||
|
|
||||||
def _test_add_tap_interface(self, dev_owner_prefix):
|
def _test_add_tap_interface(self, dev_owner_prefix):
|
||||||
with mock.patch.object(ip_lib, "device_exists") as de_fn:
|
with mock.patch.object(ip_lib, "device_exists") as de_fn:
|
||||||
de_fn.return_value = False
|
de_fn.return_value = False
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
|
||||||
|
|
||||||
from neutron_lib.api.definitions import portbindings
|
from neutron_lib.api.definitions import portbindings
|
||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
|
|
||||||
@ -24,14 +22,13 @@ from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
|
|||||||
|
|
||||||
|
|
||||||
class LinuxbridgeMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
|
class LinuxbridgeMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
|
||||||
VIF_TYPE = portbindings.VIF_TYPE_TAP
|
VIF_TYPE = portbindings.VIF_TYPE_BRIDGE
|
||||||
CAP_PORT_FILTER = True
|
CAP_PORT_FILTER = True
|
||||||
AGENT_TYPE = constants.AGENT_TYPE_LINUXBRIDGE
|
AGENT_TYPE = constants.AGENT_TYPE_LINUXBRIDGE
|
||||||
|
|
||||||
GOOD_MAPPINGS = {'fake_physical_network': 'fake_interface'}
|
GOOD_MAPPINGS = {'fake_physical_network': 'fake_interface'}
|
||||||
GOOD_TUNNEL_TYPES = ['gre', 'vxlan']
|
GOOD_TUNNEL_TYPES = ['gre', 'vxlan']
|
||||||
GOOD_CONFIGS = {'wires_compute_ports': True,
|
GOOD_CONFIGS = {'interface_mappings': GOOD_MAPPINGS,
|
||||||
'interface_mappings': GOOD_MAPPINGS,
|
|
||||||
'tunnel_types': GOOD_TUNNEL_TYPES}
|
'tunnel_types': GOOD_TUNNEL_TYPES}
|
||||||
|
|
||||||
BAD_MAPPINGS = {'wrong_physical_network': 'wrong_interface'}
|
BAD_MAPPINGS = {'wrong_physical_network': 'wrong_interface'}
|
||||||
@ -81,11 +78,3 @@ class LinuxbridgeMechanismVlanTestCase(LinuxbridgeMechanismBaseTestCase,
|
|||||||
class LinuxbridgeMechanismGreTestCase(LinuxbridgeMechanismBaseTestCase,
|
class LinuxbridgeMechanismGreTestCase(LinuxbridgeMechanismBaseTestCase,
|
||||||
base.AgentMechanismGreTestCase):
|
base.AgentMechanismGreTestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class LegacyLinuxbridgeMechanismTestCase(LinuxbridgeMechanismBaseTestCase,
|
|
||||||
base.AgentMechanismVlanTestCase):
|
|
||||||
"""An old agent doesn't wire compute ports so it needs VIF_TYPE_BRIDGE."""
|
|
||||||
VIF_TYPE = portbindings.VIF_TYPE_BRIDGE
|
|
||||||
AGENTS = copy.deepcopy(LinuxbridgeMechanismBaseTestCase.AGENTS)
|
|
||||||
AGENTS[0]['configurations'].pop('wires_compute_ports')
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
prelude: >
|
|
||||||
The Linux Bridge driver now informs Nova to use the 'tap' interface type
|
|
||||||
to wire interfaces. This requires '/dev/net/tun' to be added to the
|
|
||||||
'cgroup_device_acl' in 'qemu.conf' before upgrading.
|
|
||||||
upgrade:
|
|
||||||
- |
|
|
||||||
The Linux Bridge driver now informs Nova to use the 'tap' interface type
|
|
||||||
to wire interfaces. This requires '/dev/net/tun' to be added to the
|
|
||||||
'cgroup_device_acl' in 'qemu.conf' before upgrading.
|
|
Loading…
Reference in New Issue
Block a user