Commit abd9852e by Karsa Zoltán István

add cache size

parent d2275786
...@@ -225,6 +225,7 @@ class VMDisk: ...@@ -225,6 +225,7 @@ class VMDisk:
driver_type = None driver_type = None
driver_cache = None driver_cache = None
target_device = None target_device = None
cache_size = None
def __init__(self, def __init__(self,
name, name,
...@@ -235,7 +236,8 @@ class VMDisk: ...@@ -235,7 +236,8 @@ class VMDisk:
driver_type="qcow2", driver_type="qcow2",
driver_cache="none", driver_cache="none",
target_device="vda", target_device="vda",
target_bus="virtio"): target_bus="virtio",
cache_size=1024):
self.name = name self.name = name
self.source = source self.source = source
self.disk_type = disk_type self.disk_type = disk_type
...@@ -245,6 +247,7 @@ class VMDisk: ...@@ -245,6 +247,7 @@ class VMDisk:
self.driver_cache = driver_cache self.driver_cache = driver_cache
self.target_device = target_device self.target_device = target_device
self.target_bus = target_bus self.target_bus = target_bus
self.cache_size = cache_size
@classmethod @classmethod
def deserialize(cls, desc): def deserialize(cls, desc):
...@@ -259,11 +262,14 @@ class VMDisk: ...@@ -259,11 +262,14 @@ class VMDisk:
ET.SubElement(xml_top, 'target', ET.SubElement(xml_top, 'target',
attrib={'dev': self.target_device, attrib={'dev': self.target_device,
'bus': self.target_bus}) 'bus': self.target_bus})
ET.SubElement(xml_top, 'driver', driver = ET.SubElement(xml_top, 'driver',
attrib={ attrib={
'name': self.driver_name, 'name': self.driver_name,
'type': self.driver_type, 'type': self.driver_type,
'cache': self.driver_cache}) 'cache': self.driver_cache})
metadata_cache = ET.SubElement(driver, 'metadata_cache')
ET.SubElement(metadata_cache, 'max_size',
attrib={'unit': 'bytes'}).text = str(self.cache_size)
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