Handle case where no networks are selected at create

Currently trove will error when no networks are selected
and no management network is configured. This change will
pass in None as the nics to nova server create which will
let nova choose the network.

Change-Id: Ica4f888bf1bc7b771cdfcb0af5c104b2aa6410fe
Story: 2008213
Task: 40999
This commit is contained in:
Sam Morrison 2020-10-01 09:06:53 +10:00 committed by Lingxian Kong
parent 7e4927086d
commit a5a5c5e060
1 changed files with 3 additions and 0 deletions

View File

@ -511,6 +511,9 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
self.id)
networks.append({"port-id": port_id})
if not CONF.management_networks and not networks:
return None
# Create port in the user defined network, associate floating IP if
# needed
if len(networks) > 1 or not CONF.management_networks: