Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
84488ced
authored
Feb 23, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add e1000, rtl8139, pcnet, ne2k_pci support
parent
2da6b728
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletions
+26
-1
circle/vm/migrations/0002_interface_model.py
+20
-0
circle/vm/models/network.py
+6
-1
No files found.
circle/vm/migrations/0002_interface_model.py
0 → 100644
View file @
84488ced
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'vm'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'interface'
,
name
=
'model'
,
field
=
models
.
CharField
(
default
=
'virtio'
,
max_length
=
10
,
choices
=
[(
'virtio'
,
'virtio'
),
(
'ne2k_pci'
,
'ne2k_pci'
),
(
'pcnet'
,
'pcnet'
),
(
'rtl8139'
,
'rtl8139'
),
(
'e1000'
,
'e1000'
)]),
preserve_default
=
True
,
),
]
circle/vm/models/network.py
View file @
84488ced
...
@@ -20,7 +20,7 @@ from __future__ import absolute_import, unicode_literals
...
@@ -20,7 +20,7 @@ from __future__ import absolute_import, unicode_literals
from
logging
import
getLogger
from
logging
import
getLogger
from
netaddr
import
EUI
,
mac_unix
from
netaddr
import
EUI
,
mac_unix
from
django.db.models
import
Model
,
ForeignKey
,
BooleanField
from
django.db.models
import
Model
,
ForeignKey
,
BooleanField
,
CharField
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext_noop
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext_noop
from
common.models
import
create_readable
from
common.models
import
create_readable
...
@@ -61,11 +61,15 @@ class Interface(Model):
...
@@ -61,11 +61,15 @@ class Interface(Model):
"""Network interface for an instance.
"""Network interface for an instance.
"""
"""
MODEL_TYPES
=
((
'virtio'
,
'virtio'
),
(
'ne2k_pci'
,
'ne2k_pci'
),
(
'pcnet'
,
'pcnet'
),
(
'rtl8139'
,
'rtl8139'
),
(
'e1000'
,
'e1000'
))
vlan
=
ForeignKey
(
Vlan
,
verbose_name
=
_
(
'vlan'
),
vlan
=
ForeignKey
(
Vlan
,
verbose_name
=
_
(
'vlan'
),
related_name
=
"vm_interface"
)
related_name
=
"vm_interface"
)
host
=
ForeignKey
(
Host
,
verbose_name
=
_
(
'host'
),
blank
=
True
,
null
=
True
)
host
=
ForeignKey
(
Host
,
verbose_name
=
_
(
'host'
),
blank
=
True
,
null
=
True
)
instance
=
ForeignKey
(
'Instance'
,
verbose_name
=
_
(
'instance'
),
instance
=
ForeignKey
(
'Instance'
,
verbose_name
=
_
(
'instance'
),
related_name
=
'interface_set'
)
related_name
=
'interface_set'
)
model
=
CharField
(
max_length
=
10
,
choices
=
MODEL_TYPES
,
default
=
'virtio'
)
class
Meta
:
class
Meta
:
app_label
=
'vm'
app_label
=
'vm'
...
@@ -104,6 +108,7 @@ class Interface(Model):
...
@@ -104,6 +108,7 @@ class Interface(Model):
'ipv4'
:
str
(
self
.
host
.
ipv4
)
if
self
.
host
is
not
None
else
None
,
'ipv4'
:
str
(
self
.
host
.
ipv4
)
if
self
.
host
is
not
None
else
None
,
'ipv6'
:
str
(
self
.
host
.
ipv6
)
if
self
.
host
is
not
None
else
None
,
'ipv6'
:
str
(
self
.
host
.
ipv6
)
if
self
.
host
is
not
None
else
None
,
'vlan'
:
self
.
vlan
.
vid
,
'vlan'
:
self
.
vlan
.
vid
,
'model'
:
self
.
model
,
'managed'
:
self
.
host
is
not
None
'managed'
:
self
.
host
is
not
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