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

Aline Manera alinefm at linux.vnet.ibm.com
Mon Mar 13 21:30:44 UTC 2017



On 03/10/2017 08:19 PM, Ramon Medeiros wrote:
> 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']})
> +

You should return always the same group of data. Fallback io and cache 
to None or empty string in case it is not set for a given XML.

> +    return base
> +
>
>   def get_vm_disks(dom):
>       xml = dom.XMLDesc(0)



More information about the Kimchi-devel mailing list