Merge "Only try to delete floating ip if the server has it"
This commit is contained in:
commit
b2f9546dcf
|
@ -632,7 +632,15 @@ class ProviderManager(TaskManager):
|
|||
# This will either get the server or raise an exception
|
||||
server = self.getServerFromList(server_id)
|
||||
|
||||
if self.hasExtension('os-floating-ips'):
|
||||
has_floating_ip = False
|
||||
for (name, network) in server['addresses'].iteritems():
|
||||
for interface_spec in network:
|
||||
if interface_spec['version'] != 4:
|
||||
continue
|
||||
if ('OS-EXT-IPS:type' in interface_spec
|
||||
and interface_spec['OS-EXT-IPS:type'] == 'floating'):
|
||||
has_floating_ip = True
|
||||
if has_floating_ip:
|
||||
for ip in self.listFloatingIPs():
|
||||
if ip['instance_id'] == server_id:
|
||||
self.log.debug('Deleting floating ip for server %s' %
|
||||
|
|
Loading…
Reference in New Issue