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
e9a14e71
authored
Dec 01, 2013
by
Bach Dániel
Committed by
Guba Sándor
Dec 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: fix Interface.generate_mac()
parent
d8441130
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
+10
-1
circle/firewall/fields.py
+6
-0
circle/vm/models/network.py
+4
-1
No files found.
circle/firewall/fields.py
View file @
e9a14e71
...
@@ -35,6 +35,12 @@ class MACAddressField(models.Field):
...
@@ -35,6 +35,12 @@ class MACAddressField(models.Field):
def
get_internal_type
(
self
):
def
get_internal_type
(
self
):
return
'CharField'
return
'CharField'
def
to_python
(
self
,
value
):
if
not
mac_re
.
search
(
str
(
value
)):
raise
ValidationError
(
MACAddressFormField
.
default_error_messages
[
'invalid'
])
return
str
(
value
)
def
formfield
(
self
,
**
kwargs
):
def
formfield
(
self
,
**
kwargs
):
defaults
=
{
'form_class'
:
MACAddressFormField
}
defaults
=
{
'form_class'
:
MACAddressFormField
}
defaults
.
update
(
kwargs
)
defaults
.
update
(
kwargs
)
...
...
circle/vm/models/network.py
View file @
e9a14e71
...
@@ -67,10 +67,12 @@ class Interface(Model):
...
@@ -67,10 +67,12 @@ class Interface(Model):
# MAC 02:XX:XX:XX:XX:XX
# MAC 02:XX:XX:XX:XX:XX
# \________/\__/
# \________/\__/
# VM ID VLAN ID
# VM ID VLAN ID
class
mac_custom
(
mac_unix
):
word_fmt
=
'
%.2
X'
i
=
instance
.
id
&
0xfffffff
i
=
instance
.
id
&
0xfffffff
v
=
vlan
.
vid
&
0xfff
v
=
vlan
.
vid
&
0xfff
m
=
(
0x02
<<
40
)
|
(
i
<<
12
)
|
v
m
=
(
0x02
<<
40
)
|
(
i
<<
12
)
|
v
return
EUI
(
m
,
dialect
=
mac_
unix
)
return
EUI
(
m
,
dialect
=
mac_
custom
)
def
get_vmnetwork_desc
(
self
):
def
get_vmnetwork_desc
(
self
):
return
{
return
{
...
@@ -108,6 +110,7 @@ class Interface(Model):
...
@@ -108,6 +110,7 @@ class Interface(Model):
host
.
ipv4
=
addresses
[
'ipv4'
]
host
.
ipv4
=
addresses
[
'ipv4'
]
host
.
ipv6
=
addresses
[
'ipv6'
]
host
.
ipv6
=
addresses
[
'ipv6'
]
host
.
owner
=
owner
host
.
owner
=
owner
host
.
full_clean
()
host
.
save
()
host
.
save
()
else
:
else
:
host
=
None
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