python-openstackclient/openstackclient
melanie witt 010da92ff3 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
(cherry picked from commit 013c9a4f3a)
(cherry picked from commit e09c358e7b)
2018-11-08 20:44:40 +00:00
..
api Re-implement novaclient bits removed in 10.0 2018-04-20 10:08:06 -04:00
common Fix 'project purge' deleting wrong project's servers and volumes 2018-09-17 10:46:36 +00:00
compute Handle multiple ports in AddFloatingIP 2018-11-08 20:44:40 +00:00
identity Allow endpoint filtering on both project and project-domain 2018-10-15 09:32:31 +00:00
image Clean up W503 and E402 pep8 errors 2018-04-20 10:05:12 -04:00
locale/tr_TR/LC_MESSAGES Imported Translations from Zanata 2017-08-16 07:50:55 +00:00
network Do not require port argument when updating floating IP 2018-08-21 16:24:51 +02:00
object Allow objects to be streamed to stdout 2017-07-05 20:08:18 -03:00
tests Handle multiple ports in AddFloatingIP 2018-11-08 20:44:40 +00:00
volume Replace "Display Name" by "Name" in volume list 2017-05-26 11:37:09 +08:00
__init__.py Clean up W503 and E402 pep8 errors 2018-04-20 10:05:12 -04:00
i18n.py Remove log translations 2017-03-21 17:23:09 +08:00
shell.py Useless line of code in shell.py 2017-09-08 06:28:15 +00:00