Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
5182afaa
authored
Nov 06, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: precautionary refactor
parent
7ea37dad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
13 deletions
+6
-13
circle/vm/models.py
+6
-13
No files found.
circle/vm/models.py
View file @
5182afaa
...
@@ -347,24 +347,17 @@ class Instance(VirtualMachineDescModel, TimeStampedModel):
...
@@ -347,24 +347,17 @@ class Instance(VirtualMachineDescModel, TimeStampedModel):
Can also specify parameters as keyword arguments which should override
Can also specify parameters as keyword arguments which should override
template settings.
template settings.
"""
"""
if
disks
is
None
:
disks
=
template
.
disks
.
all
()
if
disks
is
None
else
disks
disks
=
template
.
disks
.
all
()
# prepare parameters
# prepare parameters
kwargs
[
'template'
]
=
template
kwargs
[
'template'
]
=
template
kwargs
[
'owner'
]
=
owner
kwargs
[
'owner'
]
=
owner
kwargs
.
setdefault
(
'name'
,
template
.
name
)
kwargs
.
setdefault
(
'description'
,
template
.
description
)
kwargs
.
setdefault
(
'pw'
,
pwgen
())
kwargs
.
setdefault
(
'pw'
,
pwgen
())
kwargs
.
setdefault
(
'num_cores'
,
template
.
num_cores
)
ca
=
[
'name'
,
'description'
,
'num_cores'
,
'ram_size'
,
'max_ram_size'
,
kwargs
.
setdefault
(
'ram_size'
,
template
.
ram_size
)
'arch'
,
'priority'
,
'boot_menu'
,
'raw_data'
,
'lease'
,
kwargs
.
setdefault
(
'max_ram_size'
,
template
.
max_ram_size
)
'access_method'
]
kwargs
.
setdefault
(
'arch'
,
template
.
arch
)
for
attr
in
ca
:
kwargs
.
setdefault
(
'priority'
,
template
.
priority
)
kwargs
.
setdefault
(
attr
,
getattr
(
template
,
attr
))
kwargs
.
setdefault
(
'boot_menu'
,
template
.
boot_menu
)
kwargs
.
setdefault
(
'raw_data'
,
template
.
raw_data
)
kwargs
.
setdefault
(
'lease'
,
template
.
lease
)
kwargs
.
setdefault
(
'access_method'
,
template
.
access_method
)
# create instance and do additional setup
# create instance and do additional setup
inst
=
cls
(
**
kwargs
)
inst
=
cls
(
**
kwargs
)
# save instance
# 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