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:
parent
7945d7f01a
commit
3b0ae6c43f
@ -368,8 +368,12 @@ class NetworkingFloatingIPModule(OpenStackModule):
|
||||
for ip in ips:
|
||||
if ip['fixed_ip_address']:
|
||||
# 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
|
||||
# ip from an instance, but there might be a delay until a
|
||||
|
@ -1111,8 +1111,9 @@ class ServerModule(OpenStackModule):
|
||||
for ip in remove_ips:
|
||||
ip_id = self.conn.network.find_ip(name_or_id=ip,
|
||||
ignore_missing=False).id
|
||||
# self.network.update_ip(ip_id, port_id=None) would not handle
|
||||
# nova network which self.conn.detach_ip_from_server() does
|
||||
# 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=server.id,
|
||||
floating_ip_id=ip_id)
|
||||
return server
|
||||
|
Loading…
x
Reference in New Issue
Block a user