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
3572f870
authored
Nov 18, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: networks as objects and not dicts in Instance create_from_template
parent
4b2c34ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
circle/dashboard/views.py
+5
-4
circle/vm/models.py
+2
-2
No files found.
circle/dashboard/views.py
View file @
3572f870
...
...
@@ -224,12 +224,13 @@ class VmCreate(TemplateView):
'priority'
:
int
(
request
.
POST
.
get
(
'cpu-priority'
)),
}
networks
=
[{
'vlan'
:
Vlan
.
objects
.
get
(
pk
=
l
),
'managed'
:
True
}
networks
=
[
InterfaceTemplate
(
vlan
=
Vlan
.
objects
.
get
(
pk
=
l
),
managed
=
True
)
for
l
in
request
.
POST
.
getlist
(
'managed-vlans'
)
]
networks
.
extend
([
{
'vlan'
:
Vlan
.
objects
.
get
(
pk
=
l
),
'managed'
:
False
}
for
l
in
request
.
POST
.
getlist
(
'unmanaged-vlans'
)
networks
.
extend
([
InterfaceTemplate
(
vlan
=
Vlan
.
objects
.
get
(
pk
=
l
),
managed
=
False
)
for
l
in
request
.
POST
.
getlist
(
'unmanaged-vlans'
)
])
disks
=
Disk
.
objects
.
filter
(
pk__in
=
request
.
POST
.
getlist
(
'disks'
))
...
...
circle/vm/models.py
View file @
3572f870
...
...
@@ -429,8 +429,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
inst
.
disks
.
add
(
*
[
disk
.
get_exclusive
()
for
disk
in
disks
])
for
net
in
networks
:
i
=
Interface
.
create
(
instance
=
inst
,
vlan
=
net
[
'vlan'
]
,
owner
=
owner
,
managed
=
net
[
'managed'
]
)
i
=
Interface
.
create
(
instance
=
inst
,
vlan
=
net
.
vlan
,
owner
=
owner
,
managed
=
net
.
managed
)
if
i
.
host
:
i
.
host
.
enable_net
()
port
,
proto
=
ACCESS_PROTOCOLS
[
i
.
instance
.
access_method
][
1
:
3
]
...
...
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