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
ba62e349
authored
Oct 02, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: fixing Interface create_from_template()
parent
511666cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
circle/vm/models.py
+12
-4
No files found.
circle/vm/models.py
View file @
ba62e349
...
...
@@ -741,14 +741,22 @@ class Interface(Model):
queue
=
self
.
instance
.
node
.
host
.
hostname
+
'.net'
)
@classmethod
def
create_from_template
(
cls
,
instance
,
template
):
def
create_from_template
(
cls
,
instance
,
template
,
owner
=
None
):
"""Create a new interface for an instance based on an
InterfaceTemplate.
"""
if
template
.
managed
:
host
=
Host
(
vlan
=
template
.
vlan
,
mac
=
str
(
cls
.
generate_mac
(
instance
,
template
.
vlan
)))
# TODO Fix at firewall EUI
host
=
Host
()
host
.
vlan
=
template
.
vlan
host
.
mac
=
str
(
cls
.
generate_mac
(
instance
,
template
.
vlan
))
# TODO Fix at firewall EUI mac
host
.
hostname
=
instance
.
vm_name
# Get adresses from firewall #TODO fix tupple to dict.
addresses
=
template
.
vlan
.
get_new_address
()
host
.
ipv4
=
addresses
[
0
]
host
.
ipv6
=
addresses
[
1
]
host
.
owner
=
owner
host
.
save
()
else
:
host
=
None
...
...
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