[Kimchi-devel] [PATCH] [Kimchi 1/4] Read io and cache option from disks

Ramon Medeiros ramonn at linux.vnet.ibm.com
Thu Mar 9 13:16:00 UTC 2017


Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 xmlutils/disk.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/xmlutils/disk.py b/xmlutils/disk.py
index 02d6811..8edb991 100644
--- a/xmlutils/disk.py
+++ b/xmlutils/disk.py
@@ -147,12 +147,21 @@ def get_vm_disk_info(dom, dev_name):
     except:
         path = ""
 
-    return {'dev': dev_name,
+    base = {'dev': dev_name,
             'path': path,
             'type': disk.attrib['device'],
             'format': disk.driver.attrib['type'],
             'bus': disk.target.attrib['bus']}
 
+    # optional parameters
+    if disk.driver.attrib.get('io') != None:
+        base.update({'io': disk.driver.attrib['io']})
+
+    if disk.driver.attrib.get('cache') != None:
+        base.update({'cache': disk.driver.attrib['cache']})
+
+    return base
+
 
 def get_vm_disks(dom):
     xml = dom.XMLDesc(0)
-- 
2.9.3



More information about the Kimchi-devel mailing list