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
6c9a7148
authored
Jun 17, 2018
by
Szabolcs Gelencser
Committed by
Szabolcs Gelencsér
Jun 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mitaka compatibility: must have network on vm creation
parent
d8b13d06
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletions
+19
-1
circle/circle/settings/base.py
+2
-0
circle/dashboard/templates/dashboard/vm-plain-image-create.html
+2
-0
circle/dashboard/views/vm.py
+15
-1
No files found.
circle/circle/settings/base.py
View file @
6c9a7148
...
@@ -616,3 +616,5 @@ DEFAULT_LEASE_SUSPEND_SECONDS = 3600
...
@@ -616,3 +616,5 @@ DEFAULT_LEASE_SUSPEND_SECONDS = 3600
DEFAULT_LEASE_DELETE_SECONDS
=
7200
DEFAULT_LEASE_DELETE_SECONDS
=
7200
SESSIONHOOK_SHARED_SECRET
=
"verysecretmuchsecure"
SESSIONHOOK_SHARED_SECRET
=
"verysecretmuchsecure"
IS_NET_OMISSION_SUPPORTED
=
False
# in mitaka you must specify network at vm creation
circle/dashboard/templates/dashboard/vm-plain-image-create.html
View file @
6c9a7148
...
@@ -10,7 +10,9 @@
...
@@ -10,7 +10,9 @@
{{ form.name|as_crispy_field }}
{{ form.name|as_crispy_field }}
{{ form.image|as_crispy_field }}
{{ form.image|as_crispy_field }}
{{ form.flavor|as_crispy_field }}
{{ form.flavor|as_crispy_field }}
{% if IS_NET_OMISSION_SUPPORTED %}
{{ form.internet_access|as_crispy_field }}
{{ form.internet_access|as_crispy_field }}
{% endif %}
<button
class=
"btn btn-success btn-xs vm-create-start pull-right text-right"
type=
"submit"
>
<button
class=
"btn btn-success btn-xs vm-create-start pull-right text-right"
type=
"submit"
>
<i
class=
"fa fa-play"
></i>
{% trans "Start" %}
<i
class=
"fa fa-play"
></i>
{% trans "Start" %}
</button>
</button>
...
...
circle/dashboard/views/vm.py
View file @
6c9a7148
...
@@ -1113,13 +1113,14 @@ class VmPlainImageCreate(LoginRequiredMixin, TemplateView):
...
@@ -1113,13 +1113,14 @@ class VmPlainImageCreate(LoginRequiredMixin, TemplateView):
context
=
self
.
get_context_data
(
**
kwargs
)
context
=
self
.
get_context_data
(
**
kwargs
)
context
.
update
({
context
.
update
({
'form'
:
VmFromPlainImageForm
(
request
),
'form'
:
VmFromPlainImageForm
(
request
),
'IS_NET_OMISSION_SUPPORTED'
:
settings
.
IS_NET_OMISSION_SUPPORTED
,
})
})
return
self
.
render_to_response
(
context
)
return
self
.
render_to_response
(
context
)
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
server_created
=
None
server_created
=
None
if
request
.
POST
.
get
(
"internet_access"
):
if
request
.
POST
.
get
(
"internet_access"
)
or
not
settings
.
IS_NET_OMISSION_SUPPORTED
:
default_public_routed_net_id
=
DefaultPublicRoutedNet
.
get_id
(
request
)
default_public_routed_net_id
=
DefaultPublicRoutedNet
.
get_id
(
request
)
server_created
=
openstack_api
.
nova
.
server_create
(
server_created
=
openstack_api
.
nova
.
server_create
(
request
,
request
,
...
@@ -1198,12 +1199,25 @@ class VmCreate(LoginRequiredMixin, TemplateView):
...
@@ -1198,12 +1199,25 @@ class VmCreate(LoginRequiredMixin, TemplateView):
return
self
.
render_to_response
(
context
)
return
self
.
render_to_response
(
context
)
def
__create_normal
(
self
,
request
,
template
,
*
args
,
**
kwargs
):
def
__create_normal
(
self
,
request
,
template
,
*
args
,
**
kwargs
):
# TODO: create networks, interfaces, disks of template
if
settings
.
IS_NET_OMISSION_SUPPORTED
:
server_created
=
openstack_api
.
nova
.
server_create
(
server_created
=
openstack_api
.
nova
.
server_create
(
request
,
request
,
template
.
name
,
template
.
name
,
template
.
image_id
,
template
.
image_id
,
template
.
flavor_id
,
template
.
flavor_id
,
)
)
else
:
default_public_routed_net_id
=
DefaultPublicRoutedNet
.
get_id
(
request
)
server_created
=
openstack_api
.
nova
.
server_create
(
request
,
template
.
name
,
template
.
image_id
,
template
.
flavor_id
,
nics
=
({
'net-id'
:
default_public_routed_net_id
,
},)
)
from
dashboard.templatetags.instance_tags
import
get_absolute_url
from
dashboard.templatetags.instance_tags
import
get_absolute_url
messages
.
success
(
request
,
_
(
"VM successfully created."
))
messages
.
success
(
request
,
_
(
"VM successfully created."
))
...
...
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