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
97b69b04
authored
Oct 04, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: change get_new_address to return dict instead of tuple
parent
8d7d535a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
circle/firewall/models.py
+1
-1
circle/vm/models.py
+5
-5
No files found.
circle/firewall/models.py
View file @
97b69b04
...
@@ -298,7 +298,7 @@ class Vlan(models.Model):
...
@@ -298,7 +298,7 @@ class Vlan(models.Model):
print
ipv4
print
ipv4
ipv6
=
ipv4_2_ipv6
(
ipv4
)
ipv6
=
ipv4_2_ipv6
(
ipv4
)
if
ipv6
not
in
used_v6
:
if
ipv6
not
in
used_v6
:
return
(
ipv4
,
ipv6
)
return
{
'ipv4'
:
ipv4
,
'ipv6'
:
ipv6
}
raise
ValidationError
(
_
(
"All IP addresses are already in use."
))
raise
ValidationError
(
_
(
"All IP addresses are already in use."
))
...
...
circle/vm/models.py
View file @
97b69b04
...
@@ -754,20 +754,20 @@ class Interface(Model):
...
@@ -754,20 +754,20 @@ class Interface(Model):
InterfaceTemplate.
InterfaceTemplate.
"""
"""
if
template
.
managed
:
if
template
.
managed
:
host
=
Host
()
host
=
Host
()
host
.
vlan
=
template
.
vlan
host
.
vlan
=
template
.
vlan
# TODO change Host's mac field's type to EUI in firewall
host
.
mac
=
str
(
cls
.
generate_mac
(
instance
,
template
.
vlan
))
host
.
mac
=
str
(
cls
.
generate_mac
(
instance
,
template
.
vlan
))
# TODO Fix at firewall EUI mac
host
.
hostname
=
instance
.
vm_name
host
.
hostname
=
instance
.
vm_name
# Get adresses from firewall
#TODO fix tupple to dict.
# Get adresses from firewall
addresses
=
template
.
vlan
.
get_new_address
()
addresses
=
template
.
vlan
.
get_new_address
()
host
.
ipv4
=
addresses
[
0
]
host
.
ipv4
=
addresses
[
'ipv4'
]
host
.
ipv6
=
addresses
[
1
]
host
.
ipv6
=
addresses
[
'ipv6'
]
host
.
owner
=
owner
host
.
owner
=
owner
host
.
save
()
host
.
save
()
else
:
else
:
host
=
None
host
=
None
iface
=
cls
(
vlan
=
template
.
vlan
,
host
=
host
,
instance
=
instance
)
iface
=
cls
(
vlan
=
template
.
vlan
,
host
=
host
,
instance
=
instance
)
iface
.
save
()
iface
.
save
()
return
iface
return
iface
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