use the same tap for all containers
diff --git a/xos/openstack_observer/steps/sync_container.py b/xos/openstack_observer/steps/sync_container.py
index fdee9e7..8f5940b 100644
--- a/xos/openstack_observer/steps/sync_container.py
+++ b/xos/openstack_observer/steps/sync_container.py
@@ -51,6 +51,7 @@
pd={}
pd["mac"] = port.mac or ""
pd["ip"] = port.ip or ""
+ pd["xos_network_id"] = port.network.id
if o.isolation == "container":
# container on bare metal
@@ -84,7 +85,6 @@
def get_extra_attributes(self, o):
fields={}
fields["ansible_tag"] = "container-%s" % str(o.id)
- fields["container_name"] = "%s-%s" % (o.slice.name, str(o.id))
fields["docker_image"] = o.image.name
fields["ports"] = self.get_ports(o)
if o.volumes:
diff --git a/xos/openstack_observer/steps/sync_container.yaml b/xos/openstack_observer/steps/sync_container.yaml
index 4a050a5..8a1f353 100644
--- a/xos/openstack_observer/steps/sync_container.yaml
+++ b/xos/openstack_observer/steps/sync_container.yaml
@@ -11,6 +11,7 @@
ports:
{% for port in ports %}
- device: {{ port.device }}
+ xos_network_id: {{ port.xos_network_id }}
mac: {{ port.mac|default("") }}
ip: {{ port.ip }}
snoop_instance_mac: {{ port.snoop_instance_mac }}
diff --git a/xos/openstack_observer/templates/start-container.sh.j2 b/xos/openstack_observer/templates/start-container.sh.j2
index 9ed7faa..821bdc7 100644
--- a/xos/openstack_observer/templates/start-container.sh.j2
+++ b/xos/openstack_observer/templates/start-container.sh.j2
@@ -56,12 +56,16 @@
{% endif %}
DEVICE="{{ port.device }}"
+XOS_NETWORK_ID="{{ port.xos_network_id }}"
INSTANCE_MAC="{{ port.snoop_instance_mac }}"
INSTANCE_ID="{{ port.snoop_instance_id }}"
INSTANCE_TAP=`virsh domiflist $INSTANCE_ID | grep -i $INSTANCE_MAC | awk '{print $1}'`
INSTANCE_TAP=${INSTANCE_TAP:3}
VLAN_ID=`ovs-vsctl show | grep -i -A 1 port.*$INSTANCE_TAP | grep -i tag | awk '{print $2}'`
-TAP="con`echo ${CONTAINER}_$DEVICE|md5sum|awk '{print $1}'`"
+# One tap for all containers per XOS/neutron network. Included the VLAN_ID in the
+# hash, to cover the case where XOS is reinstalled and the XOS network ids
+# get reused.
+TAP="con`echo ${XOS_NETWORK_ID}_$VLAN_ID|md5sum|awk '{print $1}'`"
TAP=${TAP:0:10}
echo im=$INSTANCE_MAC ii=$INSTANCE_ID it=$INSTANCE_TAP vlan=$VLAN_ID tap=$TAP con=$CONTAINER dev=$DEVICE mac=$MAC
ovs-vsctl show | grep -i $TAP