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
a35db8fd
authored
Aug 01, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding raw xml support
parent
6eec7a75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
vm.py
+9
-3
No files found.
vm.py
View file @
a35db8fd
...
@@ -16,6 +16,7 @@ class VMInstance:
...
@@ -16,6 +16,7 @@ class VMInstance:
disk_list
=
list
()
disk_list
=
list
()
graphics
=
dict
graphics
=
dict
context
=
dict
context
=
dict
raw_data
=
None
def
__init__
(
self
,
def
__init__
(
self
,
name
,
name
,
...
@@ -29,7 +30,8 @@ class VMInstance:
...
@@ -29,7 +30,8 @@ class VMInstance:
disk_list
=
None
,
disk_list
=
None
,
context
=
None
,
context
=
None
,
graphics
=
None
,
graphics
=
None
,
acpi
=
True
):
acpi
=
True
,
raw_data
=
None
):
'''Default Virtual Machine constructor
'''Default Virtual Machine constructor
name - unique name for the instance
name - unique name for the instance
vcpu - nubmer of processors
vcpu - nubmer of processors
...
@@ -56,6 +58,7 @@ class VMInstance:
...
@@ -56,6 +58,7 @@ class VMInstance:
self
.
conext
=
context
self
.
conext
=
context
self
.
graphics
=
graphics
self
.
graphics
=
graphics
self
.
acpi
=
acpi
self
.
acpi
=
acpi
self
.
raw_data
=
raw_data
def
build_xml
(
self
):
def
build_xml
(
self
):
'''Return the root Element Tree object
'''Return the root Element Tree object
...
@@ -95,10 +98,13 @@ class VMInstance:
...
@@ -95,10 +98,13 @@ class VMInstance:
'port'
:
self
.
graphics
[
'port'
],
'port'
:
self
.
graphics
[
'port'
],
'passwd'
:
self
.
graphics
[
'passwd'
],
'passwd'
:
self
.
graphics
[
'passwd'
],
})
})
# Features
# Features
(TODO: features as list)
features
=
ET
.
SubElement
(
xml_top
,
'features'
)
features
=
ET
.
SubElement
(
xml_top
,
'features'
)
if
self
.
acpi
:
if
self
.
acpi
:
ET
.
SubElement
(
features
,
'acpi'
)
ET
.
SubElement
(
features
,
'acpi'
)
# Building raw data into xml
if
self
.
raw_data
is
not
None
:
xml_top
.
append
(
ET
.
fromstring
(
self
.
raw_data
))
return
xml_top
return
xml_top
def
dump_xml
(
self
):
def
dump_xml
(
self
):
...
@@ -174,7 +180,7 @@ class VMNetwork:
...
@@ -174,7 +180,7 @@ class VMNetwork:
model -- available models in libvirt
model -- available models in libvirt
QoS -- CIRCLE QoS class?
QoS -- CIRCLE QoS class?
comment -- Any comment
comment -- Any comment
managed -- Apply managed flow rules
like Ip and mac
spoofing prevent
managed -- Apply managed flow rules
for
spoofing prevent
script -- Executable network script /bin/true by default
script -- Executable network script /bin/true by default
'''
'''
# Class attributes
# Class attributes
...
...
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