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
9e617a76
authored
Mar 07, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add subnet allocation from subnet pool on network creation
parent
1616b560
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
76 deletions
+86
-76
.idea/workspace.xml
+46
-59
circle/circle/settings/base.py
+3
-2
circle/network/models.py
+22
-12
circle/network/views.py
+15
-3
No files found.
.idea/workspace.xml
View file @
9e617a76
...
...
@@ -2,9 +2,9 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"1fbec8af-5a7c-40f9-b994-83ac07d1ae1d"
name=
"Default"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/circle/settings/base.py"
afterPath=
"$PROJECT_DIR$/circle/circle/settings/base.py"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/network/models.py"
afterPath=
"$PROJECT_DIR$/circle/network/models.py"
/>
<change
beforePath=
"$PROJECT_DIR$/circle/network/views.py"
afterPath=
"$PROJECT_DIR$/circle/network/views.py"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"TRACKING_ENABLED"
value=
"true"
/>
...
...
@@ -30,31 +30,33 @@
</component>
<component
name=
"FileEditorManager"
>
<leaf
SIDE_TABS_SIZE_LIMIT_KEY=
"300"
>
<file
leaf-file-name=
"
base.py"
pinned=
"false"
current-in-tab=
"fals
e"
>
<entry
file=
"file://$PROJECT_DIR$/circle/
circle/settings/base
.py"
>
<file
leaf-file-name=
"
views.py"
pinned=
"false"
current-in-tab=
"tru
e"
>
<entry
file=
"file://$PROJECT_DIR$/circle/
network/views
.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"811"
>
<caret
line=
"576"
column=
"27"
lean-forward=
"false"
selection-start-line=
"576"
selection-start-column=
"0"
selection-end-line=
"576"
selection-end-column=
"27"
/>
<folding
/>
<state
relative-caret-position=
"476"
>
<caret
line=
"1015"
column=
"51"
lean-forward=
"false"
selection-start-line=
"1015"
selection-start-column=
"51"
selection-end-line=
"1015"
selection-end-column=
"51"
/>
<folding>
<element
signature=
"e#732#743#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
models.py"
pinned=
"false"
current-in-tab=
"tru
e"
>
<entry
file=
"file://$PROJECT_DIR$/circle/
network/models
.py"
>
<file
leaf-file-name=
"
base.py"
pinned=
"false"
current-in-tab=
"fals
e"
>
<entry
file=
"file://$PROJECT_DIR$/circle/
circle/settings/base
.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
34
2"
>
<caret
line=
"
84"
column=
"101"
lean-forward=
"false"
selection-start-line=
"84"
selection-start-column=
"101"
selection-end-line=
"84"
selection-end-column=
"101
"
/>
<state
relative-caret-position=
"
86
2"
>
<caret
line=
"
579"
column=
"34"
lean-forward=
"false"
selection-start-line=
"579"
selection-start-column=
"34"
selection-end-line=
"579"
selection-end-column=
"34
"
/>
<folding
/>
</state>
</provider>
</entry>
</file>
<file
leaf-file-name=
"
client
.py"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$
USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/neutronclient/v2_0/client
.py"
>
<file
leaf-file-name=
"
models
.py"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$
PROJECT_DIR$/circle/network/models
.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
195
"
>
<caret
line=
"
854"
column=
"8"
lean-forward=
"false"
selection-start-line=
"854"
selection-start-column=
"8"
selection-end-line=
"854"
selection-end-column=
"8
"
/>
<state
relative-caret-position=
"
692
"
>
<caret
line=
"
96"
column=
"72"
lean-forward=
"false"
selection-start-line=
"96"
selection-start-column=
"72"
selection-end-line=
"96"
selection-end-column=
"72
"
/>
<folding
/>
</state>
</provider>
...
...
@@ -163,10 +165,10 @@
<option
value=
"$PROJECT_DIR$/circle/network/templates/network/vxlan-edit.html"
/>
<option
value=
"$PROJECT_DIR$/circle/network/templates/network/vxlan-create.html"
/>
<option
value=
"$PROJECT_DIR$/circle/network/forms.py"
/>
<option
value=
"$PROJECT_DIR$/circle/network/views.py"
/>
<option
value=
"$PROJECT_DIR$/circle/dashboard/views/vm.py"
/>
<option
value=
"$PROJECT_DIR$/circle/circle/settings/base.py"
/>
<option
value=
"$PROJECT_DIR$/circle/network/models.py"
/>
<option
value=
"$PROJECT_DIR$/circle/network/views.py"
/>
</list>
</option>
</component>
...
...
@@ -236,12 +238,6 @@
<item
name=
"cloud"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"circle"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"cloud"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"cloud"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"circle"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"network"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</expand>
<select
/>
</subPane>
...
...
@@ -256,7 +252,7 @@
<property
name=
"settings.editor.selected.configurable"
value=
"watcher.settings"
/>
<property
name=
"NewWatcherDialog.advanced.open"
value=
"true"
/>
<property
name=
"DefaultHtmlFileTemplate"
value=
"HTML File"
/>
<property
name=
"SearchEverywhereHistoryKey"
value=
"
nov	FILE	file:///home/h3yduck/cloud/circle/openstack_api/nova.py nova.p	FILE	file:///home/h3yduck/cloud/circle/openstack_api/nova.py base	FILE	file:///home/h3yduck/cloud/circle/circle/settings/base
.py vmdetailv	null	null editor	null	null networktopo	FILE	file:///home/h3yduck/cloud/circle/network/static/js/horizon.networktopology.js bow	FILE	file:///home/h3yduck/cloud/circle/bower.json base.py	FILE	file:///home/h3yduck/cloud/circle/circle/settings/base.py local	null	null vmdeta	null	null index	null	null vnc	null	null plain	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-plain-image-create.html forms	null	null vxlanform	null	null instanc	FILE	file:///home/h3yduck/cloud/circle/vm/models/instance.py index-vxla	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vxlans.html instance	FILE	file:///home/h3yduck/cloud/circle/vm/models/instance.py _vm-c	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/_vm-create-1.html vmcrea	null	null loginV	null	null index.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html sleep	null	null Deploy	null	null Instance	null	null Vmdeta	null	null list_from	null	null aclupda	null	null base.htm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/base.html method	ACTION	GoToMenuEx base.ht	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/base.html base.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/base.html index.py	FILE	file:///home/h3yduck/cloud/circle/dashboard/views/index.py index.htm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html server	null	null Disk	null	null"
/>
<property
name=
"SearchEverywhereHistoryKey"
value=
"
base	FILE	file:///home/h3yduck/cloud/circle/circle/settings/base.py vxl	null	null nov	FILE	file:///home/h3yduck/cloud/circle/openstack_api/nova.py nova.p	FILE	file:///home/h3yduck/cloud/circle/openstack_api/nova
.py vmdetailv	null	null editor	null	null networktopo	FILE	file:///home/h3yduck/cloud/circle/network/static/js/horizon.networktopology.js bow	FILE	file:///home/h3yduck/cloud/circle/bower.json base.py	FILE	file:///home/h3yduck/cloud/circle/circle/settings/base.py local	null	null vmdeta	null	null index	null	null vnc	null	null plain	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/vm-plain-image-create.html forms	null	null vxlanform	null	null instanc	FILE	file:///home/h3yduck/cloud/circle/vm/models/instance.py index-vxla	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index-vxlans.html instance	FILE	file:///home/h3yduck/cloud/circle/vm/models/instance.py _vm-c	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/_vm-create-1.html vmcrea	null	null loginV	null	null index.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html sleep	null	null Deploy	null	null Instance	null	null Vmdeta	null	null list_from	null	null aclupda	null	null base.htm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/base.html method	ACTION	GoToMenuEx base.ht	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/base.html base.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/base.html index.py	FILE	file:///home/h3yduck/cloud/circle/dashboard/views/index.py index.htm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html server	null	null Disk	null	null"
/>
</component>
<component
name=
"RecentsManager"
>
<key
name=
"MoveFile.RECENT_KEYS"
>
...
...
@@ -362,7 +358,7 @@
<window_info
id=
"Version Control"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.3280757"
sideWeight=
"0.5234139"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Python Console"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.43023255"
sideWeight=
"0.43610224"
order=
"7"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Run"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32769555"
sideWeight=
"0.49574015"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Terminal"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"
tru
e"
show_stripe_button=
"true"
weight=
"0.35200846"
sideWeight=
"0.48988286"
order=
"7"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Terminal"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"
fals
e"
show_stripe_button=
"true"
weight=
"0.35200846"
sideWeight=
"0.48988286"
order=
"7"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Project"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.18051118"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"Docker"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"8"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Database"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"3"
side_tool=
"false"
content_ui=
"tabs"
/>
...
...
@@ -443,16 +439,6 @@
<line>
82
</line>
<option
name=
"timeStamp"
value=
"13"
/>
</line-breakpoint>
<line-breakpoint
enabled=
"true"
suspend=
"THREAD"
type=
"python-line"
>
<url>
file://$PROJECT_DIR$/circle/network/views.py
</url>
<line>
1004
</line>
<option
name=
"timeStamp"
value=
"180"
/>
</line-breakpoint>
<line-breakpoint
enabled=
"true"
suspend=
"THREAD"
type=
"python-line"
>
<url>
file://$PROJECT_DIR$/circle/network/models.py
</url>
<line>
85
</line>
<option
name=
"timeStamp"
value=
"186"
/>
</line-breakpoint>
</breakpoints>
<breakpoints-dialog>
<breakpoints-dialog
/>
...
...
@@ -856,16 +842,6 @@
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/network/views.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"17"
>
<caret
line=
"992"
column=
"30"
lean-forward=
"false"
selection-start-line=
"992"
selection-start-column=
"30"
selection-end-line=
"992"
selection-end-column=
"30"
/>
<folding>
<element
signature=
"e#732#743#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/circle/urls.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"831"
>
...
...
@@ -884,53 +860,63 @@
</state>
</provider>
</entry>
<entry
file=
"file://$
PROJECT_DIR$/circle/circle/settings/base.py
"
>
<entry
file=
"file://$
APPLICATION_HOME_DIR$/helpers/typeshed/stdlib/2/typing.pyi
"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
811
"
>
<caret
line=
"
576"
column=
"27"
lean-forward=
"false"
selection-start-line=
"576"
selection-start-column=
"0"
selection-end-line=
"576"
selection-end-column=
"27
"
/>
<state
relative-caret-position=
"
195
"
>
<caret
line=
"
225"
column=
"8"
lean-forward=
"false"
selection-start-line=
"225"
selection-start-column=
"8"
selection-end-line=
"225"
selection-end-column=
"8
"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/
neutronclient/v2_0/client
.py"
>
<entry
file=
"file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/
django/dispatch/dispatcher
.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"195"
>
<caret
line=
"
854"
column=
"8"
lean-forward=
"false"
selection-start-line=
"854"
selection-start-column=
"8"
selection-end-line=
"854"
selection-end-column=
"8
"
/>
<caret
line=
"
192"
column=
"0"
lean-forward=
"false"
selection-start-line=
"192"
selection-start-column=
"0"
selection-end-line=
"192"
selection-end-column=
"0
"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$
APPLICATION_HOME_DIR$/helpers/typeshed/stdlib/2/typing.pyi
"
>
<entry
file=
"file://$
USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/neutronclient/v2_0/client.py
"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
195
"
>
<caret
line=
"
225"
column=
"8"
lean-forward=
"false"
selection-start-line=
"225"
selection-start-column=
"8"
selection-end-line=
"225
"
selection-end-column=
"8"
/>
<state
relative-caret-position=
"
501
"
>
<caret
line=
"
854"
column=
"8"
lean-forward=
"false"
selection-start-line=
"854"
selection-start-column=
"8"
selection-end-line=
"854
"
selection-end-column=
"8"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/openstack_api/neutron.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
289
"
>
<caret
line=
"1
156"
column=
"59"
lean-forward=
"true"
selection-start-line=
"1156"
selection-start-column=
"59"
selection-end-line=
"1156"
selection-end-column=
"59
"
/>
<state
relative-caret-position=
"
187
"
>
<caret
line=
"1
097"
column=
"4"
lean-forward=
"false"
selection-start-line=
"1097"
selection-start-column=
"4"
selection-end-line=
"1097"
selection-end-column=
"4
"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$
USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/dispatch/dispatcher
.py"
>
<entry
file=
"file://$
PROJECT_DIR$/circle/network/models
.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
195
"
>
<caret
line=
"
192"
column=
"0"
lean-forward=
"false"
selection-start-line=
"192"
selection-start-column=
"0"
selection-end-line=
"192"
selection-end-column=
"0
"
/>
<state
relative-caret-position=
"
692
"
>
<caret
line=
"
96"
column=
"72"
lean-forward=
"false"
selection-start-line=
"96"
selection-start-column=
"72"
selection-end-line=
"96"
selection-end-column=
"72
"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/
network/models
.py"
>
<entry
file=
"file://$PROJECT_DIR$/circle/
circle/settings/base
.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
34
2"
>
<caret
line=
"
84"
column=
"101"
lean-forward=
"false"
selection-start-line=
"84"
selection-start-column=
"101"
selection-end-line=
"84"
selection-end-column=
"101
"
/>
<state
relative-caret-position=
"
86
2"
>
<caret
line=
"
579"
column=
"34"
lean-forward=
"false"
selection-start-line=
"579"
selection-start-column=
"34"
selection-end-line=
"579"
selection-end-column=
"34
"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/circle/network/views.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"476"
>
<caret
line=
"1015"
column=
"51"
lean-forward=
"false"
selection-start-line=
"1015"
selection-start-column=
"51"
selection-end-line=
"1015"
selection-end-column=
"51"
/>
<folding>
<element
signature=
"e#732#743#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
circle/circle/settings/base.py
View file @
9e617a76
...
...
@@ -576,4 +576,5 @@ USERNET_MAX = 2 ** 12
DEFAULT_SUBNETPOOL_NAME_FOR_USER
=
"default"
DEFAULT_SUBNETPOOL_PREFIXES
=
(
"10.0.0.0/8"
,
"172.16.0.0/12"
,
"192.168.0.0/16"
)
\ No newline at end of file
)
DEFAULT_SUBNETPOOL_PREFIX_LEN
=
20
\ No newline at end of file
circle/network/models.py
View file @
9e617a76
...
...
@@ -80,14 +80,25 @@ class Vxlan(models.Model):
def
get_absolute_url
(
self
):
return
reverse
(
'network.vxlan'
,
kwargs
=
{
'vni'
:
self
.
vni
})
def
create_subnet_pool
(
sender
,
user
,
request
,
**
kwargs
):
subnet_pools
=
openstack_api
.
neutron
.
subnetpool_list
(
request
)
subnet_pools
=
[
sp
for
sp
in
subnet_pools
if
sp
.
name
==
settings
.
DEFAULT_SUBNETPOOL_NAME_FOR_USER
]
if
(
len
(
subnet_pools
)
==
0
):
openstack_api
.
neutron
.
subnetpool_create
(
request
,
settings
.
DEFAULT_SUBNETPOOL_NAME_FOR_USER
,
settings
.
DEFAULT_SUBNETPOOL_PREFIXES
,
)
user_logged_in
.
connect
(
create_subnet_pool
)
\ No newline at end of file
class
SubnetPool
(
object
):
@classmethod
def
get
(
cls
,
request
):
subnet_pools
=
openstack_api
.
neutron
.
subnetpool_list
(
request
)
subnet_pools
=
[
sp
for
sp
in
subnet_pools
if
sp
.
name
==
settings
.
DEFAULT_SUBNETPOOL_NAME_FOR_USER
]
return
subnet_pools
[
0
]
if
len
(
subnet_pools
)
>
0
else
None
@classmethod
def
create_if_not_exists
(
cls
,
sender
,
user
,
request
,
**
kwargs
):
if
SubnetPool
.
get
(
request
)
is
None
:
openstack_api
.
neutron
.
subnetpool_create
(
request
,
settings
.
DEFAULT_SUBNETPOOL_NAME_FOR_USER
,
settings
.
DEFAULT_SUBNETPOOL_PREFIXES
,
default_prefixlen
=
settings
.
DEFAULT_SUBNETPOOL_PREFIX_LEN
)
@classmethod
def
get_id
(
cls
,
request
):
return
SubnetPool
.
get
(
request
)
.
id
user_logged_in
.
connect
(
SubnetPool
.
create_if_not_exists
)
circle/network/views.py
View file @
9e617a76
...
...
@@ -46,7 +46,7 @@ from firewall.models import (
SwitchPort
,
EthernetDevice
,
Firewall
)
from
netaddr
import
IPNetwork
from
network.models
import
Vxlan
,
EditorElement
from
network.models
import
Vxlan
,
EditorElement
,
SubnetPool
from
openstack_api.utils.lazy_encoder
import
LazyTranslationEncoder
from
vm.models
import
Interface
,
Instance
...
...
@@ -1002,8 +1002,20 @@ class VxlanCreate(LoginRequiredMixin, FormView):
if
form
.
cleaned_data
[
'isAdvancedConfig'
]:
pass
else
:
openstack_api
.
neutron
.
subnet_create
(
self
.
request
,
network_created
.
id
,
ip_version
=
4
)
# TODO: default ip version should read from SETTINGS
try
:
raise
Exception
# TODO: default ip version should read from SETTINGS
openstack_api
.
neutron
.
subnet_create
(
self
.
request
,
network_created
.
id
,
ip_version
=
4
,
subnetpool_id
=
SubnetPool
.
get_id
(
self
.
request
)
)
except
:
openstack_api
.
neutron
.
network_delete
(
self
.
request
,
network_created
.
id
)
#TODO: user friendly error handling
raise
Exception
(
"Could not create subnet for network, deleted network."
)
return
redirect
(
reverse_lazy
(
'network.vxlan'
,
kwargs
=
{
'pk'
:
network_created
.
id
}))
class
VxlanDelete
(
LoginRequiredMixin
,
DeleteView
):
#TODO: check user
...
...
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