Ignore floating ips not attached to instances
If floating ip is on a port attached to devices other than a nova compute instance, (e.g. it is attached to a loadbalancer) ignore it. Change-Id: Icda92f0f4b5246aebb082cf48bef751d9e6df2ba
This commit is contained in:
parent
d168e27342
commit
5446a54a65
|
@ -201,7 +201,7 @@ def _get_os_instance_id(context, os_floating_ip, os_ports=[]):
|
|||
if port_id:
|
||||
port = next((port for port in os_ports
|
||||
if port['id'] == port_id), None)
|
||||
if port:
|
||||
if port and port.get('device_owner').startswith('compute:'):
|
||||
os_instance_id = port.get('device_id')
|
||||
return os_instance_id
|
||||
|
||||
|
|
|
@ -669,7 +669,7 @@ OS_PORT_1 = {'id': ID_OS_PORT_1,
|
|||
'fixed_ips': [{'ip_address': IP_NETWORK_INTERFACE_1,
|
||||
'subnet_id': ID_OS_SUBNET_1}],
|
||||
'device_id': None,
|
||||
'device_owner': '',
|
||||
'device_owner': "compute:{}".format(NAME_AVAILABILITY_ZONE),
|
||||
'security_groups': [ID_OS_SECURITY_GROUP_1]}
|
||||
OS_PORT_2 = {'id': ID_OS_PORT_2,
|
||||
'network_id': ID_OS_SUBNET_2,
|
||||
|
@ -683,7 +683,7 @@ OS_PORT_2 = {'id': ID_OS_PORT_2,
|
|||
{'ip_address': IP_NETWORK_INTERFACE_2_EXT_2,
|
||||
'subnet_id': ID_OS_SUBNET_2}],
|
||||
'device_id': ID_OS_INSTANCE_1,
|
||||
'device_owner': '',
|
||||
'device_owner': "compute:{}".format(NAME_AVAILABILITY_ZONE),
|
||||
'security_groups': [ID_OS_SECURITY_GROUP_1],
|
||||
'tenant_id': ID_OS_PROJECT}
|
||||
|
||||
|
|
Loading…
Reference in New Issue