Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8adaa4b2
authored
Apr 03, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: create disks for vms from template wizard
parent
d739baa2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
circle/dashboard/views.py
+20
-8
No files found.
circle/dashboard/views.py
View file @
8adaa4b2
...
...
@@ -838,22 +838,34 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
post
=
form
.
cleaned_data
networks
=
self
.
__create_networks
(
post
.
pop
(
"networks"
))
req_traits
=
post
.
pop
(
"req_traits"
)
tags
=
post
.
pop
(
"tags"
)
post
[
'pw'
]
=
User
.
objects
.
make_random_password
()
post
.
pop
(
"parent"
)
parent_type
=
post
.
pop
(
"parent_type"
)
post
[
'max_ram_size'
]
=
post
[
'ram_size'
]
inst
=
Instance
.
create
(
params
=
post
,
disks
=
[],
networks
=
networks
,
tags
=
tags
,
req_traits
=
req_traits
)
messages
.
success
(
request
,
_
(
"The template has been created, "
"you can now add disks to it!"
))
# if it's not a base vm we need to add disks and deploy it
if
parent_type
!=
"base_vm"
:
template
=
get_object_or_404
(
InstanceTemplate
,
pk
=
parent_type
)
# TODO clone disks
inst
=
Instance
.
create_from_template
(
template
=
template
,
networks
=
networks
,
**
post
)
inst
.
deploy_async
()
messages
.
info
(
request
,
_
(
"Your instance has been created, "
"modify it then press the save as "
"button to save it as a new template!"
))
else
:
req_traits
=
post
.
pop
(
"req_traits"
)
tags
=
post
.
pop
(
"tags"
)
post
[
'pw'
]
=
User
.
objects
.
make_random_password
()
inst
=
Instance
.
create
(
params
=
post
,
disks
=
[],
networks
=
networks
,
tags
=
tags
,
req_traits
=
req_traits
)
messages
.
info
(
request
,
_
(
"Your new base vm has been created, "
"add disks, make modifications, then"
" use the save as button to save it"
" as a new template!"
))
return
redirect
(
"
%
s#resources"
%
inst
.
get_absolute_url
())
...
...
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