Merge "Move all link-local cidr constants to a central location"
This commit is contained in:
commit
f799c9b350
neutron
@ -21,6 +21,7 @@ from neutron.agent.l3 import link_local_allocator as lla
|
||||
from neutron.agent.l3 import namespaces
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import iptables_manager
|
||||
from neutron.common import constants
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.ipam import utils as ipam_utils
|
||||
|
||||
@ -32,7 +33,6 @@ FIP_2_ROUTER_DEV_PREFIX = 'fpr-'
|
||||
ROUTER_2_FIP_DEV_PREFIX = namespaces.ROUTER_2_FIP_DEV_PREFIX
|
||||
# Route Table index for FIPs
|
||||
FIP_RT_TBL = 16
|
||||
FIP_LL_SUBNET = '169.254.64.0/18'
|
||||
# Rule priority range for FIPs
|
||||
FIP_PR_START = 32768
|
||||
FIP_PR_END = FIP_PR_START + 40000
|
||||
@ -59,7 +59,8 @@ class FipNamespace(namespaces.Namespace):
|
||||
namespace=self.get_name(),
|
||||
use_ipv6=self.use_ipv6)
|
||||
path = os.path.join(agent_conf.state_path, 'fip-linklocal-networks')
|
||||
self.local_subnets = lla.LinkLocalAllocator(path, FIP_LL_SUBNET)
|
||||
self.local_subnets = lla.LinkLocalAllocator(
|
||||
path, constants.DVR_FIP_LL_CIDR)
|
||||
self.destroyed = False
|
||||
|
||||
@classmethod
|
||||
|
@ -79,7 +79,7 @@ class ItemAllocator(object):
|
||||
if not self.pool:
|
||||
# The number of address pairs allocated from the
|
||||
# pool depends upon the prefix length specified
|
||||
# in FIP_LL_SUBNET
|
||||
# in DVR_FIP_LL_CIDR
|
||||
raise RuntimeError("Cannot allocate item of type:"
|
||||
" %s from pool using file %s"
|
||||
% (self.ItemClass, self.state_file))
|
||||
|
@ -22,6 +22,7 @@ from oslo_log import log as logging
|
||||
|
||||
from neutron._i18n import _, _LE
|
||||
from neutron.agent.linux import external_process
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions
|
||||
from neutron.common import utils as common_utils
|
||||
|
||||
@ -29,8 +30,6 @@ VALID_STATES = ['MASTER', 'BACKUP']
|
||||
VALID_AUTH_TYPES = ['AH', 'PASS']
|
||||
HA_DEFAULT_PRIORITY = 50
|
||||
PRIMARY_VIP_RANGE_SIZE = 24
|
||||
# TODO(amuller): Use L3 agent constant when new constants module is introduced.
|
||||
FIP_LL_SUBNET = '169.254.64.0/18'
|
||||
KEEPALIVED_SERVICE_NAME = 'keepalived'
|
||||
GARP_MASTER_DELAY = 60
|
||||
|
||||
@ -176,10 +175,10 @@ class KeepalivedInstance(object):
|
||||
self.vips = []
|
||||
self.virtual_routes = KeepalivedInstanceRoutes()
|
||||
self.authentication = None
|
||||
metadata_cidr = '169.254.169.254/32'
|
||||
self.primary_vip_range = get_free_range(
|
||||
parent_range='169.254.0.0/16',
|
||||
excluded_ranges=[metadata_cidr, FIP_LL_SUBNET] + ha_cidrs,
|
||||
parent_range=constants.PRIVATE_CIDR_RANGE,
|
||||
excluded_ranges=[constants.METADATA_CIDR,
|
||||
constants.DVR_FIP_LL_CIDR] + ha_cidrs,
|
||||
size=PRIMARY_VIP_RANGE_SIZE)
|
||||
|
||||
def set_authentication(self, auth_type, password):
|
||||
|
@ -235,6 +235,16 @@ IP_ALLOWED_VERSIONS = [lib_constants.IP_VERSION_4, lib_constants.IP_VERSION_6]
|
||||
IPV4_MAX_PREFIXLEN = 32
|
||||
IPV6_MAX_PREFIXLEN = 128
|
||||
|
||||
# Some components communicate using private address ranges, define
|
||||
# them all here. These address ranges should not cause any issues
|
||||
# even if they overlap since they are used in disjoint namespaces,
|
||||
# but for now they are unique.
|
||||
# We define the metadata cidr since it falls in the range.
|
||||
PRIVATE_CIDR_RANGE = '169.254.0.0/16'
|
||||
DVR_FIP_LL_CIDR = '169.254.64.0/18'
|
||||
L3_HA_NET_CIDR = '169.254.192.0/18'
|
||||
METADATA_CIDR = '169.254.169.254/32'
|
||||
|
||||
# Neutron-lib migration shim. This will wrap any constants that are moved
|
||||
# to that library in a deprecation warning, until they can be updated to
|
||||
# import directly from their new location.
|
||||
|
@ -67,7 +67,7 @@ L3_HA_OPTS = [
|
||||
"scheduled on. If it is set to 0 then the router will "
|
||||
"be scheduled on every agent.")),
|
||||
cfg.StrOpt('l3_ha_net_cidr',
|
||||
default='169.254.192.0/18',
|
||||
default=constants.L3_HA_NET_CIDR,
|
||||
help=_('Subnet used for the l3 HA admin network.')),
|
||||
cfg.StrOpt('l3_ha_network_type', default='',
|
||||
help=_("The network type to use when creating the HA network "
|
||||
|
Loading…
Reference in New Issue
Block a user