Skip to content

Commit 53a6c2a

Browse files
committed
Implements: #1579
1 parent 3b44632 commit 53a6c2a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

IM/connectors/OpenStack.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ def get_router_public(self, driver, radl, inf_id, create=False):
973973
# try to create a router
974974
if create and pub_nets:
975975
try:
976+
self.log_debug("Creating public router.")
976977
gateway_info = {'network_id': list(pub_nets.keys())[0]}
977978
name = "im-%s" % (inf_id)
978979
return driver.ex_create_router(name, description="IM created router",
@@ -1033,7 +1034,7 @@ def create_networks(self, driver, radl, inf):
10331034
"""
10341035
try:
10351036
i = 0
1036-
router = self.get_router_public(driver, radl, inf.id, create=True)
1037+
router = self.get_router_public(driver, radl, inf.id, create=False)
10371038

10381039
while radl.systems[0].getValue("net_interface." + str(i) + ".connection"):
10391040
net_name = radl.systems[0].getValue("net_interface." + str(i) + ".connection")
@@ -1090,8 +1091,14 @@ def create_networks(self, driver, radl, inf):
10901091
raise Exception("Error creating ost subnet for net %s: %s" % (net_name,
10911092
get_ex_error(ex)))
10921093

1094+
# There are no routers in the site
10931095
if router is None:
1094-
self.log_warn("No public router found.")
1096+
self.log_debug("No public router found.")
1097+
# Try to create one
1098+
router = self.get_router_public(driver, radl, inf.id, create=True)
1099+
1100+
if router is None:
1101+
self.log_warn("No public router found and cannot be created.")
10951102
else:
10961103
self.log_info("Adding subnet %s to the router %s" % (ost_subnet.name, router.name))
10971104
try:

0 commit comments

Comments
 (0)