Use the "connectivity" property of "MechanismDriver"
The base class "MechanismDriver" now has a property called "connectivity". This patch overrides the default value in the in-tree drivers. The method "_check_drivers_connectivity" now uses this property that is available in all drivers. Depends-On: https://review.opendev.org/c/openstack/neutron-lib/+/826501 Closes-Bug: #1959125 bp boot-vm-with-unaddressed-port Related-Bug: #1821058 Change-Id: I91734835b07d804365b46adfb26e984557107d80
This commit is contained in:
parent
9acaaf636e
commit
0fe6c0b8ca
|
@ -35,13 +35,17 @@ class LinuxbridgeMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||||
sg_enabled = securitygroups_rpc.is_firewall_enabled()
|
sg_enabled = securitygroups_rpc.is_firewall_enabled()
|
||||||
vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled,
|
vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled,
|
||||||
portbindings.VIF_DETAILS_CONNECTIVITY:
|
portbindings.VIF_DETAILS_CONNECTIVITY:
|
||||||
portbindings.CONNECTIVITY_L2}
|
self.connectivity}
|
||||||
super(LinuxbridgeMechanismDriver, self).__init__(
|
super(LinuxbridgeMechanismDriver, self).__init__(
|
||||||
constants.AGENT_TYPE_LINUXBRIDGE,
|
constants.AGENT_TYPE_LINUXBRIDGE,
|
||||||
portbindings.VIF_TYPE_BRIDGE,
|
portbindings.VIF_TYPE_BRIDGE,
|
||||||
vif_details)
|
vif_details)
|
||||||
lb_qos_driver.register()
|
lb_qos_driver.register()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connectivity(self):
|
||||||
|
return portbindings.CONNECTIVITY_L2
|
||||||
|
|
||||||
def get_allowed_network_types(self, agent):
|
def get_allowed_network_types(self, agent):
|
||||||
return (agent['configurations'].get('tunnel_types', []) +
|
return (agent['configurations'].get('tunnel_types', []) +
|
||||||
[constants.TYPE_LOCAL, constants.TYPE_FLAT,
|
[constants.TYPE_LOCAL, constants.TYPE_FLAT,
|
||||||
|
|
|
@ -40,12 +40,16 @@ class MacvtapMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
vif_details = {portbindings.CAP_PORT_FILTER: False,
|
vif_details = {portbindings.CAP_PORT_FILTER: False,
|
||||||
portbindings.VIF_DETAILS_CONNECTIVITY:
|
portbindings.VIF_DETAILS_CONNECTIVITY:
|
||||||
portbindings.CONNECTIVITY_L2}
|
self.connectivity}
|
||||||
super(MacvtapMechanismDriver, self).__init__(
|
super(MacvtapMechanismDriver, self).__init__(
|
||||||
constants.AGENT_TYPE_MACVTAP,
|
constants.AGENT_TYPE_MACVTAP,
|
||||||
portbindings.VIF_TYPE_MACVTAP,
|
portbindings.VIF_TYPE_MACVTAP,
|
||||||
vif_details)
|
vif_details)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connectivity(self):
|
||||||
|
return portbindings.CONNECTIVITY_L2
|
||||||
|
|
||||||
def get_allowed_network_types(self, agent):
|
def get_allowed_network_types(self, agent):
|
||||||
return [constants.TYPE_FLAT, constants.TYPE_VLAN]
|
return [constants.TYPE_FLAT, constants.TYPE_VLAN]
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ class SimpleAgentMechanismDriverBase(AgentMechanismDriverBase,
|
||||||
self.supported_vnic_types, vnic_type_prohibit_list)
|
self.supported_vnic_types, vnic_type_prohibit_list)
|
||||||
self.vif_type = vif_type
|
self.vif_type = vif_type
|
||||||
self.vif_details = {portbindings.VIF_DETAILS_CONNECTIVITY:
|
self.vif_details = {portbindings.VIF_DETAILS_CONNECTIVITY:
|
||||||
portbindings.CONNECTIVITY_LEGACY}
|
self.connectivity}
|
||||||
self.vif_details.update(vif_details)
|
self.vif_details.update(vif_details)
|
||||||
|
|
||||||
def try_to_bind_segment_for_agent(self, context, segment, agent):
|
def try_to_bind_segment_for_agent(self, context, segment, agent):
|
||||||
|
|
|
@ -69,7 +69,7 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||||
agent_type = constants.AGENT_TYPE_NIC_SWITCH
|
agent_type = constants.AGENT_TYPE_NIC_SWITCH
|
||||||
vif_details = {portbindings.CAP_PORT_FILTER: False,
|
vif_details = {portbindings.CAP_PORT_FILTER: False,
|
||||||
portbindings.VIF_DETAILS_CONNECTIVITY:
|
portbindings.VIF_DETAILS_CONNECTIVITY:
|
||||||
portbindings.CONNECTIVITY_L2}
|
self.connectivity}
|
||||||
supported_vnic_types = SRIOV_SUPPORTED_VNIC_TYPES
|
supported_vnic_types = SRIOV_SUPPORTED_VNIC_TYPES
|
||||||
prohibit_list = cfg.CONF.SRIOV_DRIVER.vnic_type_prohibit_list
|
prohibit_list = cfg.CONF.SRIOV_DRIVER.vnic_type_prohibit_list
|
||||||
super().__init__(agent_type, None, vif_details,
|
super().__init__(agent_type, None, vif_details,
|
||||||
|
@ -85,6 +85,10 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||||
self.vif_details = vif_details
|
self.vif_details = vif_details
|
||||||
sriov_qos_driver.register()
|
sriov_qos_driver.register()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connectivity(self):
|
||||||
|
return portbindings.CONNECTIVITY_L2
|
||||||
|
|
||||||
def get_allowed_network_types(self, agent):
|
def get_allowed_network_types(self, agent):
|
||||||
return (constants.TYPE_FLAT, constants.TYPE_VLAN)
|
return (constants.TYPE_FLAT, constants.TYPE_VLAN)
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||||
sg_enabled = securitygroups_rpc.is_firewall_enabled()
|
sg_enabled = securitygroups_rpc.is_firewall_enabled()
|
||||||
vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled,
|
vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled,
|
||||||
portbindings.VIF_DETAILS_CONNECTIVITY:
|
portbindings.VIF_DETAILS_CONNECTIVITY:
|
||||||
portbindings.CONNECTIVITY_L2}
|
self.connectivity}
|
||||||
# NOTE(moshele): Bind DIRECT (SR-IOV) port allows
|
# NOTE(moshele): Bind DIRECT (SR-IOV) port allows
|
||||||
# to offload the OVS flows using tc to the SR-IOV NIC.
|
# to offload the OVS flows using tc to the SR-IOV NIC.
|
||||||
# We are using OVS mechanism driver because the openvswitch (>=2.8.0)
|
# We are using OVS mechanism driver because the openvswitch (>=2.8.0)
|
||||||
|
@ -80,6 +80,10 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||||
ovs_qos_driver.register()
|
ovs_qos_driver.register()
|
||||||
log_driver.register()
|
log_driver.register()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connectivity(self):
|
||||||
|
return portbindings.CONNECTIVITY_L2
|
||||||
|
|
||||||
def get_allowed_network_types(self, agent):
|
def get_allowed_network_types(self, agent):
|
||||||
return (agent['configurations'].get('tunnel_types', []) +
|
return (agent['configurations'].get('tunnel_types', []) +
|
||||||
[constants.TYPE_LOCAL, constants.TYPE_FLAT,
|
[constants.TYPE_LOCAL, constants.TYPE_FLAT,
|
||||||
|
|
|
@ -194,19 +194,21 @@ class OVNMechanismDriver(api.MechanismDriver):
|
||||||
self.vif_details = {
|
self.vif_details = {
|
||||||
portbindings.VIF_TYPE_OVS: {
|
portbindings.VIF_TYPE_OVS: {
|
||||||
portbindings.CAP_PORT_FILTER: self.sg_enabled,
|
portbindings.CAP_PORT_FILTER: self.sg_enabled,
|
||||||
portbindings.VIF_DETAILS_CONNECTIVITY:
|
portbindings.VIF_DETAILS_CONNECTIVITY: self.connectivity,
|
||||||
portbindings.CONNECTIVITY_L2,
|
|
||||||
},
|
},
|
||||||
portbindings.VIF_TYPE_VHOST_USER: {
|
portbindings.VIF_TYPE_VHOST_USER: {
|
||||||
portbindings.CAP_PORT_FILTER: False,
|
portbindings.CAP_PORT_FILTER: False,
|
||||||
portbindings.VHOST_USER_MODE:
|
portbindings.VHOST_USER_MODE:
|
||||||
portbindings.VHOST_USER_MODE_SERVER,
|
portbindings.VHOST_USER_MODE_SERVER,
|
||||||
portbindings.VHOST_USER_OVS_PLUG: True,
|
portbindings.VHOST_USER_OVS_PLUG: True,
|
||||||
portbindings.VIF_DETAILS_CONNECTIVITY:
|
portbindings.VIF_DETAILS_CONNECTIVITY: self.connectivity,
|
||||||
portbindings.CONNECTIVITY_L2,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connectivity(self):
|
||||||
|
return portbindings.CONNECTIVITY_L2
|
||||||
|
|
||||||
def supported_extensions(self, extensions):
|
def supported_extensions(self, extensions):
|
||||||
return set(ovn_extensions.ML2_SUPPORTED_API_EXTENSIONS) & extensions
|
return set(ovn_extensions.ML2_SUPPORTED_API_EXTENSIONS) & extensions
|
||||||
|
|
||||||
|
|
|
@ -1055,9 +1055,7 @@ class MechanismManager(stevedore.named.NamedExtensionManager):
|
||||||
return drivers
|
return drivers
|
||||||
|
|
||||||
return [d for d in drivers if
|
return [d for d in drivers if
|
||||||
getattr(d.obj, 'vif_details', {}).get(
|
d.obj.connectivity == portbindings.CONNECTIVITY_L2]
|
||||||
portbindings.VIF_DETAILS_CONNECTIVITY) ==
|
|
||||||
portbindings.CONNECTIVITY_L2]
|
|
||||||
|
|
||||||
def get_workers(self):
|
def get_workers(self):
|
||||||
workers = []
|
workers = []
|
||||||
|
|
|
@ -64,6 +64,10 @@ class FakeAgentMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
|
||||||
def get_mappings(self, agent):
|
def get_mappings(self, agent):
|
||||||
return dict(agent['configurations'].get('interface_mappings', {}))
|
return dict(agent['configurations'].get('interface_mappings', {}))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connectivity(self):
|
||||||
|
return portbindings.CONNECTIVITY_L2
|
||||||
|
|
||||||
|
|
||||||
class AnotherFakeAgentMechanismDriver(FakeAgentMechanismDriver):
|
class AnotherFakeAgentMechanismDriver(FakeAgentMechanismDriver):
|
||||||
pass
|
pass
|
||||||
|
@ -76,3 +80,7 @@ class FakeAgentMechanismDriverL3(FakeAgentMechanismDriver):
|
||||||
super(FakeAgentMechanismDriverL3, self).__init__()
|
super(FakeAgentMechanismDriverL3, self).__init__()
|
||||||
self.vif_details[portbindings.VIF_DETAILS_CONNECTIVITY] = (
|
self.vif_details[portbindings.VIF_DETAILS_CONNECTIVITY] = (
|
||||||
portbindings.CONNECTIVITY_L3)
|
portbindings.CONNECTIVITY_L3)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def connectivity(self):
|
||||||
|
return portbindings.CONNECTIVITY_L3
|
||||||
|
|
Loading…
Reference in New Issue