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
90504bb9
authored
Feb 10, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netdriver: prepare for libvirt 1.2.1
parent
633b1b50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
vm.py
+16
-3
No files found.
vm.py
View file @
90504bb9
...
@@ -118,7 +118,8 @@ class VMInstance:
...
@@ -118,7 +118,8 @@ class VMInstance:
ET
.
SubElement
(
serial
,
ET
.
SubElement
(
serial
,
'source'
,
'source'
,
attrib
=
{
'mode'
:
'bind'
,
attrib
=
{
'mode'
:
'bind'
,
'path'
:
'/var/lib/libvirt/serial/
%
s'
%
self
.
name
})
'path'
:
'/var/lib/libvirt/serial/
%
s'
%
self
.
name
})
# Console/graphics section
# Console/graphics section
if
self
.
graphics
is
not
None
:
if
self
.
graphics
is
not
None
:
ET
.
SubElement
(
devices
,
ET
.
SubElement
(
devices
,
...
@@ -248,6 +249,7 @@ class VMNetwork:
...
@@ -248,6 +249,7 @@ class VMNetwork:
ipv4
=
None
,
ipv4
=
None
,
ipv6
=
None
,
ipv6
=
None
,
network_type
=
'ethernet'
,
network_type
=
'ethernet'
,
virtual_port
=
None
,
model
=
'virtio'
,
model
=
'virtio'
,
QoS
=
None
,
QoS
=
None
,
vlan
=
0
,
vlan
=
0
,
...
@@ -259,6 +261,7 @@ class VMNetwork:
...
@@ -259,6 +261,7 @@ class VMNetwork:
self
.
ipv4
=
ipv4
self
.
ipv4
=
ipv4
self
.
ipv6
=
ipv6
self
.
ipv6
=
ipv6
self
.
model
=
model
self
.
model
=
model
self
.
virtual_port
=
virtual_port
self
.
QoS
=
QoS
self
.
QoS
=
QoS
self
.
vlan
=
vlan
self
.
vlan
=
vlan
self
.
managed
=
managed
self
.
managed
=
managed
...
@@ -270,13 +273,23 @@ class VMNetwork:
...
@@ -270,13 +273,23 @@ class VMNetwork:
# XML dump
# XML dump
def
build_xml
(
self
):
def
build_xml
(
self
):
xml_top
=
ET
.
Element
(
'interface'
,
attrib
=
{
'type'
:
self
.
network_type
})
xml_top
=
ET
.
Element
(
'interface'
,
attrib
=
{
'type'
:
self
.
network_type
})
if
self
.
vlan
>
0
and
self
.
network_type
==
"bridge"
:
xml_vlan
=
ET
.
SubElement
(
xml_top
,
'vlan'
)
ET
.
SubElement
(
xml_vlan
,
'tag'
,
attrib
=
{
'id'
:
self
.
vlan
})
if
self
.
network_type
==
"bridge"
:
ET
.
SubElement
(
xml_top
,
'source'
,
attrib
=
{
'bridge'
:
self
.
bridge
})
if
self
.
network_type
==
"ethernet"
:
ET
.
SubElement
(
xml_top
,
'script'
,
attrib
=
{
'path'
:
self
.
script_exec
})
if
self
.
virtual_port
is
not
None
:
ET
.
SubElement
(
xml_top
,
'virtualport'
,
attrib
=
{
'type'
:
self
.
virtual_port
})
ET
.
SubElement
(
xml_top
,
'target'
,
attrib
=
{
'dev'
:
self
.
name
})
ET
.
SubElement
(
xml_top
,
'target'
,
attrib
=
{
'dev'
:
self
.
name
})
ET
.
SubElement
(
xml_top
,
'mac'
,
attrib
=
{
'address'
:
self
.
mac
})
ET
.
SubElement
(
xml_top
,
'mac'
,
attrib
=
{
'address'
:
self
.
mac
})
ET
.
SubElement
(
xml_top
,
'model'
,
attrib
=
{
'type'
:
self
.
model
})
ET
.
SubElement
(
xml_top
,
'model'
,
attrib
=
{
'type'
:
self
.
model
})
ET
.
SubElement
(
xml_top
,
'script'
,
attrib
=
{
'path'
:
self
.
script_exec
})
ET
.
SubElement
(
xml_top
,
'rom'
,
attrib
=
{
'bar'
:
'off'
})
ET
.
SubElement
(
xml_top
,
'rom'
,
attrib
=
{
'bar'
:
'off'
})
return
xml_top
return
xml_top
def
dump_xml
(
self
):
def
dump_xml
(
self
):
return
ET
.
tostring
(
self
.
build_xml
(),
encoding
=
'utf8'
,
return
ET
.
tostring
(
self
.
build_xml
(),
encoding
=
'utf8'
,
method
=
'xml'
,
pretty_print
=
True
)
method
=
'xml'
,
pretty_print
=
True
)
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