Update config to use per network groups
Use groups to specify control plane network data. When we do routed networks we need to provide network data for each controlplane network/subnet. Implements: blueprint tripleo-routed-networks-ironic-inspector Implements: blueprint tripleo-routed-networks-deployment Change-Id: Ia95ff5c00433c89155727ea5551904c45197e6b0
This commit is contained in:
parent
2fb436b59d
commit
a10b9997b5
|
@ -24,6 +24,7 @@ import fixtures
|
|||
from keystoneauth1 import exceptions as ks_exceptions
|
||||
import mock
|
||||
from novaclient import exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture as config_fixture
|
||||
from oslotest import base
|
||||
from oslotest import log
|
||||
|
@ -41,9 +42,24 @@ class BaseTestCase(base.BaseTestCase):
|
|||
super(BaseTestCase, self).setUp()
|
||||
self.logger = self.useFixture(log.ConfigureLogging()).logger
|
||||
self.conf = self.useFixture(config_fixture.Config())
|
||||
# ctlplane-subnet - config group options
|
||||
self.grp0 = cfg.OptGroup(name='ctlplane-subnet',
|
||||
title='ctlplane-subnet')
|
||||
self.opts = [cfg.StrOpt('cidr'),
|
||||
cfg.StrOpt('dhcp_start'),
|
||||
cfg.StrOpt('dhcp_end'),
|
||||
cfg.StrOpt('inspection_iprange'),
|
||||
cfg.StrOpt('gateway')]
|
||||
self.conf.register_opts(self.opts, group=self.grp0)
|
||||
self.conf.config(cidr='192.168.24.0/24',
|
||||
dhcp_start='192.168.24.5', dhcp_end='192.168.24.24',
|
||||
inspection_iprange='192.168.24.100,192.168.24.120',
|
||||
gateway='192.168.24.1', group='ctlplane-subnet')
|
||||
|
||||
|
||||
class TestUndercloud(BaseTestCase):
|
||||
@mock.patch(
|
||||
'instack_undercloud.undercloud._load_subnets_config_groups')
|
||||
@mock.patch('instack_undercloud.undercloud._handle_upgrade_fact')
|
||||
@mock.patch('instack_undercloud.undercloud._configure_logging')
|
||||
@mock.patch('instack_undercloud.undercloud._validate_configuration')
|
||||
|
@ -63,7 +79,7 @@ class TestUndercloud(BaseTestCase):
|
|||
mock_run_clean_all, mock_run_yum_update, mock_run_orc,
|
||||
mock_post_config, mock_run_command,
|
||||
mock_validate_configuration, mock_configure_logging,
|
||||
mock_upgrade_fact):
|
||||
mock_upgrade_fact, mock_load_subnets_config_groups):
|
||||
fake_env = mock.MagicMock()
|
||||
mock_generate_environment.return_value = fake_env
|
||||
undercloud.install('.')
|
||||
|
@ -77,6 +93,8 @@ class TestUndercloud(BaseTestCase):
|
|||
mock_die_tuskar_die.assert_not_called()
|
||||
mock_run_validation_groups.assert_not_called()
|
||||
|
||||
@mock.patch(
|
||||
'instack_undercloud.undercloud._load_subnets_config_groups')
|
||||
@mock.patch('instack_undercloud.undercloud._handle_upgrade_fact')
|
||||
@mock.patch('instack_undercloud.undercloud._configure_logging')
|
||||
@mock.patch('instack_undercloud.undercloud._validate_configuration')
|
||||
|
@ -96,7 +114,8 @@ class TestUndercloud(BaseTestCase):
|
|||
mock_run_yum_clean_all, mock_run_yum_update,
|
||||
mock_run_orc, mock_post_config, mock_run_command,
|
||||
mock_validate_configuration,
|
||||
mock_configure_logging, mock_upgrade_fact):
|
||||
mock_configure_logging, mock_upgrade_fact,
|
||||
mock_load_subnets_config_groups):
|
||||
fake_env = mock.MagicMock()
|
||||
mock_generate_environment.return_value = fake_env
|
||||
undercloud.install('.', upgrade=True)
|
||||
|
@ -110,6 +129,8 @@ class TestUndercloud(BaseTestCase):
|
|||
mock_die_tuskar_die.assert_called_once()
|
||||
mock_run_validation_groups.assert_called_once()
|
||||
|
||||
@mock.patch(
|
||||
'instack_undercloud.undercloud._load_subnets_config_groups')
|
||||
@mock.patch('instack_undercloud.undercloud._handle_upgrade_fact')
|
||||
@mock.patch('instack_undercloud.undercloud._configure_logging')
|
||||
@mock.patch('instack_undercloud.undercloud._validate_configuration')
|
||||
|
@ -132,7 +153,8 @@ class TestUndercloud(BaseTestCase):
|
|||
mock_post_config, mock_run_command,
|
||||
mock_validate_configuration,
|
||||
mock_configure_logging,
|
||||
mock_upgrade_fact):
|
||||
mock_upgrade_fact,
|
||||
mock_load_subnets_config_groups):
|
||||
self.conf.config(hieradata_override='override.yaml')
|
||||
with open(os.path.expanduser('~/override.yaml'), 'w') as f:
|
||||
f.write('Something\n')
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import mock
|
||||
|
||||
from oslo_config import fixture as config_fixture
|
||||
from oslo_config import cfg
|
||||
from oslotest import base
|
||||
|
||||
from instack_undercloud import undercloud
|
||||
|
@ -25,6 +26,19 @@ class TestValidator(base.BaseTestCase):
|
|||
def setUp(self):
|
||||
super(TestValidator, self).setUp()
|
||||
self.conf = self.useFixture(config_fixture.Config())
|
||||
# ctlplane-subnet - config group options
|
||||
self.grp0 = cfg.OptGroup(name='ctlplane-subnet',
|
||||
title='ctlplane-subnet')
|
||||
self.opts = [cfg.StrOpt('cidr'),
|
||||
cfg.StrOpt('dhcp_start'),
|
||||
cfg.StrOpt('dhcp_end'),
|
||||
cfg.StrOpt('inspection_iprange'),
|
||||
cfg.StrOpt('gateway')]
|
||||
self.conf.register_opts(self.opts, group=self.grp0)
|
||||
self.conf.config(cidr='192.168.24.0/24',
|
||||
dhcp_start='192.168.24.5', dhcp_end='192.168.24.24',
|
||||
inspection_iprange='192.168.24.100,192.168.24.120',
|
||||
gateway='192.168.24.1', group='ctlplane-subnet')
|
||||
|
||||
@mock.patch('netifaces.interfaces')
|
||||
def test_validation_passes(self, ifaces_mock):
|
||||
|
@ -37,73 +51,82 @@ class TestValidator(base.BaseTestCase):
|
|||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_network_gateway(self):
|
||||
self.conf.config(network_gateway='193.0.2.1')
|
||||
self.conf.config(gateway='193.0.2.1', group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_dhcp_start(self):
|
||||
self.conf.config(dhcp_start='193.0.2.10')
|
||||
self.conf.config(dhcp_start='193.0.2.10', group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_dhcp_end(self):
|
||||
self.conf.config(dhcp_end='193.0.2.10')
|
||||
self.conf.config(dhcp_end='193.0.2.10', group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_inspection_start(self):
|
||||
self.conf.config(inspection_iprange='193.0.2.100,192.168.24.120')
|
||||
self.conf.config(inspection_iprange='193.0.2.100,192.168.24.120',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_inspection_end(self):
|
||||
self.conf.config(inspection_iprange='192.168.24.100,193.0.2.120')
|
||||
self.conf.config(inspection_iprange='192.168.24.100,193.0.2.120',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_dhcp_order(self):
|
||||
self.conf.config(dhcp_start='192.168.24.100', dhcp_end='192.168.24.10')
|
||||
self.conf.config(dhcp_start='192.168.24.100', dhcp_end='192.168.24.10',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_dhcp_equal(self):
|
||||
self.conf.config(dhcp_start='192.168.24.100',
|
||||
dhcp_end='192.168.24.100')
|
||||
dhcp_end='192.168.24.100', group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_inspection_order(self):
|
||||
self.conf.config(inspection_iprange='192.168.24.120,192.168.24.100')
|
||||
self.conf.config(inspection_iprange='192.168.24.120,192.168.24.100',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_inspection_equal(self):
|
||||
self.conf.config(inspection_iprange='192.168.24.120,192.168.24.120')
|
||||
self.conf.config(inspection_iprange='192.168.24.120,192.168.24.120',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_range_overlap_1(self):
|
||||
self.conf.config(dhcp_start='192.168.24.10', dhcp_end='192.168.24.100',
|
||||
inspection_iprange='192.168.24.90,192.168.24.110')
|
||||
inspection_iprange='192.168.24.90,192.168.24.110',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_range_overlap_2(self):
|
||||
self.conf.config(dhcp_start='192.168.24.100',
|
||||
dhcp_end='192.168.24.120',
|
||||
inspection_iprange='192.168.24.90,192.168.24.110')
|
||||
inspection_iprange='192.168.24.90,192.168.24.110',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_range_overlap_3(self):
|
||||
self.conf.config(dhcp_start='192.168.24.20', dhcp_end='192.168.24.90',
|
||||
inspection_iprange='192.168.24.10,192.168.24.100')
|
||||
inspection_iprange='192.168.24.10,192.168.24.100',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
def test_fail_on_range_overlap_4(self):
|
||||
self.conf.config(dhcp_start='192.168.24.10', dhcp_end='192.168.24.100',
|
||||
inspection_iprange='192.168.24.20,192.168.24.90')
|
||||
inspection_iprange='192.168.24.20,192.168.24.90',
|
||||
group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
|
@ -118,9 +141,12 @@ class TestValidator(base.BaseTestCase):
|
|||
undercloud._validate_network)
|
||||
|
||||
def test_no_alter_params(self):
|
||||
self.conf.config(network_cidr='192.168.24.0/24')
|
||||
self.conf.config(cidr='192.168.24.0/24', group='ctlplane-subnet')
|
||||
params = {opt.name: self.conf.conf[opt.name]
|
||||
for opt in undercloud._opts}
|
||||
params.update(
|
||||
{opt.name: self.conf.conf.get('ctlplane-subnet')[opt.name]
|
||||
for opt in undercloud._subnets_opts})
|
||||
save_params = dict(params)
|
||||
validator.validate_config(params, lambda x: None)
|
||||
self.assertEqual(save_params, params)
|
||||
|
@ -171,7 +197,7 @@ class TestValidator(base.BaseTestCase):
|
|||
@mock.patch('netifaces.interfaces')
|
||||
def test_fail_on_invalid_ip(self, ifaces_mock):
|
||||
ifaces_mock.return_value = ['eth1']
|
||||
self.conf.config(dhcp_start='foo.bar')
|
||||
self.conf.config(dhcp_start='foo.bar', group='ctlplane-subnet')
|
||||
self.assertRaises(validator.FailedValidation,
|
||||
undercloud._validate_network)
|
||||
|
||||
|
|
|
@ -114,7 +114,18 @@ log can be found at %(log_file)s.
|
|||
REQUIRED_MB = 7680
|
||||
# Control plane network name
|
||||
PHYSICAL_NETWORK = 'ctlplane'
|
||||
CTLPLANE_SUBNET_NAME = 'ctlplane-subnet'
|
||||
SUBNETS_DEFAULT = ['ctlplane-subnet']
|
||||
|
||||
# Deprecated options
|
||||
_deprecated_opt_network_gateway = [cfg.DeprecatedOpt(
|
||||
'network_gateway', group='DEFAULT')]
|
||||
_deprecated_opt_network_cidr = [cfg.DeprecatedOpt(
|
||||
'network_cidr', group='DEFAULT')]
|
||||
_deprecated_opt_dhcp_start = [cfg.DeprecatedOpt(
|
||||
'dhcp_start', group='DEFAULT')]
|
||||
_deprecated_opt_dhcp_end = [cfg.DeprecatedOpt('dhcp_end', group='DEFAULT')]
|
||||
_deprecated_opt_inspection_iprange = [cfg.DeprecatedOpt(
|
||||
'inspection_iprange', group='DEFAULT')]
|
||||
|
||||
# When adding new options to the lists below, make sure to regenerate the
|
||||
# sample config by running "tox -e genconfig" in the project root.
|
||||
|
@ -136,12 +147,6 @@ _opts = [
|
|||
'local_interface, with the netmask defined by the '
|
||||
'prefix portion of the value.')
|
||||
),
|
||||
cfg.StrOpt('network_gateway',
|
||||
default='192.168.24.1',
|
||||
help=('Network gateway for the Neutron-managed network for '
|
||||
'Overcloud instances. This should match the local_ip '
|
||||
'above when using masquerading.')
|
||||
),
|
||||
cfg.StrOpt('undercloud_public_host',
|
||||
deprecated_name='undercloud_public_vip',
|
||||
default='192.168.24.2',
|
||||
|
@ -167,6 +172,35 @@ _opts = [
|
|||
'The overcloud parameter "CloudDomain" must be set to a '
|
||||
'matching value.')
|
||||
),
|
||||
cfg.ListOpt('subnets',
|
||||
default=SUBNETS_DEFAULT,
|
||||
help=('List of routed network subnets for provisioning '
|
||||
'and introspection. Comma separated list of names/tags. '
|
||||
'For each network a section/group needs to be added to '
|
||||
'the configuration file with these parameters set: '
|
||||
'cidr, dhcp_start, dhcp_end, inspection_iprange and '
|
||||
'gateway.'
|
||||
'\n\n'
|
||||
'Example:\n\n'
|
||||
'subnets = subnet1,subnet2\n'
|
||||
'\n'
|
||||
'An example section/group in config file:\n'
|
||||
'\n'
|
||||
'[subnet1]\n'
|
||||
'cidr = 192.168.10.0/24\n'
|
||||
'dhcp_start = 192.168.10.100\n'
|
||||
'dhcp_end = 192.168.10.200\n'
|
||||
'inspection_iprange = 192.168.10.20,192.168.10.90\n'
|
||||
'gateway = 192.168.10.254\n'
|
||||
'\n'
|
||||
'[subnet2]\n'
|
||||
'. . .\n')),
|
||||
cfg.StrOpt('local_subnet',
|
||||
default=SUBNETS_DEFAULT[0],
|
||||
help=('Name of the local subnet, where the PXE boot and DHCP '
|
||||
'interfaces for overcloud instances is located. The IP '
|
||||
'address of the local_ip/local_interface should reside '
|
||||
'in this subnet.')),
|
||||
cfg.StrOpt('undercloud_service_certificate',
|
||||
default='',
|
||||
help=('Certificate file to use for OpenStack service SSL '
|
||||
|
@ -211,28 +245,12 @@ _opts = [
|
|||
default=1500,
|
||||
help=('MTU to use for the local_interface.')
|
||||
),
|
||||
cfg.StrOpt('network_cidr',
|
||||
default='192.168.24.0/24',
|
||||
help=('Network CIDR for the Neutron-managed network for '
|
||||
'Overcloud instances. This should be the subnet used '
|
||||
'for PXE booting.')
|
||||
),
|
||||
cfg.StrOpt('masquerade_network',
|
||||
default='192.168.24.0/24',
|
||||
help=('Network that will be masqueraded for external access, '
|
||||
'if required. This should be the subnet used for PXE '
|
||||
'booting.')
|
||||
),
|
||||
cfg.StrOpt('dhcp_start',
|
||||
default='192.168.24.5',
|
||||
help=('Start of DHCP allocation range for PXE and DHCP of '
|
||||
'Overcloud instances.')
|
||||
),
|
||||
cfg.StrOpt('dhcp_end',
|
||||
default='192.168.24.24',
|
||||
help=('End of DHCP allocation range for PXE and DHCP of '
|
||||
'Overcloud instances.')
|
||||
),
|
||||
cfg.StrOpt('hieradata_override',
|
||||
default='',
|
||||
help=('Path to hieradata override file. If set, the file will '
|
||||
|
@ -257,14 +275,6 @@ _opts = [
|
|||
help=('Network interface on which inspection dnsmasq will '
|
||||
'listen. If in doubt, use the default value.')
|
||||
),
|
||||
cfg.StrOpt('inspection_iprange',
|
||||
default='192.168.24.100,192.168.24.120',
|
||||
deprecated_name='discovery_iprange',
|
||||
help=('Temporary IP range that will be given to nodes during '
|
||||
'the inspection process. Should not overlap with the '
|
||||
'range defined by dhcp_start and dhcp_end, but should '
|
||||
'be in the same network.')
|
||||
),
|
||||
cfg.BoolOpt('inspection_extras',
|
||||
default=True,
|
||||
help=('Whether to enable extra hardware collection during '
|
||||
|
@ -385,6 +395,37 @@ _opts = [
|
|||
% ' '.join(validator.SUPPORTED_ARCHITECTURES))),
|
||||
]
|
||||
|
||||
# Routed subnets
|
||||
_subnets_opts = [
|
||||
cfg.StrOpt('cidr',
|
||||
default='192.168.24.0/24',
|
||||
deprecated_opts=_deprecated_opt_network_cidr,
|
||||
help=('Network CIDR for the Neutron-managed subnet for '
|
||||
'Overcloud instances.')),
|
||||
cfg.StrOpt('dhcp_start',
|
||||
default='192.168.24.5',
|
||||
deprecated_opts=_deprecated_opt_dhcp_start,
|
||||
help=('Start of DHCP allocation range for PXE and DHCP of '
|
||||
'Overcloud instances on this network.')),
|
||||
cfg.StrOpt('dhcp_end',
|
||||
default='192.168.24.24',
|
||||
deprecated_opts=_deprecated_opt_dhcp_end,
|
||||
help=('End of DHCP allocation range for PXE and DHCP of '
|
||||
'Overcloud instances on this network.')),
|
||||
cfg.StrOpt('inspection_iprange',
|
||||
default='192.168.24.100,192.168.24.120',
|
||||
deprecated_opts=_deprecated_opt_inspection_iprange,
|
||||
help=('Temporary IP range that will be given to nodes on this '
|
||||
'network during the inspection process. Should not '
|
||||
'overlap with the range defined by dhcp_start and '
|
||||
'dhcp_end, but should be in the same ip subnet.')),
|
||||
cfg.StrOpt('gateway',
|
||||
default='192.168.24.1',
|
||||
deprecated_opts=_deprecated_opt_network_gateway,
|
||||
help=('Network gateway for the Neutron-managed network for '
|
||||
'Overcloud instances on this network.')),
|
||||
]
|
||||
|
||||
# Passwords, tokens, hashes
|
||||
_auth_opts = [
|
||||
cfg.StrOpt('undercloud_db_password',
|
||||
|
@ -512,8 +553,15 @@ CONF.register_opts(_opts)
|
|||
CONF.register_opts(_auth_opts, group='auth')
|
||||
|
||||
|
||||
def _load_subnets_config_groups():
|
||||
for group in CONF.subnets:
|
||||
g = cfg.OptGroup(name=group, title=group)
|
||||
CONF.register_opts(_subnets_opts, group=g)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return [(None, copy.deepcopy(_opts)),
|
||||
(SUBNETS_DEFAULT[0], copy.deepcopy(_subnets_opts)),
|
||||
('auth', copy.deepcopy(_auth_opts)),
|
||||
]
|
||||
|
||||
|
@ -722,6 +770,12 @@ def _validate_network():
|
|||
raise validator.FailedValidation(message)
|
||||
|
||||
params = {opt.name: CONF[opt.name] for opt in _opts}
|
||||
# Get parameters of "local_subnet", pass to validator to ensure parameters
|
||||
# such as "local_ip", "undercloud_public_host" and "undercloud_admin_host"
|
||||
# are valid
|
||||
local_subnet_opts = CONF.get(CONF.local_subnet)
|
||||
params.update({opt.name: local_subnet_opts[opt.name]
|
||||
for opt in _subnets_opts})
|
||||
validator.validate_config(params, error_handler)
|
||||
|
||||
|
||||
|
@ -749,7 +803,7 @@ def _validate_no_ip_change():
|
|||
if existing_ip != CONF.local_ip:
|
||||
message = ('Changing the local_ip is not allowed. Existing IP: '
|
||||
'%s, Configured IP: %s') % (existing_ip,
|
||||
CONF.network_cidr)
|
||||
CONF.local_ip)
|
||||
LOG.error(message)
|
||||
raise validator.FailedValidation(message)
|
||||
|
||||
|
@ -1084,6 +1138,7 @@ class InstackEnvironment(dict):
|
|||
'ENABLED_RAID_INTERFACES', 'ENABLED_VENDOR_INTERFACES',
|
||||
'ENABLED_MANAGEMENT_INTERFACES', 'SYSCTL_SETTINGS',
|
||||
'LOCAL_IP_WRAPPED', 'ENABLE_ARCHITECTURE_PPC64LE',
|
||||
'INSPECTION_IPRANGE',
|
||||
}
|
||||
"""The variables we calculate in _generate_environment call."""
|
||||
|
||||
|
@ -1273,6 +1328,9 @@ def _generate_environment(instack_root):
|
|||
inspection_kernel_args.append('ipa-collect-lldp=1')
|
||||
|
||||
instack_env['INSPECTION_KERNEL_ARGS'] = ' '.join(inspection_kernel_args)
|
||||
# TODO(hjensas): Remove this when switching to INSPECTION_SUBNETS
|
||||
instack_env['INSPECTION_IPRANGE'] = CONF.get(
|
||||
CONF.local_subnet).inspection_iprange
|
||||
|
||||
_process_drivers_and_hardware_types(instack_env)
|
||||
|
||||
|
@ -1975,24 +2033,24 @@ def _get_subnet(sdk, cidr, network_id):
|
|||
|
||||
|
||||
def _config_neutron_segments_and_subnets(sdk, ctlplane_id):
|
||||
s = CONF.get(CONF.local_subnet)
|
||||
host_routes = [{'destination': '169.254.169.254/32',
|
||||
'nexthop': str(netaddr.IPNetwork(CONF.local_ip).ip)}]
|
||||
allocation_pool = [{'start': CONF.dhcp_start, 'end': CONF.dhcp_end}]
|
||||
allocation_pool = [{'start': s.dhcp_start, 'end': s.dhcp_end}]
|
||||
|
||||
subnet = _get_subnet(sdk, CONF.network_cidr, ctlplane_id)
|
||||
if subnet:
|
||||
_neutron_subnet_update(sdk, subnet.id, CONF.network_gateway,
|
||||
host_routes, allocation_pool,
|
||||
CTLPLANE_SUBNET_NAME)
|
||||
_neutron_subnet_update(sdk, subnet.id, s.gateway, host_routes,
|
||||
allocation_pool, CONF.local_subnet)
|
||||
else:
|
||||
subnet = _neutron_subnet_create(sdk, ctlplane_id, CONF.network_cidr,
|
||||
CONF.network_gateway, host_routes,
|
||||
allocation_pool, CTLPLANE_SUBNET_NAME)
|
||||
subnet = _neutron_subnet_create(sdk, ctlplane_id, s.cidr, s.gateway,
|
||||
host_routes, allocation_pool,
|
||||
CONF.local_subnet)
|
||||
|
||||
# If the subnet is IPv6 we need to start a router so that router
|
||||
# advertisments are sent out for stateless IP addressing to work.
|
||||
if ':' in CONF.dhcp_start:
|
||||
_ensure_neutron_router(sdk, CTLPLANE_SUBNET_NAME, subnet.id)
|
||||
_ensure_neutron_router(sdk, CONF.local_subnet, subnet.id)
|
||||
|
||||
|
||||
def _handle_upgrade_fact(upgrade=False):
|
||||
|
@ -2047,6 +2105,10 @@ def install(instack_root, upgrade=False):
|
|||
_configure_logging(DEFAULT_LOG_LEVEL, PATHS.LOG_FILE)
|
||||
LOG.info('Logging to %s', PATHS.LOG_FILE)
|
||||
_load_config()
|
||||
_load_subnets_config_groups()
|
||||
# Since 'subnets' parameter in opts is used to dynamically
|
||||
# add per network groups, re-load config.
|
||||
_load_config()
|
||||
_clean_os_refresh_config()
|
||||
_clean_os_collect_config()
|
||||
_validate_configuration()
|
||||
|
|
|
@ -95,7 +95,7 @@ def _validate_value_formats(params, error_callback):
|
|||
|
||||
|
||||
def _validate_in_cidr(params, error_callback):
|
||||
cidr = netaddr.IPNetwork(params['network_cidr'])
|
||||
cidr = netaddr.IPNetwork(params['cidr'])
|
||||
|
||||
def validate_addr_in_cidr(params, name, pretty_name=None, require_ip=True):
|
||||
try:
|
||||
|
@ -116,7 +116,7 @@ def _validate_in_cidr(params, error_callback):
|
|||
params['inspection_start'] = inspection_iprange[0]
|
||||
params['inspection_end'] = inspection_iprange[1]
|
||||
validate_addr_in_cidr(params, 'just_local_ip', 'local_ip')
|
||||
validate_addr_in_cidr(params, 'network_gateway')
|
||||
validate_addr_in_cidr(params, 'gateway')
|
||||
# NOTE(bnemec): The ui needs to be externally accessible, which means in
|
||||
# many cases we can't have the public vip on the provisioning network.
|
||||
# In that case users are on their own to ensure they've picked valid
|
||||
|
|
|
@ -18,11 +18,6 @@
|
|||
# portion of the value. (string value)
|
||||
#local_ip = 192.168.24.1/24
|
||||
|
||||
# Network gateway for the Neutron-managed network for Overcloud
|
||||
# instances. This should match the local_ip above when using
|
||||
# masquerading. (string value)
|
||||
#network_gateway = 192.168.24.1
|
||||
|
||||
# Virtual IP or DNS address to use for the public endpoints of
|
||||
# Undercloud services. Only used with SSL. (string value)
|
||||
# Deprecated group/name - [DEFAULT]/undercloud_public_vip
|
||||
|
@ -44,6 +39,35 @@
|
|||
# value)
|
||||
#overcloud_domain_name = localdomain
|
||||
|
||||
# List of routed network subnets for provisioning and introspection.
|
||||
# Comma separated list of names/tags. For each network a section/group
|
||||
# needs to be added to the configuration file with these parameters
|
||||
# set: cidr, dhcp_start, dhcp_end, inspection_iprange and gateway.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# subnets = subnet1,subnet2
|
||||
#
|
||||
# An example section/group in config file:
|
||||
#
|
||||
# [subnet1]
|
||||
# cidr = 192.168.10.0/24
|
||||
# dhcp_start = 192.168.10.100
|
||||
# dhcp_end = 192.168.10.200
|
||||
# inspection_iprange = 192.168.10.20,192.168.10.90
|
||||
# gateway = 192.168.10.254
|
||||
#
|
||||
# [subnet2]
|
||||
# . . .
|
||||
# (list value)
|
||||
#subnets = ctlplane-subnet
|
||||
|
||||
# Name of the local subnet, where the PXE boot and DHCP interfaces for
|
||||
# overcloud instances is located. The IP address of the
|
||||
# local_ip/local_interface should reside in this subnet. (string
|
||||
# value)
|
||||
#local_subnet = ctlplane-subnet
|
||||
|
||||
# Certificate file to use for OpenStack service SSL connections.
|
||||
# Setting this enables SSL for the OpenStack API endpoints, leaving it
|
||||
# unset disables SSL. (string value)
|
||||
|
@ -78,23 +102,10 @@
|
|||
# MTU to use for the local_interface. (integer value)
|
||||
#local_mtu = 1500
|
||||
|
||||
# Network CIDR for the Neutron-managed network for Overcloud
|
||||
# instances. This should be the subnet used for PXE booting. (string
|
||||
# value)
|
||||
#network_cidr = 192.168.24.0/24
|
||||
|
||||
# Network that will be masqueraded for external access, if required.
|
||||
# This should be the subnet used for PXE booting. (string value)
|
||||
#masquerade_network = 192.168.24.0/24
|
||||
|
||||
# Start of DHCP allocation range for PXE and DHCP of Overcloud
|
||||
# instances. (string value)
|
||||
#dhcp_start = 192.168.24.5
|
||||
|
||||
# End of DHCP allocation range for PXE and DHCP of Overcloud
|
||||
# instances. (string value)
|
||||
#dhcp_end = 192.168.24.24
|
||||
|
||||
# Path to hieradata override file. If set, the file will be copied
|
||||
# under /etc/puppet/hieradata and set as the first file in the hiera
|
||||
# hierarchy. This can be used to custom configure services beyond what
|
||||
|
@ -113,12 +124,6 @@
|
|||
# Deprecated group/name - [DEFAULT]/discovery_interface
|
||||
#inspection_interface = br-ctlplane
|
||||
|
||||
# Temporary IP range that will be given to nodes during the inspection
|
||||
# process. Should not overlap with the range defined by dhcp_start
|
||||
# and dhcp_end, but should be in the same network. (string value)
|
||||
# Deprecated group/name - [DEFAULT]/discovery_iprange
|
||||
#inspection_iprange = 192.168.24.100,192.168.24.120
|
||||
|
||||
# Whether to enable extra hardware collection during the inspection
|
||||
# process. Requires python-hardware or python-hardware-detect package
|
||||
# on the introspection image. (boolean value)
|
||||
|
@ -343,3 +348,37 @@
|
|||
# Novajoin vendordata plugin service password. If left unset, one will
|
||||
# be automatically generated. (string value)
|
||||
#undercloud_novajoin_password = <None>
|
||||
|
||||
|
||||
[ctlplane-subnet]
|
||||
|
||||
#
|
||||
# From instack-undercloud
|
||||
#
|
||||
|
||||
# Network CIDR for the Neutron-managed subnet for Overcloud instances.
|
||||
# (string value)
|
||||
# Deprecated group/name - [DEFAULT]/network_cidr
|
||||
#cidr = 192.168.24.0/24
|
||||
|
||||
# Start of DHCP allocation range for PXE and DHCP of Overcloud
|
||||
# instances on this network. (string value)
|
||||
# Deprecated group/name - [DEFAULT]/dhcp_start
|
||||
#dhcp_start = 192.168.24.5
|
||||
|
||||
# End of DHCP allocation range for PXE and DHCP of Overcloud instances
|
||||
# on this network. (string value)
|
||||
# Deprecated group/name - [DEFAULT]/dhcp_end
|
||||
#dhcp_end = 192.168.24.24
|
||||
|
||||
# Temporary IP range that will be given to nodes on this network
|
||||
# during the inspection process. Should not overlap with the range
|
||||
# defined by dhcp_start and dhcp_end, but should be in the same ip
|
||||
# subnet. (string value)
|
||||
# Deprecated group/name - [DEFAULT]/inspection_iprange
|
||||
#inspection_iprange = 192.168.24.100,192.168.24.120
|
||||
|
||||
# Network gateway for the Neutron-managed network for Overcloud
|
||||
# instances on this network. (string value)
|
||||
# Deprecated group/name - [DEFAULT]/network_gateway
|
||||
#gateway = 192.168.24.1
|
||||
|
|
Loading…
Reference in New Issue