Workaround multiple private network ports

In the case where there are multiple private networks, don't actively
throw an error. Instead, just grab the first port and attach NAT to it.
That's not completely correct, so a follow up patch is forthcoming that
will add support to os-client-config for such a configuration value.
However, in the mean time, just grab one, because why not.

Change-Id: Ib3a49c0efc72a6de0bdd84c3fe1f34cc5f553a8c
This commit is contained in:
Monty Taylor 2016-03-30 15:18:35 -07:00
parent 75ee8f967d
commit e43625d300
1 changed files with 2 additions and 7 deletions

View File

@ -3141,15 +3141,10 @@ class OpenStackCloud(object):
return (None, None)
port = None
if not fixed_address:
if len(ports) > 1:
raise OpenStackCloudException(
"More than one port was found for server {server}"
" and no fixed_address was specified. It is not"
" possible to infer correct behavior. Please specify"
" a fixed_address - or file a bug in shade describing"
" how you think this should work.")
# We're assuming one, because we have no idea what to do with
# more than one.
# TODO(mordred) Fix this for real by allowing a configurable
# NAT destination setting
port = ports[0]
# Select the first available IPv4 address
for address in port.get('fixed_ips', list()):