summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Morrison <sorrison@gmail.com>2020-10-01 09:06:53 +1000
committerLingxian Kong <anlin.kong@gmail.com>2020-10-01 08:36:40 +0000
commita5a5c5e060c37c4d0ec5fff125253ca02c1f1817 (patch)
treee28586e9d0cd66ffa003229b62ad4548eaf16bc6
parent7e4927086d7db9c6ea6130f94209b00ef8ca0ebd (diff)
downloadtrove-a5a5c5e060c37c4d0ec5fff125253ca02c1f1817.tar.gz
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
-rwxr-xr-xtrove/taskmanager/models.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/trove/taskmanager/models.py b/trove/taskmanager/models.py
index 9e3253f3..5c0d28f5 100755
--- a/trove/taskmanager/models.py
+++ b/trove/taskmanager/models.py
@@ -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: