Commit ef7ca318 by user

resolving stash conflict

parent c360bed0
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment