Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c75959fd
authored
Nov 05, 2017
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add vxlan support to VMNetwork
parent
bf0de0cc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
+9
-1
vm.py
+9
-1
No files found.
vm.py
View file @
c75959fd
...
...
@@ -245,6 +245,7 @@ class VMNetwork:
ipv4 -- the IPv4 address of virtual machine (Flow control)
ipv6 -- the IPv6 address of virtual machine (Flow controlo)
vlan -- Port VLAN configuration
vxlan -- Port VXLAN configuration
network_type -- need to be "ethernet" by default
model -- available models in libvirt
QoS -- CIRCLE QoS class?
...
...
@@ -262,6 +263,7 @@ class VMNetwork:
script_exec
=
'/bin/true'
comment
=
None
vlan
=
0
vxlan
=
None
ipv4
=
None
ipv6
=
None
managed
=
False
...
...
@@ -277,6 +279,7 @@ class VMNetwork:
model
=
'virtio'
,
QoS
=
None
,
vlan
=
0
,
vxlan
=
None
,
managed
=
False
):
self
.
name
=
name
self
.
bridge
=
bridge
...
...
@@ -296,6 +299,7 @@ class VMNetwork:
self
.
virtual_port
=
virtual_port
self
.
QoS
=
QoS
self
.
vlan
=
vlan
self
.
vxlan
=
vxlan
self
.
managed
=
managed
@classmethod
...
...
@@ -305,7 +309,9 @@ class VMNetwork:
# XML dump
def
build_xml
(
self
):
xml_top
=
ET
.
Element
(
'interface'
,
attrib
=
{
'type'
:
self
.
network_type
})
if
self
.
vlan
>
0
and
self
.
network_type
==
"bridge"
:
if
(
self
.
vlan
>
0
and
self
.
network_type
==
"bridge"
and
self
.
vxlan
is
None
):
xml_vlan
=
ET
.
SubElement
(
xml_top
,
'vlan'
)
ET
.
SubElement
(
xml_vlan
,
'tag'
,
attrib
=
{
'id'
:
str
(
self
.
vlan
)})
if
self
.
network_type
==
"bridge"
:
...
...
@@ -315,6 +321,8 @@ class VMNetwork:
if
self
.
virtual_port
is
not
None
:
ET
.
SubElement
(
xml_top
,
'virtualport'
,
attrib
=
{
'type'
:
self
.
virtual_port
})
if
self
.
vxlan
is
not
None
:
ET
.
SubElement
(
xml_top
,
'mtu'
,
attrib
=
{
'size'
:
'1450'
})
ET
.
SubElement
(
xml_top
,
'target'
,
attrib
=
{
'dev'
:
self
.
name
})
ET
.
SubElement
(
xml_top
,
'mac'
,
attrib
=
{
'address'
:
self
.
mac
})
ET
.
SubElement
(
xml_top
,
'model'
,
attrib
=
{
'type'
:
self
.
model
})
...
...
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