Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
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
7514b54e
authored
Nov 06, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revise temporary fix of
0c033922
parent
1b8ae2d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
circle/vm/models.py
+4
-3
No files found.
circle/vm/models.py
View file @
7514b54e
...
...
@@ -341,12 +341,15 @@ class Instance(VirtualMachineDescModel, TimeStampedModel):
return
" "
.
join
([
s
for
s
in
parts
if
s
!=
""
])
@classmethod
def
create_from_template
(
cls
,
template
,
owner
,
**
kwargs
):
def
create_from_template
(
cls
,
template
,
owner
,
disks
=
None
,
**
kwargs
):
"""Create a new instance based on an InstanceTemplate.
Can also specify parameters as keyword arguments which should override
template settings.
"""
if
disks
is
None
:
disks
=
template
.
disks
.
all
()
# prepare parameters
kwargs
[
'template'
]
=
template
kwargs
[
'owner'
]
=
owner
...
...
@@ -362,8 +365,6 @@ class Instance(VirtualMachineDescModel, TimeStampedModel):
kwargs
.
setdefault
(
'raw_data'
,
template
.
raw_data
)
kwargs
.
setdefault
(
'lease'
,
template
.
lease
)
kwargs
.
setdefault
(
'access_method'
,
template
.
access_method
)
disks
=
kwargs
.
get
(
'disks'
,
template
.
disks
.
all
())
kwargs
.
pop
(
'disks'
)
# create instance and do additional setup
inst
=
cls
(
**
kwargs
)
# save instance
...
...
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