Merge "Fix update of network's segmentation id"
This commit is contained in:
commit
d35dd9c9c8
neutron
plugins/ml2
tests/unit/plugins/ml2/drivers
@ -279,6 +279,10 @@ class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase):
|
||||
def get_vif_details(self, context, agent, segment):
|
||||
return self.vif_details
|
||||
|
||||
def get_supported_vif_type(self, agent):
|
||||
"""Return supported vif type appropriate for the agent."""
|
||||
return self.vif_type
|
||||
|
||||
def get_vif_type(self, context, agent, segment):
|
||||
"""Return the vif type appropriate for the agent and segment."""
|
||||
return self.vif_type
|
||||
|
@ -132,11 +132,7 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||
return
|
||||
super(OpenvswitchMechanismDriver, self).bind_port(context)
|
||||
|
||||
def get_vif_type(self, context, agent, segment):
|
||||
if (context.current.get(portbindings.VNIC_TYPE) ==
|
||||
portbindings.VNIC_DIRECT):
|
||||
return portbindings.VIF_TYPE_OVS
|
||||
|
||||
def get_supported_vif_type(self, agent):
|
||||
caps = agent['configurations'].get('ovs_capabilities', {})
|
||||
if (any(x in caps.get('iface_types', []) for x
|
||||
in [a_const.OVS_DPDK_VHOST_USER,
|
||||
@ -146,6 +142,12 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||
return portbindings.VIF_TYPE_VHOST_USER
|
||||
return self.vif_type
|
||||
|
||||
def get_vif_type(self, context, agent, segment):
|
||||
if (context.current.get(portbindings.VNIC_TYPE) ==
|
||||
portbindings.VNIC_DIRECT):
|
||||
return portbindings.VIF_TYPE_OVS
|
||||
return self.get_supported_vif_type(agent)
|
||||
|
||||
def get_vhost_mode(self, iface_types):
|
||||
# NOTE(sean-k-mooney): this function converts the ovs vhost user
|
||||
# driver mode into the qemu vhost user mode. If OVS is the server,
|
||||
|
@ -846,8 +846,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
agents = self.get_agents(
|
||||
context, filters={'agent_type': [agent_type]})
|
||||
for agent in agents:
|
||||
vif_types.append(mech_driver.obj.get_vif_type(
|
||||
context, agent, segments[0]))
|
||||
vif_types.append(
|
||||
mech_driver.obj.get_supported_vif_type(agent))
|
||||
|
||||
filter_obj = obj_utils.NotIn(vif_types)
|
||||
filters = {portbindings.VIF_TYPE:
|
||||
|
@ -277,6 +277,9 @@ class TestMechanismDriverWithAgent(mech_agent.AgentMechanismDriverBase,
|
||||
self.bound_ports = set()
|
||||
self._agent_type = 'test_mechanism_driver_agent'
|
||||
|
||||
def get_supported_vif_type(self, agent):
|
||||
return VIF_TYPE_TEST
|
||||
|
||||
def get_vif_type(self, context, agent, segment):
|
||||
return VIF_TYPE_TEST
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user