Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0682f043
authored
Jun 20, 2018
by
Szabolcs Gelencser
Committed by
Szabolcs Gelencsér
Jun 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix external network connectivity
parent
6c9a7148
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
circle/circle/settings/base.py
+1
-1
circle/network/models.py
+6
-10
No files found.
circle/circle/settings/base.py
View file @
0682f043
...
@@ -595,7 +595,7 @@ DEFAULT_SUBNETPOOL_PREFIXES = (
...
@@ -595,7 +595,7 @@ DEFAULT_SUBNETPOOL_PREFIXES = (
)
)
DEFAULT_SUBNETPOOL_PREFIX_LEN
=
20
DEFAULT_SUBNETPOOL_PREFIX_LEN
=
20
DEFAULT_
PUBLIC_NETWORK_NAME
=
"public
"
DEFAULT_
EXTERNAL_NETWORK_NAME
=
"Smart1
"
DEFAULT_PUBLIC_ROUTER_NAME_FOR_USER
=
"default_public"
DEFAULT_PUBLIC_ROUTER_NAME_FOR_USER
=
"default_public"
DEFAULT_PUBLIC_ROUTED_NET_NAME_FOR_USER
=
"default_public_routed"
DEFAULT_PUBLIC_ROUTED_NET_NAME_FOR_USER
=
"default_public_routed"
...
...
circle/network/models.py
View file @
0682f043
...
@@ -102,9 +102,9 @@ class SubnetPool(object):
...
@@ -102,9 +102,9 @@ class SubnetPool(object):
class
DefaultPublicRouter
(
object
):
class
DefaultPublicRouter
(
object
):
@classmethod
@classmethod
def
__get_
default_public
_network
(
cls
,
request
):
def
__get_
external
_network
(
cls
,
request
):
nets
=
openstack_api
.
neutron
.
network_list
(
request
)
nets
=
openstack_api
.
neutron
.
network_list
(
request
)
nets
=
[
n
for
n
in
nets
if
n
.
name
==
settings
.
DEFAULT_
PUBLIC
_NETWORK_NAME
]
nets
=
[
n
for
n
in
nets
if
n
.
name
==
settings
.
DEFAULT_
EXTERNAL
_NETWORK_NAME
]
return
nets
[
0
]
if
len
(
nets
)
>
0
else
None
return
nets
[
0
]
if
len
(
nets
)
>
0
else
None
@classmethod
@classmethod
...
@@ -114,30 +114,26 @@ class DefaultPublicRouter(object):
...
@@ -114,30 +114,26 @@ class DefaultPublicRouter(object):
return
routers
[
0
]
if
len
(
routers
)
>
0
else
None
return
routers
[
0
]
if
len
(
routers
)
>
0
else
None
@classmethod
@classmethod
def
create_if_not_exists
(
cls
,
request
,
subnet_id
):
def
create_if_not_exists
(
cls
,
request
,
network
):
default_public_router
=
DefaultPublicRouter
.
__get
(
request
)
default_public_router
=
DefaultPublicRouter
.
__get
(
request
)
if
default_public_router
is
None
:
if
default_public_router
is
None
:
default_public_router
=
openstack_api
.
neutron
.
router_create
(
default_public_router
=
openstack_api
.
neutron
.
router_create
(
request
,
request
,
name
=
settings
.
DEFAULT_PUBLIC_ROUTER_NAME_FOR_USER
,
name
=
settings
.
DEFAULT_PUBLIC_ROUTER_NAME_FOR_USER
,
external_gateway_info
=
{
external_gateway_info
=
{
"network_id"
:
DefaultPublicRouter
.
__get_
default_public
_network
(
request
)
.
id
"network_id"
:
DefaultPublicRouter
.
__get_
external
_network
(
request
)
.
id
}
}
)
)
openstack_api
.
neutron
.
router_add_interface
(
openstack_api
.
neutron
.
router_add_interface
(
request
,
request
,
default_public_router
.
id
,
default_public_router
.
id
,
subnet_id
=
subnet_
id
subnet_id
=
network
.
subnets
[
0
]
.
id
)
)
return
default_public_router
return
default_public_router
class
DefaultPublicRoutedNet
(
object
):
class
DefaultPublicRoutedNet
(
object
):
@classmethod
@classmethod
def
__connect_router
(
cls
,
request
,
default_routed_net
):
DefaultPublicRouter
.
create_if_not_exists
(
request
,
default_routed_net
.
subnets
[
0
]
.
id
)
@classmethod
def
__create_network
(
cls
,
request
):
def
__create_network
(
cls
,
request
):
network_created
=
openstack_api
.
neutron
.
network_create
(
network_created
=
openstack_api
.
neutron
.
network_create
(
request
,
request
,
...
@@ -169,7 +165,7 @@ class DefaultPublicRoutedNet(object):
...
@@ -169,7 +165,7 @@ class DefaultPublicRoutedNet(object):
default_routed_net
=
DefaultPublicRoutedNet
.
__get
(
request
)
default_routed_net
=
DefaultPublicRoutedNet
.
__get
(
request
)
if
default_routed_net
is
None
:
if
default_routed_net
is
None
:
default_routed_net
=
DefaultPublicRoutedNet
.
__create_network
(
request
)
default_routed_net
=
DefaultPublicRoutedNet
.
__create_network
(
request
)
DefaultPublicRoute
dNet
.
__connect_router
(
request
,
default_routed_net
)
DefaultPublicRoute
r
.
create_if_not_exists
(
request
,
default_routed_net
)
return
default_routed_net
return
default_routed_net
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment