Enable neutron sriov backend
This commit adds configuration of the sriov backend to neutron. This commit also adds setting the sriov=enabled label in kube_app. Story: 2003909 Task: 28835 Change-Id: If9c7c0b73382855dde4b539ca821a9ef8a2963b3 Signed-off-by: Joseph Richard <joseph.richard@windriver.com>
This commit is contained in:
parent
5dcff4e616
commit
8d14f3cd52
|
@ -1483,6 +1483,7 @@ APP_TARFILE_NAME_PLACEHOLDER = 'tarfile-placeholder'
|
||||||
CONTROL_PLANE_LABEL = 'openstack-control-plane=enabled'
|
CONTROL_PLANE_LABEL = 'openstack-control-plane=enabled'
|
||||||
COMPUTE_NODE_LABEL = 'openstack-compute-node=enabled'
|
COMPUTE_NODE_LABEL = 'openstack-compute-node=enabled'
|
||||||
OPENVSWITCH_LABEL = 'openvswitch=enabled'
|
OPENVSWITCH_LABEL = 'openvswitch=enabled'
|
||||||
|
SRIOV_LABEL = 'sriov=enabled'
|
||||||
|
|
||||||
# Default DNS service domain
|
# Default DNS service domain
|
||||||
DEFAULT_DNS_SERVICE_DOMAIN = 'cluster.local'
|
DEFAULT_DNS_SERVICE_DOMAIN = 'cluster.local'
|
||||||
|
|
|
@ -627,6 +627,7 @@ class AppOperator(object):
|
||||||
controller_labels_set.add(constants.CONTROL_PLANE_LABEL)
|
controller_labels_set.add(constants.CONTROL_PLANE_LABEL)
|
||||||
compute_labels_set.add(constants.COMPUTE_NODE_LABEL)
|
compute_labels_set.add(constants.COMPUTE_NODE_LABEL)
|
||||||
compute_labels_set.add(constants.OPENVSWITCH_LABEL)
|
compute_labels_set.add(constants.OPENVSWITCH_LABEL)
|
||||||
|
compute_labels_set.add(constants.SRIOV_LABEL)
|
||||||
|
|
||||||
# Get controller host(s)
|
# Get controller host(s)
|
||||||
controller_hosts =\
|
controller_hosts =\
|
||||||
|
|
|
@ -16,6 +16,7 @@ from sqlalchemy.orm.exc import NoResultFound
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
DATA_NETWORK_TYPES = [constants.NETWORK_TYPE_DATA]
|
DATA_NETWORK_TYPES = [constants.NETWORK_TYPE_DATA]
|
||||||
|
SRIOV_NETWORK_TYPES = [constants.NETWORK_TYPE_PCI_SRIOV]
|
||||||
|
|
||||||
|
|
||||||
class NeutronHelm(openstack.OpenstackBaseHelm):
|
class NeutronHelm(openstack.OpenstackBaseHelm):
|
||||||
|
@ -44,12 +45,13 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
||||||
},
|
},
|
||||||
'replicas': {
|
'replicas': {
|
||||||
'server': self._num_controllers()
|
'server': self._num_controllers()
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
'network': {
|
'network': {
|
||||||
'interface': {
|
'interface': {
|
||||||
'tunnel': 'docker0'
|
'tunnel': 'docker0'
|
||||||
},
|
},
|
||||||
|
'backend': ['openvswitch', 'sriov'],
|
||||||
},
|
},
|
||||||
'conf': {
|
'conf': {
|
||||||
'neutron': self._get_neutron_config(),
|
'neutron': self._get_neutron_config(),
|
||||||
|
@ -84,6 +86,9 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
||||||
'neutron_metadata-agent': {
|
'neutron_metadata-agent': {
|
||||||
'hosts': self._get_per_host_overrides()
|
'hosts': self._get_per_host_overrides()
|
||||||
},
|
},
|
||||||
|
'neutron_sriov-agent': {
|
||||||
|
'hosts': self._get_per_host_overrides()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'labels': self._get_labels_overrides(),
|
'labels': self._get_labels_overrides(),
|
||||||
|
@ -155,7 +160,8 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
||||||
'name': hostname,
|
'name': hostname,
|
||||||
'conf': {
|
'conf': {
|
||||||
'plugins': {
|
'plugins': {
|
||||||
'openvswitch_agent': self._get_dynamic_ovs_agent_config(host)
|
'openvswitch_agent': self._get_dynamic_ovs_agent_config(host),
|
||||||
|
'sriov_agent': self._get_dynamic_sriov_agent_config(host),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,6 +225,27 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _get_dynamic_sriov_agent_config(self, host):
|
||||||
|
physical_device_mappings = ""
|
||||||
|
for iface in sorted(self.dbapi.iinterface_get_by_ihost(host.id),
|
||||||
|
key=self._interface_sort_key):
|
||||||
|
if self._is_sriov_network_type(iface):
|
||||||
|
# obtain the assigned providernets for interface
|
||||||
|
providernets = self._get_interface_providernets(iface)
|
||||||
|
port_name = self._get_interface_port_name(iface)
|
||||||
|
for providernet in providernets:
|
||||||
|
physical_device_mappings += ('%s:%s,' % (providernet, port_name))
|
||||||
|
sriov_nic = {
|
||||||
|
'physical_device_mappings': str(physical_device_mappings),
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'securitygroup': {
|
||||||
|
'firewall_driver': 'noop',
|
||||||
|
},
|
||||||
|
'sriov_nic': sriov_nic,
|
||||||
|
}
|
||||||
|
|
||||||
def _get_neutron_config(self):
|
def _get_neutron_config(self):
|
||||||
neutron_config = {
|
neutron_config = {
|
||||||
'DEFAULT': {
|
'DEFAULT': {
|
||||||
|
@ -284,6 +311,10 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
||||||
networktypelist = utils.get_network_type_list(iface)
|
networktypelist = utils.get_network_type_list(iface)
|
||||||
return bool(any(n in DATA_NETWORK_TYPES for n in networktypelist))
|
return bool(any(n in DATA_NETWORK_TYPES for n in networktypelist))
|
||||||
|
|
||||||
|
def _is_sriov_network_type(self, iface):
|
||||||
|
networktypelist = utils.get_network_type_list(iface)
|
||||||
|
return bool(any(n in SRIOV_NETWORK_TYPES for n in networktypelist))
|
||||||
|
|
||||||
def _get_interface_providernets(self, iface):
|
def _get_interface_providernets(self, iface):
|
||||||
"""
|
"""
|
||||||
Return the provider networks of the supplied interface as a list.
|
Return the provider networks of the supplied interface as a list.
|
||||||
|
@ -293,6 +324,15 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
||||||
return []
|
return []
|
||||||
return [x.strip() for x in providernetworks.split(',')]
|
return [x.strip() for x in providernetworks.split(',')]
|
||||||
|
|
||||||
|
def _get_interface_port_name(self, iface):
|
||||||
|
"""
|
||||||
|
Determine the port name of the underlying device.
|
||||||
|
"""
|
||||||
|
assert iface['iftype'] == constants.INTERFACE_TYPE_ETHERNET
|
||||||
|
port = self.dbapi.port_get_by_interface(iface.id)
|
||||||
|
if port:
|
||||||
|
return port[0]['name']
|
||||||
|
|
||||||
def _get_interface_primary_address(self, context, host, iface):
|
def _get_interface_primary_address(self, context, host, iface):
|
||||||
"""
|
"""
|
||||||
Determine the primary IP address on an interface (if any). If multiple
|
Determine the primary IP address on an interface (if any). If multiple
|
||||||
|
|
Loading…
Reference in New Issue