python-openstackclient/releasenotes/notes/floating-ip-multi-port-9779e88f590cae23.yaml
melanie witt 013c9a4f3a Handle multiple ports in AddFloatingIP
AddFloatingIP refers to an old nova proxy API to neutron that was
deprecated in nova. The neutron API for floating IP associate requires
a port to be specified. Currently, the code is selecting the first port
if the server has multiple ports. But, an attempt to associate the
first port with a floating IP can fail if the first port is not on a
network that is attached to an external gateway.

In order to make the command work better for users who have a server
with multiple ports, we can:

  1. Select the port corresponding to the fixed_ip_address, if one was
     specified

  2. Try to associate the floating IP with each port until one of the
     attempts succeeds, else re-raise the last exception.
     (404 ExternalGatewayForFloatingIPNotFound from neutron)

This also fixes incorrect FakeFloatingIP attributes that were being set
in the TestServerAddFloatingIPNetwork unit tests, which were causing
the tests to use None as parsed args for ip-address and
--fixed-ip-address and thus bypassing code in the
'if parsed_args.fixed_ip_address:' block.

Task: 27800
Story: 2004263

Change-Id: I11fbcebf6b00f12a030b000c84dcf1d6b5e86250
2018-11-06 20:18:13 +00:00

15 lines
859 B
YAML

---
fixes:
- |
The ``openstack server add floating ip`` command has been fixed to handle
servers with multiple ports attached. Previously, the command was using
the first port in the port list when attempting to associate the floating
ip. This could fail if the server had multiple ports and the first port
in the list was not attached to an external gateway. Another way it could
fail is if the ``--fixed-ip-address`` option was passed and the first port
did not have the specified fixed IP address attached to it.
Now, the ``openstack server add floating ip`` command will find the port
attached to the specified ``--fixed-ip-address``, if provided, else it will
try multiple ports until one is found attached to an external gateway. If
a suitable port is not found in the port list, an error will be returned.