2

In the past I used available_floating_ip to create a new floating ip and attach it to an instance or use an existing non-attached floating ip and attach it to an instance.

For some reason the latter no longer works now (might be an update?). When a non-attached floating ip exists, available_floating_ip(network, server) returns the ip correctly, but doesn't attach it anymore to the server.

I filed a bug report, but am simultaneously looking for an alternative solution. So I was looking for an option to add a floating ip manually to a server. To my surprise I could find no such method in connection and in the compute REST API I only saw the deprecated add floating ip.

What should I use to add my floating_ip to the server?

Natan
  • 728
  • 1
  • 7
  • 23
  • I note that you haven't answered the comments on your bug report asking you to supply more information. If you want someone to investigate and fix the problem (or tell you what you are doing wrong!) you would be advised to respond. – Stephen C Oct 09 '22 at 11:34

1 Answers1

1
conn = create_connection(...)
server = create_server(...)
If you have only one single external network:
  • you could use connection with add_auto_ip method: Add a floating IP to a server.
conn.add_auto_ip(server)
float_ip = conn.available_floating_ip("Network...", server).floating_ip_address
conn.add_ip_list(server, float_ip)
While using multiple external networks:
conn.compute.add_floating_ip_to_server(server, float_ip)
Victor Lee
  • 2,467
  • 3
  • 19
  • 37