Merge "Create only required OVS bridges in compute nodes"
This commit is contained in:
commit
3b68a68ae1
@ -872,6 +872,9 @@ Neutron OVS agent config
|
||||
**CONFIG_NEUTRON_OVS_BRIDGE_IFACES**
|
||||
Comma-separated list of colon-separated Open vSwitch <bridge>:<interface> pairs. The interface will be added to the associated bridge. If you desire the bridge to be persistent a value must be added to this directive, also CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS must be set in order to create the proper port. This can be achieved from the command line by issuing the following command: packstack --allinone --os-neutron-ovs-bridge-mappings=ext-net:br-ex --os-neutron-ovs-bridge-interfaces=br-ex:eth0
|
||||
|
||||
**CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE**
|
||||
Comma-separated list of Open vSwitch bridges that must be created and connected to interfaces in compute nodes when flat or vlan type drivers are enabled. These bridges must exist in CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS and CONFIG_NEUTRON_OVS_BRIDGE_IFACES. Example: --os-neutron-ovs-bridges-compute=br-vlan --os-neutron-ovs-bridge-mappings="extnet:br-ex,physnet1:br-vlan" --os-neutron-ovs-bridge-interfaces="br-ex:eth1,br-vlan:eth2"
|
||||
|
||||
Neutron OVS agent config for tunnels
|
||||
------------------------------------
|
||||
|
||||
|
@ -85,3 +85,14 @@ def cidr_to_ifname(cidr, host, config):
|
||||
break
|
||||
result.append(':'.join(translated))
|
||||
return ','.join(result)
|
||||
|
||||
|
||||
# Function find_pair_with search in a list of "key:value" pairs, one
|
||||
# containing the desired element as key (if index is 0), or value (if index
|
||||
# is 1). It returns the pair if it's found or KeyError.
|
||||
def find_pair_with(pairs_list, element, index):
|
||||
for pair in pairs_list:
|
||||
found_element = pair.split(':')[index].strip()
|
||||
if found_element == element:
|
||||
return pair
|
||||
raise KeyError('Couldn\'t find element %s in %s.' % (element, pairs_list))
|
||||
|
@ -183,6 +183,22 @@ def initConfig(controller):
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
{"CMD_OPTION": "os-neutron-ovs-bridges-compute",
|
||||
"PROMPT": ("Enter a comma separated list of bridges for the "
|
||||
"Neutron OVS plugin in compute nodes. They must "
|
||||
"be included in os-neutron-ovs-bridge-mappings and "
|
||||
"os-neutron-ovs-bridge-interfaces."),
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"DEFAULT_VALUE": "",
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME": "CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE",
|
||||
"USE_DEFAULT": False,
|
||||
"NEED_CONFIRM": False,
|
||||
"CONDITION": False},
|
||||
|
||||
],
|
||||
|
||||
"NEUTRON_OVS_AGENT_TUNNEL": [
|
||||
@ -866,29 +882,55 @@ def create_l2_agent_manifests(config, messages):
|
||||
# For example, the input string 'A, B' should formatted as '['A','B']'.
|
||||
config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"] = bm_arr
|
||||
config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = []
|
||||
|
||||
# Bridge configuration and mappings for compute nodes can be different.
|
||||
# Parameter CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE contains the list of
|
||||
# bridge names, included in bridge mappings and bridge interfaces, that
|
||||
# must be created in compute nodes.
|
||||
brd_arr_cmp = get_values(config["CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE"])
|
||||
if_arr_cmp = []
|
||||
mapp_arr_cmp = []
|
||||
for brd in brd_arr_cmp:
|
||||
if_arr_cmp.append(common.find_pair_with(iface_arr, brd, 0))
|
||||
mapp_arr_cmp.append(common.find_pair_with(bm_arr, brd, 1))
|
||||
|
||||
config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS_COMPUTE"] = mapp_arr_cmp
|
||||
config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = []
|
||||
|
||||
elif agent == "linuxbridge":
|
||||
host_var = 'CONFIG_NEUTRON_LB_HOST'
|
||||
template_name = 'neutron_lb_agent'
|
||||
else:
|
||||
raise KeyError("Unknown layer2 agent")
|
||||
|
||||
no_local_types = set(ovs_type) & set(['gre', 'vxlan', 'vlan', 'flat'])
|
||||
no_tunnel_types = set(ovs_type) & set(['vlan', 'flat'])
|
||||
|
||||
for host in network_hosts | compute_hosts:
|
||||
manifestfile = "%s_neutron.pp" % (host,)
|
||||
manifestdata = "$cfg_neutron_ovs_host = '%s'\n" % host
|
||||
# neutron ovs port only on network hosts
|
||||
# NICs connected to OVS bridges can be required in network nodes if
|
||||
# vlan, flat, vxlan or gre are enabled. For compute nodes, they are
|
||||
# only required if vlan or flat are enabled.
|
||||
if (
|
||||
agent == "openvswitch" and (
|
||||
(host in network_hosts and tunnel_types)
|
||||
or 'vlan' in ovs_type)
|
||||
(host in network_hosts and no_local_types)
|
||||
or no_tunnel_types)
|
||||
):
|
||||
if config['CONFIG_USE_SUBNETS'] == 'y':
|
||||
iface_arr = [
|
||||
common.cidr_to_ifname(i, host, config) for i in iface_arr
|
||||
]
|
||||
if_arr_cmp = [
|
||||
common.cidr_to_ifname(i, host, config) for i in if_arr_cmp
|
||||
]
|
||||
config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = iface_arr
|
||||
config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = if_arr_cmp
|
||||
manifestdata += "$create_bridges = true\n"
|
||||
else:
|
||||
manifestdata += "$create_bridges = false\n"
|
||||
is_network_host = str(host in network_hosts).lower()
|
||||
manifestdata += "$network_host = %s\n" % is_network_host
|
||||
manifestdata += getManifestTemplate(template_name)
|
||||
appendManifestFile(manifestfile, manifestdata + "\n")
|
||||
# Additional configurations required for compute hosts and
|
||||
|
@ -13,9 +13,17 @@ if $ovs_agent_vxlan_cfg_neut_ovs_tun_if != '' {
|
||||
$localip = $cfg_neutron_ovs_host
|
||||
}
|
||||
|
||||
if $network_host {
|
||||
$bridge_ifaces_param = 'CONFIG_NEUTRON_OVS_BRIDGE_IFACES'
|
||||
$bridge_mappings_param = 'CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS'
|
||||
} else {
|
||||
$bridge_ifaces_param = 'CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE'
|
||||
$bridge_mappings_param = 'CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS_COMPUTE'
|
||||
}
|
||||
|
||||
if $create_bridges {
|
||||
$bridge_uplinks = hiera_array('CONFIG_NEUTRON_OVS_BRIDGE_IFACES')
|
||||
$bridge_mappings = hiera_array('CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS')
|
||||
$bridge_uplinks = hiera_array($bridge_ifaces_param)
|
||||
$bridge_mappings = hiera_array($bridge_mappings_param)
|
||||
} else {
|
||||
$bridge_uplinks = []
|
||||
$bridge_mappings = []
|
||||
|
@ -0,0 +1,12 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
New parameter ``--os-neutron-ovs-bridges-compute`` has been introduced to
|
||||
set the OVS bridges created and configured in compute nodes when vlan or
|
||||
flat type drivers are enabled.
|
||||
|
||||
fixes:
|
||||
- |
|
||||
Before this patch, all defined OVS bridges were created in both network
|
||||
and compute hosts. However, in certain topologies some bridges are only
|
||||
required in network hosts.
|
Loading…
x
Reference in New Issue
Block a user