Support ovs in container
As stx cutovers to containerization, most openstack components run in containers, but ovs-dpdk running on the host. This patch is to support ovs running in container, and make it the default setting. We still support running ovs-dpdk on the host. For option ovs-dpdk on the host, run follow command before unlock. ``` system modify --vswitch_type ovs-dpdk ``` Change-Id: I111865de17fc82a1e7c269fb97f53a181fb382b2 Story: 2004649 Task: 28610 Co-authored-by: Huifeng Le <huifeng.le@intel.com> Signed-off-by: chengli3 <cheng1.li@intel.com>
This commit is contained in:
@@ -486,7 +486,7 @@ class ConfigAssistant():
|
|||||||
# HTTPS
|
# HTTPS
|
||||||
self.enable_https = False
|
self.enable_https = False
|
||||||
# Network config
|
# Network config
|
||||||
self.vswitch_type = "ovs-dpdk"
|
self.vswitch_type = "none"
|
||||||
|
|
||||||
# Authentication config
|
# Authentication config
|
||||||
self.admin_username = "admin"
|
self.admin_username = "admin"
|
||||||
|
@@ -589,6 +589,42 @@ data:
|
|||||||
- helm-toolkit
|
- helm-toolkit
|
||||||
---
|
---
|
||||||
schema: armada/Chart/v1
|
schema: armada/Chart/v1
|
||||||
|
metadata:
|
||||||
|
schema: metadata/Document/v1
|
||||||
|
name: openstack-openvswitch
|
||||||
|
data:
|
||||||
|
chart_name: openvswitch
|
||||||
|
release: openstack-openvswitch
|
||||||
|
namespace: openstack
|
||||||
|
# If we deploy ovs-dpdk on the host, ovs pod will not be created.
|
||||||
|
# We can use "native wait" instead. But it's not supported in current armada version.
|
||||||
|
# Before we upgrade armada to new version, we comment the wait
|
||||||
|
# https://github.com/openstack/airship-armada/blob/master/armada/schemas/armada-chart-schema.yaml#L81-L111
|
||||||
|
#wait:
|
||||||
|
# timeout: 1800
|
||||||
|
install:
|
||||||
|
no_hooks: false
|
||||||
|
upgrade:
|
||||||
|
no_hooks: false
|
||||||
|
pre:
|
||||||
|
delete:
|
||||||
|
- type: job
|
||||||
|
labels:
|
||||||
|
release_group: osh-openstack-openvswitch
|
||||||
|
values:
|
||||||
|
labels:
|
||||||
|
ovs:
|
||||||
|
node_selector_key: openvswitch
|
||||||
|
node_selector_value: enabled
|
||||||
|
source:
|
||||||
|
type: tar
|
||||||
|
location: http://172.17.0.1/helm_charts/openvswitch-0.1.0.tgz
|
||||||
|
subpath: openvswitch
|
||||||
|
reference: master
|
||||||
|
dependencies:
|
||||||
|
- helm-toolkit
|
||||||
|
---
|
||||||
|
schema: armada/Chart/v1
|
||||||
metadata:
|
metadata:
|
||||||
schema: metadata/Document/v1
|
schema: metadata/Document/v1
|
||||||
name: openstack-nova
|
name: openstack-nova
|
||||||
@@ -2761,6 +2797,7 @@ data:
|
|||||||
sequenced: false
|
sequenced: false
|
||||||
chart_group:
|
chart_group:
|
||||||
- openstack-libvirt
|
- openstack-libvirt
|
||||||
|
- openstack-openvswitch
|
||||||
- openstack-nova
|
- openstack-nova
|
||||||
- openstack-nova-api-proxy
|
- openstack-nova-api-proxy
|
||||||
- openstack-neutron
|
- openstack-neutron
|
||||||
|
@@ -11,12 +11,13 @@ class platform::vswitch
|
|||||||
|
|
||||||
Class[$name] -> Class['::platform::network']
|
Class[$name] -> Class['::platform::network']
|
||||||
|
|
||||||
|
if $::platform::params::vswitch_type != 'none' {
|
||||||
$enable_unsafe_noiommu_mode = bool2num(!$iommu_enabled)
|
$enable_unsafe_noiommu_mode = bool2num(!$iommu_enabled)
|
||||||
|
|
||||||
exec {'vfio-iommu-mode':
|
exec {'vfio-iommu-mode':
|
||||||
command => "echo ${enable_unsafe_noiommu_mode} > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode",
|
command => "echo ${enable_unsafe_noiommu_mode} > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode",
|
||||||
require => Kmod::Load[$driver_type],
|
require => Kmod::Load[$driver_type],
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
include $vswitch_class
|
include $vswitch_class
|
||||||
}
|
}
|
||||||
|
@@ -280,6 +280,7 @@ VXLAN_MTU_OVERHEAD = 74
|
|||||||
# Supported worker node vswitch types
|
# Supported worker node vswitch types
|
||||||
VSWITCH_TYPE_OVS_DPDK = "ovs-dpdk"
|
VSWITCH_TYPE_OVS_DPDK = "ovs-dpdk"
|
||||||
VSWITCH_TYPE_NUAGE_VRS = "nuage_vrs"
|
VSWITCH_TYPE_NUAGE_VRS = "nuage_vrs"
|
||||||
|
VSWITCH_TYPE_NONE = "none"
|
||||||
|
|
||||||
# Partition default sizes
|
# Partition default sizes
|
||||||
DEFAULT_IMAGE_STOR_SIZE = 10
|
DEFAULT_IMAGE_STOR_SIZE = 10
|
||||||
|
@@ -1952,3 +1952,8 @@ def has_openstack_compute(labels):
|
|||||||
|
|
||||||
# We haven't found the openstack compute node key. Return False
|
# We haven't found the openstack compute node key. Return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_vswitch_type(dbapi):
|
||||||
|
system = dbapi.isystem_get_one()
|
||||||
|
return system.capabilities.get('vswitch_type', None)
|
||||||
|
@@ -200,6 +200,10 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# if ovs runs on host, auto bridge add is covered by sysinv
|
||||||
|
if utils.get_vswitch_type(self.dbapi) == constants.VSWITCH_TYPE_NONE:
|
||||||
|
host_neutron['conf'].update({
|
||||||
|
'auto_bridge_add': self._get_host_bridges(host)})
|
||||||
host_list.append(host_neutron)
|
host_list.append(host_neutron)
|
||||||
|
|
||||||
return host_list
|
return host_list
|
||||||
@@ -216,6 +220,30 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
|||||||
else: # if iface['iftype'] == constants.INTERFACE_TYPE_VLAN:
|
else: # if iface['iftype'] == constants.INTERFACE_TYPE_VLAN:
|
||||||
return 2, iface['ifname']
|
return 2, iface['ifname']
|
||||||
|
|
||||||
|
def _get_datapath_type(self):
|
||||||
|
if (utils.get_vswitch_type(self.dbapi) ==
|
||||||
|
constants.VSWITCH_TYPE_OVS_DPDK):
|
||||||
|
return "netdev"
|
||||||
|
else:
|
||||||
|
return "system"
|
||||||
|
|
||||||
|
def _get_host_bridges(self, host):
|
||||||
|
bridges = {}
|
||||||
|
index = 0
|
||||||
|
for iface in sorted(self.dbapi.iinterface_get_by_ihost(host.id),
|
||||||
|
key=self._interface_sort_key):
|
||||||
|
if self._is_data_network_type(iface):
|
||||||
|
if any(dn.datanetwork_network_type in
|
||||||
|
[constants.DATANETWORK_TYPE_FLAT,
|
||||||
|
constants.DATANETWORK_TYPE_VLAN] for dn in
|
||||||
|
self._get_interface_datanets(iface)):
|
||||||
|
# obtain the assigned bridge for interface
|
||||||
|
brname = 'br-phy%d' % index
|
||||||
|
port_name = self._get_interface_port_name(iface)
|
||||||
|
bridges[brname] = port_name
|
||||||
|
index += 1
|
||||||
|
return bridges
|
||||||
|
|
||||||
def _get_dynamic_ovs_agent_config(self, host):
|
def _get_dynamic_ovs_agent_config(self, host):
|
||||||
local_ip = None
|
local_ip = None
|
||||||
tunnel_types = None
|
tunnel_types = None
|
||||||
@@ -229,21 +257,24 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
|||||||
if brname:
|
if brname:
|
||||||
datanets = self._get_interface_datanets(iface)
|
datanets = self._get_interface_datanets(iface)
|
||||||
for datanet in datanets:
|
for datanet in datanets:
|
||||||
|
dn_name = datanet['datanetwork_name'].strip()
|
||||||
LOG.debug('_get_dynamic_ovs_agent_config '
|
LOG.debug('_get_dynamic_ovs_agent_config '
|
||||||
'host=%s datanet=%s', host.hostname, datanet)
|
'host=%s datanet=%s', host.hostname, dn_name)
|
||||||
address = self._get_interface_primary_address(
|
if (datanet.datanetwork_network_type ==
|
||||||
|
constants.DATANETWORK_TYPE_VXLAN):
|
||||||
|
local_ip = self._get_interface_primary_address(
|
||||||
self.context, host, iface)
|
self.context, host, iface)
|
||||||
if address:
|
|
||||||
local_ip = address
|
|
||||||
tunnel_types = constants.DATANETWORK_TYPE_VXLAN
|
tunnel_types = constants.DATANETWORK_TYPE_VXLAN
|
||||||
else:
|
elif (datanet.datanetwork_network_type in
|
||||||
bridge_mappings += ('%s:%s,' % (datanet, brname))
|
[constants.DATANETWORK_TYPE_FLAT,
|
||||||
|
constants.DATANETWORK_TYPE_VLAN]):
|
||||||
|
bridge_mappings += ('%s:%s,' % (dn_name, brname))
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
agent = {}
|
agent = {}
|
||||||
ovs = {
|
ovs = {
|
||||||
'integration_bridge': 'br-int',
|
'integration_bridge': 'br-int',
|
||||||
'datapath_type': 'netdev',
|
'datapath_type': self._get_datapath_type(),
|
||||||
'vhostuser_socket_dir': '/var/run/openvswitch',
|
'vhostuser_socket_dir': '/var/run/openvswitch',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +308,8 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
|||||||
datanets = self._get_interface_datanets(iface)
|
datanets = self._get_interface_datanets(iface)
|
||||||
port_name = self._get_interface_port_name(iface)
|
port_name = self._get_interface_port_name(iface)
|
||||||
for datanet in datanets:
|
for datanet in datanets:
|
||||||
physical_device_mappings += ('%s:%s,' % (datanet, port_name))
|
dn_name = datanet['datanetwork_name'].strip()
|
||||||
|
physical_device_mappings += ('%s:%s,' % (dn_name, port_name))
|
||||||
sriov_nic = {
|
sriov_nic = {
|
||||||
'physical_device_mappings': str(physical_device_mappings),
|
'physical_device_mappings': str(physical_device_mappings),
|
||||||
}
|
}
|
||||||
@@ -330,7 +362,7 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
|||||||
|
|
||||||
ifdatanets = self.dbapi.interface_datanetwork_get_by_interface(
|
ifdatanets = self.dbapi.interface_datanetwork_get_by_interface(
|
||||||
iface.uuid)
|
iface.uuid)
|
||||||
return [ifdn['datanetwork_name'].strip() for ifdn in ifdatanets]
|
return ifdatanets
|
||||||
|
|
||||||
def _get_interface_port_name(self, iface):
|
def _get_interface_port_name(self, iface):
|
||||||
"""
|
"""
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
from sysinv.common import constants
|
from sysinv.common import constants
|
||||||
from sysinv.common import exception
|
from sysinv.common import exception
|
||||||
|
from sysinv.common import utils
|
||||||
from sysinv.openstack.common import log as logging
|
from sysinv.openstack.common import log as logging
|
||||||
from sysinv.helm import common
|
from sysinv.helm import common
|
||||||
from sysinv.helm import openstack
|
from sysinv.helm import openstack
|
||||||
@@ -19,8 +20,18 @@ class OpenvswitchHelm(openstack.OpenstackBaseHelm):
|
|||||||
CHART = constants.HELM_CHART_OPENVSWITCH
|
CHART = constants.HELM_CHART_OPENVSWITCH
|
||||||
|
|
||||||
def get_overrides(self, namespace=None):
|
def get_overrides(self, namespace=None):
|
||||||
|
# helm has an issue with installing release of no pod
|
||||||
|
# https://github.com/helm/helm/issues/4295
|
||||||
|
# once this is fixed, we can use 'manifests' instead of 'label' to
|
||||||
|
# control ovs enable or not
|
||||||
overrides = {
|
overrides = {
|
||||||
common.HELM_NS_OPENSTACK: {
|
common.HELM_NS_OPENSTACK: {
|
||||||
|
'labels': {
|
||||||
|
'ovs': {
|
||||||
|
'node_selector_key': 'openvswitch',
|
||||||
|
'node_selector_value': self._ovs_label_value(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,3 +42,9 @@ class OpenvswitchHelm(openstack.OpenstackBaseHelm):
|
|||||||
namespace=namespace)
|
namespace=namespace)
|
||||||
else:
|
else:
|
||||||
return overrides
|
return overrides
|
||||||
|
|
||||||
|
def _ovs_label_value(self):
|
||||||
|
if utils.get_vswitch_type(self.dbapi) == constants.VSWITCH_TYPE_NONE:
|
||||||
|
return "enabled"
|
||||||
|
else:
|
||||||
|
return "none"
|
||||||
|
Reference in New Issue
Block a user