dynamic_inventory.py generates duplicate IP addresses
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack-Ansible |
Invalid
|
High
|
Unassigned | ||
Kilo |
Fix Released
|
High
|
Nolan Brubaker | ||
Trunk |
Invalid
|
High
|
Unassigned |
Bug Description
When upgrading from Juno to Kilo, the data structures in the inventory have changed, which can result in duplicated IP addresses among the containers, particularly new ones introduced with Kilo, like the repo servers.
In two separate labs, we've had dynamic_
From one:
```
# scripts/
| heat-node1_
| heat-node2_
# cat /etc/hosts|egrep '9bc3eb67|4b049b34'
172.29.238.156 heat-node2_
172.29.238.156 heat-node1_
```
From another lab:
```
root@578126-
1 172.24.243.25
1 172.24.243.250
1 172.24.243.26
1 172.24.243.28
1 172.24.243.40
1 172.24.243.45
1 172.24.243.67
1 172.24.243.79
1 172.24.243.88
2 172.24.243.230
root@578126-
| 578126-
| 578128-
```
Here's a fresh greenfield container:
```
578126-infra01# ./dynamic_
> /opt/rpc-
-> for host_entry in inventory[
(Pdb) pprint(host_entry)
{u'ansible_
u'component': u'cinder_
u'container_
u'container_name': u'578128-
u'container_
u'physical_host': u'578128-infra03',
u'physical_
u'properties': {u'container_
```
Here is a Juno neutron container in that same loop, using the Kilo dynamic_
```
578126-infra01# ./dynamic_
> /opt/rpc-
-> for host_entry in inventory[
(Pdb) pprint(host_entry)
{u'ansible_
u'component': u'neutron_agent',
u'container_
u'container_name': u'578126-
u'container_
u'container_
u'is_metal': False,
u'physical_host': u'578126-infra01',
u'tunnel_address': u'172.24.238.35',
u'tunnel_netmask': u'255.255.252.0'}
```
Finally, how to reproduce locally, with the following files placed in an `etc/openstack_
From *Kilo*:
* /etc/openstack_
* /etc/openstack_
* /etc/openstack_
* /etc/openstack_
From *Juno*:
* /etc/rpc_
** This can be found in the /etc/rpc_deploy.OLD directory
You can then apply the following patch, which should exit on the first container where an IP that's in use isn't in the USED_IPS list:
```
diff --git a/playbooks/
index b52932a..5ffe2b8 100755
--- a/playbooks/
+++ b/playbooks/
@@ -22,6 +22,7 @@ import netaddr
import os
import Queue
import random
+import sys
import tarfile
import uuid
import yaml
@@ -755,7 +756,6 @@ def _set_used_
else:
-
# Find all used IP addresses and ensure that they are not used again
for host_entry in inventory[
networks = host_entry.
@@ -763,6 +763,16 @@ def _set_used_
if address:
+ # Check if container addresses are missing from used list
+ for host_entry in inventory[
+ #if host_entry[
+ # import pdb; pdb.set_trace()
+ # print("%s's container address was not in USED_IPS" % (host_entry[
+ for net_type in ('container', 'tunnel', 'storage'):
+ if host_entry.
+ print("%s_address for %s was not found in USED_IPS"
+ % (net_type, host_entry[
+ sys.exit(255)
```
You can then run `playbooks/
no longer affects: | openstack-ansible/trunk |
Fix proposed to branch: kilo /review. openstack. org/210152
Review: https:/