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
ef7ca318
authored
Aug 12, 2013
by
user
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolving stash conflict
parent
c360bed0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
vm.py
+13
-2
No files found.
vm.py
View file @
ef7ca318
...
@@ -31,7 +31,9 @@ class VMInstance:
...
@@ -31,7 +31,9 @@ class VMInstance:
context
=
None
,
context
=
None
,
graphics
=
None
,
graphics
=
None
,
acpi
=
True
,
acpi
=
True
,
raw_data
=
None
):
raw_data
=
None
,
seclabel_type
=
"dynamic"
,
seclabel_mode
=
"apparmor"
):
'''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
...
@@ -45,6 +47,8 @@ class VMInstance:
...
@@ -45,6 +47,8 @@ class VMInstance:
context - Key-Value pars (not used)
context - Key-Value pars (not used)
graphics - Dict that keys are: type, listen, port, passwd
graphics - Dict that keys are: type, listen, port, passwd
acpi - True/False to enable acpi
acpi - True/False to enable acpi
seclabel_type - libvirt security label type
seclabel_mode - libvirt security mode (selinux, apparmor)
'''
'''
self
.
name
=
name
self
.
name
=
name
self
.
vcpu
=
vcpu
self
.
vcpu
=
vcpu
...
@@ -59,6 +63,8 @@ class VMInstance:
...
@@ -59,6 +63,8 @@ class VMInstance:
self
.
graphics
=
graphics
self
.
graphics
=
graphics
self
.
acpi
=
acpi
self
.
acpi
=
acpi
self
.
raw_data
=
raw_data
self
.
raw_data
=
raw_data
self
.
seclabel_type
=
seclabel_type
self
.
seclabel_mode
=
seclabel_mode
def
build_xml
(
self
):
def
build_xml
(
self
):
'''Return the root Element Tree object
'''Return the root Element Tree object
...
@@ -105,6 +111,11 @@ class VMInstance:
...
@@ -105,6 +111,11 @@ class VMInstance:
# Building raw data into xml
# Building raw data into xml
if
self
.
raw_data
is
not
None
:
if
self
.
raw_data
is
not
None
:
xml_top
.
append
(
ET
.
fromstring
(
self
.
raw_data
))
xml_top
.
append
(
ET
.
fromstring
(
self
.
raw_data
))
# Security label
ET
.
SubElement
(
xml_top
,
'seclabel'
,
attrib
=
{
'type'
:
self
.
seclabel_type
,
'mode'
:
self
.
seclabel_mode
})
return
xml_top
return
xml_top
def
dump_xml
(
self
):
def
dump_xml
(
self
):
...
@@ -134,7 +145,7 @@ class VMDisk:
...
@@ -134,7 +145,7 @@ class VMDisk:
disk_device
=
"disk"
,
disk_device
=
"disk"
,
driver_name
=
"qemu"
,
driver_name
=
"qemu"
,
driver_type
=
"qcow2"
,
driver_type
=
"qcow2"
,
driver_cache
=
"
default
"
,
driver_cache
=
"
none
"
,
target_device
=
"vda"
):
target_device
=
"vda"
):
self
.
name
=
name
self
.
name
=
name
self
.
source
=
source
self
.
source
=
source
...
...
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