Commit 4381a1ce by tarokkk

adding graphics, features and acpi options

parent aec476c9
...@@ -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):
......
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