mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-07-25 09:14:31 +00:00
Use Neutron instead of Nova when detaching floating ips if available
Nova's API for detaching floating ips is deprecated and will fail with a 404 starting from microversion 2.44. It has been replaced with Neutron networking service API [0]. Previously, this did not cause issues because openstacksdk was not passing a microversion for server actions, but this has been fixed in [1]. [0] https://docs.openstack.org/api-ref/compute/#remove-disassociate-floating-ip-removefloatingip-action-deprecated [1] https://review.opendev.org/c/openstack/openstacksdk/+/867890 Change-Id: Idad68d12f4ee163480877418caa93146ea873237
This commit is contained in:
@@ -368,8 +368,12 @@ class NetworkingFloatingIPModule(OpenStackModule):
|
|||||||
for ip in ips:
|
for ip in ips:
|
||||||
if ip['fixed_ip_address']:
|
if ip['fixed_ip_address']:
|
||||||
# Silently ignore that ip might not be attached to server
|
# Silently ignore that ip might not be attached to server
|
||||||
self.conn.compute.remove_floating_ip_from_server(
|
#
|
||||||
self.server, ip['floating_ip_address'])
|
# self.conn.network.update_ip(ip_id, port_id=None) does not
|
||||||
|
# handle nova network but self.conn.detach_ip_from_server()
|
||||||
|
# does so
|
||||||
|
self.conn.detach_ip_from_server(server_id=self.server['id'],
|
||||||
|
floating_ip_id=ip['id'])
|
||||||
|
|
||||||
# OpenStackSDK sets {"port_id": None} to detach a floating
|
# OpenStackSDK sets {"port_id": None} to detach a floating
|
||||||
# ip from an instance, but there might be a delay until a
|
# ip from an instance, but there might be a delay until a
|
||||||
|
|||||||
@@ -1111,8 +1111,9 @@ class ServerModule(OpenStackModule):
|
|||||||
for ip in remove_ips:
|
for ip in remove_ips:
|
||||||
ip_id = self.conn.network.find_ip(name_or_id=ip,
|
ip_id = self.conn.network.find_ip(name_or_id=ip,
|
||||||
ignore_missing=False).id
|
ignore_missing=False).id
|
||||||
# self.network.update_ip(ip_id, port_id=None) would not handle
|
# self.conn.network.update_ip(ip_id, port_id=None) does not
|
||||||
# nova network which self.conn.detach_ip_from_server() does
|
# handle nova network but self.conn.detach_ip_from_server()
|
||||||
|
# does so
|
||||||
self.conn.detach_ip_from_server(server_id=server.id,
|
self.conn.detach_ip_from_server(server_id=server.id,
|
||||||
floating_ip_id=ip_id)
|
floating_ip_id=ip_id)
|
||||||
return server
|
return server
|
||||||
|
|||||||
Reference in New Issue
Block a user