os_server: Remove nova_client usage (#40765)

The os_server module uses the deprecated nova_client function, and
therefore ends up requiring python-novaclient installed. In this
patch we switch the ip detachment to make use of a shade function,
removing the need for python-novaclient.

(cherry picked from commit 055d89cd32)
pull/40770/merge
Jesse Pretorius 7 years ago committed by Matt Davis
parent 723dcea33e
commit d525d7cf5f

@ -562,10 +562,12 @@ def _update_server(module, cloud, server):
return (changed, server)
def _delete_floating_ip_list(cloud, server, extra_ips):
def _detach_ip_list(cloud, server, extra_ips):
for ip in extra_ips:
cloud.nova_client.servers.remove_floating_ip(
server=server.id, address=ip)
ip_id = cloud.get_floating_ip(
id=None, filters={'floating_ip_address': ip})
cloud.detach_ip_from_server(
server_id=server.id, floating_ip_id=ip_id)
def _check_ips(module, cloud, server):
@ -606,7 +608,7 @@ def _check_ips(module, cloud, server):
if ip not in floating_ips:
extra_ips.append(ip)
if extra_ips:
_delete_floating_ip_list(cloud, server, extra_ips)
_detach_ip_list(cloud, server, extra_ips)
changed = True
elif auto_ip:
if server['interface_ip']:

Loading…
Cancel
Save