Merge "Inspector set baremetal port physical_network"

This commit is contained in:
Zuul 2020-05-12 19:32:15 +00:00 committed by Gerrit Code Review
commit 178a48e793
3 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
fixes:
- |
The undercloud install now configures ironic inspector to automatically
populate the physical_network field on baremetal provisioning ports. See
bug `1870529 <https://launchpad.net/bugs/1870529>`_.

View File

@ -184,6 +184,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -230,6 +231,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'fd12:3456:789a:1::/64': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -279,6 +281,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'fd12:3456:789a:1::/64': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -356,6 +359,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -386,6 +390,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.10.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -418,6 +423,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.10.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -449,6 +455,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -478,6 +485,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -508,6 +516,7 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'tag': 'ctlplane-subnet', 'tag': 'ctlplane-subnet',
'mtu': 1500}], 'mtu': 1500}],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
'ctlplane-subnet': { 'ctlplane-subnet': {
'AllocationPools': [ 'AllocationPools': [
@ -585,6 +594,9 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'192.168.24.0/24': ['192.168.24.0/24', '192.168.24.0/24': ['192.168.24.0/24',
'192.168.10.0/24', '192.168.10.0/24',
'192.168.20.0/24']}, '192.168.20.0/24']},
'PortPhysnetCidrMap': {'192.168.10.0/24': 'subnet1',
'192.168.20.0/24': 'subnet2',
'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
# The ctlplane-subnet subnet have defaults # The ctlplane-subnet subnet have defaults
'ctlplane-subnet': { 'ctlplane-subnet': {
@ -662,6 +674,9 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'mtu': 1500} 'mtu': 1500}
], ],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.10.0/24': 'subnet1',
'192.168.20.0/24': 'subnet2',
'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
# The ctlplane-subnet subnet have defaults # The ctlplane-subnet subnet have defaults
'ctlplane-subnet': { 'ctlplane-subnet': {
@ -721,6 +736,8 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'mtu': 1500}, 'mtu': 1500},
], ],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.10.0/24': 'subnet1',
'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
# The ctlplane-subnet subnet have defaults # The ctlplane-subnet subnet have defaults
'ctlplane-subnet': { 'ctlplane-subnet': {
@ -773,6 +790,8 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'mtu': 1500}, 'mtu': 1500},
], ],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.10.0/24': 'subnet1',
'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
# The ctlplane-subnet subnet have defaults # The ctlplane-subnet subnet have defaults
'ctlplane-subnet': { 'ctlplane-subnet': {
@ -854,6 +873,9 @@ class TestNetworkSettings(TestBaseNetworkSettings):
'mtu': 1500} 'mtu': 1500}
], ],
'MasqueradeNetworks': {}, 'MasqueradeNetworks': {},
'PortPhysnetCidrMap': {'192.168.10.0/24': 'subnet1',
'192.168.20.0/24': 'subnet2',
'192.168.24.0/24': 'ctlplane'},
'UndercloudCtlplaneSubnets': { 'UndercloudCtlplaneSubnets': {
# The ctlplane-subnet subnet have defaults # The ctlplane-subnet subnet have defaults
'ctlplane-subnet': { 'ctlplane-subnet': {

View File

@ -354,10 +354,23 @@ def _calculate_allocation_pools(subnet):
for ip_range in list(ip_set.iter_ipranges())] for ip_range in list(ip_set.iter_ipranges())]
def _generate_inspection_physnet_cidr_map():
cidr_map = {}
for subnet in CONF.subnets:
s = CONF.get(subnet)
if subnet == str(CONF.local_subnet):
cidr_map[s.cidr] = 'ctlplane'
else:
cidr_map[s.cidr] = subnet
return cidr_map
def _process_network_args(env): def _process_network_args(env):
"""Populate the environment with network configuration.""" """Populate the environment with network configuration."""
env['IronicInspectorSubnets'] = _generate_inspection_subnets() env['IronicInspectorSubnets'] = _generate_inspection_subnets()
env['PortPhysnetCidrMap'] = _generate_inspection_physnet_cidr_map()
env['ControlPlaneStaticRoutes'] = _generate_subnets_static_routes() env['ControlPlaneStaticRoutes'] = _generate_subnets_static_routes()
env['UndercloudCtlplaneSubnets'] = {} env['UndercloudCtlplaneSubnets'] = {}
env['UndercloudCtlplaneIPv6AddressMode'] = CONF['ipv6_address_mode'] env['UndercloudCtlplaneIPv6AddressMode'] = CONF['ipv6_address_mode']