Fix external API interface with out an IP address

Steps to reproduce:

* Define a separate network for the external API network
* Don't define a cidr field for the new network (prevents IPs being
  allocated to hosts on this network)
* Set the vip_address field for the network (and optionally fqdn)
* kayobe overcloud host configure
* kayobe overcloud service deploy
* kayobe overcloud host configure (again)

On the final command, keepalived will have created a VIP on the
interface, causing the command to fail with an error like the following:

    Interface eth0 has an IPv4 address but none was requested

This change fixes the issue by passing the VIP address as an allowed
address to the MichaelRigart.interfaces role. This depends on
https://github.com/michaelrigart/ansible-role-interfaces/pull/71.

Change-Id: Ic86c0ca1b8209c968cb20a11bb3f40da71f296d0
Story: 2007736
Task: 39902
This commit is contained in:
Mark Goddard 2020-05-29 14:20:23 +01:00
parent f2c2114370
commit 35f30a61b1
3 changed files with 18 additions and 1 deletions

View File

@ -211,6 +211,8 @@ def net_interface_obj(context, name, inventory_hostname=None):
rules = net_rules(context, name, inventory_hostname) rules = net_rules(context, name, inventory_hostname)
bootproto = net_bootproto(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname)
defroute = net_defroute(context, name, inventory_hostname) defroute = net_defroute(context, name, inventory_hostname)
vip_address = net_vip_address(context, name, inventory_hostname)
allowed_addresses = [vip_address] if vip_address else None
interface = { interface = {
'device': device, 'device': device,
'address': ip, 'address': ip,
@ -222,6 +224,7 @@ def net_interface_obj(context, name, inventory_hostname=None):
'rules': rules, 'rules': rules,
'bootproto': bootproto or 'static', 'bootproto': bootproto or 'static',
'defroute': defroute, 'defroute': defroute,
'allowed_addresses': allowed_addresses,
'onboot': 'yes', 'onboot': 'yes',
} }
interface = {k: v for k, v in interface.items() if v is not None} interface = {k: v for k, v in interface.items() if v is not None}
@ -255,6 +258,8 @@ def net_bridge_obj(context, name, inventory_hostname=None):
rules = net_rules(context, name, inventory_hostname) rules = net_rules(context, name, inventory_hostname)
bootproto = net_bootproto(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname)
defroute = net_defroute(context, name, inventory_hostname) defroute = net_defroute(context, name, inventory_hostname)
vip_address = net_vip_address(context, name, inventory_hostname)
allowed_addresses = [vip_address] if vip_address else None
interface = { interface = {
'device': device, 'device': device,
'address': ip, 'address': ip,
@ -267,6 +272,7 @@ def net_bridge_obj(context, name, inventory_hostname=None):
'rules': rules, 'rules': rules,
'bootproto': bootproto or 'static', 'bootproto': bootproto or 'static',
'defroute': defroute, 'defroute': defroute,
'allowed_addresses': allowed_addresses,
'onboot': 'yes', 'onboot': 'yes',
} }
interface = {k: v for k, v in interface.items() if v is not None} interface = {k: v for k, v in interface.items() if v is not None}
@ -306,6 +312,8 @@ def net_bond_obj(context, name, inventory_hostname=None):
rules = net_rules(context, name, inventory_hostname) rules = net_rules(context, name, inventory_hostname)
bootproto = net_bootproto(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname)
defroute = net_defroute(context, name, inventory_hostname) defroute = net_defroute(context, name, inventory_hostname)
vip_address = net_vip_address(context, name, inventory_hostname)
allowed_addresses = [vip_address] if vip_address else None
interface = { interface = {
'device': device, 'device': device,
'address': ip, 'address': ip,
@ -324,6 +332,7 @@ def net_bond_obj(context, name, inventory_hostname=None):
'rules': rules, 'rules': rules,
'bootproto': bootproto or 'static', 'bootproto': bootproto or 'static',
'defroute': defroute, 'defroute': defroute,
'allowed_addresses': allowed_addresses,
'onboot': 'yes', 'onboot': 'yes',
} }
interface = {k: v for k, v in interface.items() if v is not None} interface = {k: v for k, v in interface.items() if v is not None}

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixes an issue when configuring the external API network interface on
controllers without an IP address which would cause ``kayobe overcloud host
configure`` to fail on a host with an active virtual IP address. See
`story 2007736 <https://storyboard.openstack.org/#!/story/2007736>`__ for
details.

View File

@ -5,7 +5,7 @@
# There are no versioned releases of this role. # There are no versioned releases of this role.
version: a5c3c19d0cda7b6960c9200a30b5dbe73d2eef96 version: a5c3c19d0cda7b6960c9200a30b5dbe73d2eef96
- src: MichaelRigart.interfaces - src: MichaelRigart.interfaces
version: v1.4.1 version: v1.5.0
- src: mrlesmithjr.manage-lvm - src: mrlesmithjr.manage-lvm
version: v0.1.4 version: v0.1.4
- src: mrlesmithjr.mdadm - src: mrlesmithjr.mdadm