Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4381a1ce
authored
Jul 17, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding graphics, features and acpi options
parent
aec476c9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
vm.py
+21
-2
No files found.
vm.py
View file @
4381a1ce
...
@@ -15,7 +15,8 @@ class VMInstance:
...
@@ -15,7 +15,8 @@ class VMInstance:
memory_max
=
None
memory_max
=
None
network_list
=
list
()
network_list
=
list
()
disk_list
=
list
()
disk_list
=
list
()
context
=
dict
()
graphics
=
dict
context
=
dict
def
__init__
(
self
,
def
__init__
(
self
,
name
,
name
,
...
@@ -27,7 +28,9 @@ class VMInstance:
...
@@ -27,7 +28,9 @@ class VMInstance:
vm_type
=
"kvm"
,
vm_type
=
"kvm"
,
network_list
=
None
,
network_list
=
None
,
disk_list
=
None
,
disk_list
=
None
,
context
=
None
):
context
=
None
,
graphics
=
None
,
acpi
=
True
):
'''Default Virtual Machine constructor
'''Default Virtual Machine constructor
'''
'''
self
.
name
=
name
self
.
name
=
name
...
@@ -40,6 +43,8 @@ class VMInstance:
...
@@ -40,6 +43,8 @@ class VMInstance:
self
.
network_list
=
network_list
self
.
network_list
=
network_list
self
.
disk_list
=
disk_list
self
.
disk_list
=
disk_list
self
.
conext
=
context
self
.
conext
=
context
self
.
graphics
=
graphics
self
.
acpi
=
acpi
def
build_xml
(
self
):
def
build_xml
(
self
):
'''Return the root Element Tree object
'''Return the root Element Tree object
...
@@ -69,6 +74,20 @@ class VMInstance:
...
@@ -69,6 +74,20 @@ class VMInstance:
devices
.
append
(
disk
.
build_xml
())
devices
.
append
(
disk
.
build_xml
())
for
network
in
self
.
network_list
:
for
network
in
self
.
network_list
:
devices
.
append
(
network
.
build_xml
())
devices
.
append
(
network
.
build_xml
())
# Console/graphics section
if
self
.
graphics
is
not
None
:
ET
.
SubElement
(
devices
,
'graphics'
,
attrib
=
{
'type'
:
self
.
graphics
[
'type'
],
'listen'
:
self
.
graphics
[
'listen'
],
'port'
:
self
.
graphics
[
'port'
],
'passwd'
:
self
.
graphics
[
'passwd'
],
})
# Features
features
=
ET
.
SubElement
(
xml_top
,
'features'
)
if
self
.
acpi
:
ET
.
SubElement
(
features
,
'acpi'
)
return
xml_top
return
xml_top
def
dump_xml
(
self
):
def
dump_xml
(
self
):
...
...
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