summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Richard <joseph.richard@windriver.com>2019-01-09 22:16:50 -0500
committerJoseph Richard <joseph.richard@windriver.com>2019-01-11 12:31:54 -0500
commit8d14f3cd52392e1b3341f4d36acd97e45150df7b (patch)
treea6a34198be3cc0dc6868349ed2285b4e3d26410d
parent5dcff4e6164a5d95749ea8f9fa36048045bba84c (diff)
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>
Notes
Notes (review): Code-Review+2: Don Penney <don.penney@windriver.com> Code-Review+2: Al Bailey <al.bailey@windriver.com> Workflow+1: Al Bailey <al.bailey@windriver.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 11 Jan 2019 19:32:47 +0000 Reviewed-on: https://review.openstack.org/627885 Project: openstack/stx-config Branch: refs/heads/master
-rw-r--r--sysinv/sysinv/sysinv/sysinv/common/constants.py1
-rw-r--r--sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py1
-rw-r--r--sysinv/sysinv/sysinv/sysinv/helm/neutron.py44
3 files changed, 44 insertions, 2 deletions
diff --git a/sysinv/sysinv/sysinv/sysinv/common/constants.py b/sysinv/sysinv/sysinv/sysinv/common/constants.py
index 9ac1d40..8b2c9d9 100644
--- a/sysinv/sysinv/sysinv/sysinv/common/constants.py
+++ b/sysinv/sysinv/sysinv/sysinv/common/constants.py
@@ -1483,6 +1483,7 @@ APP_TARFILE_NAME_PLACEHOLDER = 'tarfile-placeholder'
1483CONTROL_PLANE_LABEL = 'openstack-control-plane=enabled' 1483CONTROL_PLANE_LABEL = 'openstack-control-plane=enabled'
1484COMPUTE_NODE_LABEL = 'openstack-compute-node=enabled' 1484COMPUTE_NODE_LABEL = 'openstack-compute-node=enabled'
1485OPENVSWITCH_LABEL = 'openvswitch=enabled' 1485OPENVSWITCH_LABEL = 'openvswitch=enabled'
1486SRIOV_LABEL = 'sriov=enabled'
1486 1487
1487# Default DNS service domain 1488# Default DNS service domain
1488DEFAULT_DNS_SERVICE_DOMAIN = 'cluster.local' 1489DEFAULT_DNS_SERVICE_DOMAIN = 'cluster.local'
diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py
index 495eda1..a1177e7 100644
--- a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py
+++ b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py
@@ -627,6 +627,7 @@ class AppOperator(object):
627 controller_labels_set.add(constants.CONTROL_PLANE_LABEL) 627 controller_labels_set.add(constants.CONTROL_PLANE_LABEL)
628 compute_labels_set.add(constants.COMPUTE_NODE_LABEL) 628 compute_labels_set.add(constants.COMPUTE_NODE_LABEL)
629 compute_labels_set.add(constants.OPENVSWITCH_LABEL) 629 compute_labels_set.add(constants.OPENVSWITCH_LABEL)
630 compute_labels_set.add(constants.SRIOV_LABEL)
630 631
631 # Get controller host(s) 632 # Get controller host(s)
632 controller_hosts =\ 633 controller_hosts =\
diff --git a/sysinv/sysinv/sysinv/sysinv/helm/neutron.py b/sysinv/sysinv/sysinv/sysinv/helm/neutron.py
index 63bea9a..b7c353d 100644
--- a/sysinv/sysinv/sysinv/sysinv/helm/neutron.py
+++ b/sysinv/sysinv/sysinv/sysinv/helm/neutron.py
@@ -16,6 +16,7 @@ from sqlalchemy.orm.exc import NoResultFound
16LOG = logging.getLogger(__name__) 16LOG = logging.getLogger(__name__)
17 17
18DATA_NETWORK_TYPES = [constants.NETWORK_TYPE_DATA] 18DATA_NETWORK_TYPES = [constants.NETWORK_TYPE_DATA]
19SRIOV_NETWORK_TYPES = [constants.NETWORK_TYPE_PCI_SRIOV]
19 20
20 21
21class NeutronHelm(openstack.OpenstackBaseHelm): 22class NeutronHelm(openstack.OpenstackBaseHelm):
@@ -44,12 +45,13 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
44 }, 45 },
45 'replicas': { 46 'replicas': {
46 'server': self._num_controllers() 47 'server': self._num_controllers()
47 } 48 },
48 }, 49 },
49 'network': { 50 'network': {
50 'interface': { 51 'interface': {
51 'tunnel': 'docker0' 52 'tunnel': 'docker0'
52 }, 53 },
54 'backend': ['openvswitch', 'sriov'],
53 }, 55 },
54 'conf': { 56 'conf': {
55 'neutron': self._get_neutron_config(), 57 'neutron': self._get_neutron_config(),
@@ -84,6 +86,9 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
84 'neutron_metadata-agent': { 86 'neutron_metadata-agent': {
85 'hosts': self._get_per_host_overrides() 87 'hosts': self._get_per_host_overrides()
86 }, 88 },
89 'neutron_sriov-agent': {
90 'hosts': self._get_per_host_overrides()
91 },
87 } 92 }
88 }, 93 },
89 'labels': self._get_labels_overrides(), 94 'labels': self._get_labels_overrides(),
@@ -155,7 +160,8 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
155 'name': hostname, 160 'name': hostname,
156 'conf': { 161 'conf': {
157 'plugins': { 162 'plugins': {
158 'openvswitch_agent': self._get_dynamic_ovs_agent_config(host) 163 'openvswitch_agent': self._get_dynamic_ovs_agent_config(host),
164 'sriov_agent': self._get_dynamic_sriov_agent_config(host),
159 } 165 }
160 } 166 }
161 } 167 }
@@ -219,6 +225,27 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
219 }, 225 },
220 } 226 }
221 227
228 def _get_dynamic_sriov_agent_config(self, host):
229 physical_device_mappings = ""
230 for iface in sorted(self.dbapi.iinterface_get_by_ihost(host.id),
231 key=self._interface_sort_key):
232 if self._is_sriov_network_type(iface):
233 # obtain the assigned providernets for interface
234 providernets = self._get_interface_providernets(iface)
235 port_name = self._get_interface_port_name(iface)
236 for providernet in providernets:
237 physical_device_mappings += ('%s:%s,' % (providernet, port_name))
238 sriov_nic = {
239 'physical_device_mappings': str(physical_device_mappings),
240 }
241
242 return {
243 'securitygroup': {
244 'firewall_driver': 'noop',
245 },
246 'sriov_nic': sriov_nic,
247 }
248
222 def _get_neutron_config(self): 249 def _get_neutron_config(self):
223 neutron_config = { 250 neutron_config = {
224 'DEFAULT': { 251 'DEFAULT': {
@@ -284,6 +311,10 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
284 networktypelist = utils.get_network_type_list(iface) 311 networktypelist = utils.get_network_type_list(iface)
285 return bool(any(n in DATA_NETWORK_TYPES for n in networktypelist)) 312 return bool(any(n in DATA_NETWORK_TYPES for n in networktypelist))
286 313
314 def _is_sriov_network_type(self, iface):
315 networktypelist = utils.get_network_type_list(iface)
316 return bool(any(n in SRIOV_NETWORK_TYPES for n in networktypelist))
317
287 def _get_interface_providernets(self, iface): 318 def _get_interface_providernets(self, iface):
288 """ 319 """
289 Return the provider networks of the supplied interface as a list. 320 Return the provider networks of the supplied interface as a list.
@@ -293,6 +324,15 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
293 return [] 324 return []
294 return [x.strip() for x in providernetworks.split(',')] 325 return [x.strip() for x in providernetworks.split(',')]
295 326
327 def _get_interface_port_name(self, iface):
328 """
329 Determine the port name of the underlying device.
330 """
331 assert iface['iftype'] == constants.INTERFACE_TYPE_ETHERNET
332 port = self.dbapi.port_get_by_interface(iface.id)
333 if port:
334 return port[0]['name']
335
296 def _get_interface_primary_address(self, context, host, iface): 336 def _get_interface_primary_address(self, context, host, iface):
297 """ 337 """
298 Determine the primary IP address on an interface (if any). If multiple 338 Determine the primary IP address on an interface (if any). If multiple