[Kimchi-devel] [PATCH] vmHostDevModel: returning 'product' and 'vendor' in lookup

Jose Ricardo Ziviani joserz at linux.vnet.ibm.com
Tue Jul 28 22:37:40 UTC 2015


Reviewed-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>

On 28-07-2015 19:33, dhbarboza82 at gmail.com wrote:
> From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
>
> The 'getVMCPIDevices' API was missing these infos that are
> present in other API calls such as getAllAvailableDevices.
>
> Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
> ---
>   src/kimchi/model/vmhostdevs.py | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/kimchi/model/vmhostdevs.py b/src/kimchi/model/vmhostdevs.py
> index 9a7d03b..a9f6d77 100644
> --- a/src/kimchi/model/vmhostdevs.py
> +++ b/src/kimchi/model/vmhostdevs.py
> @@ -217,10 +217,15 @@ class VMHostDevModel(object):
>               raise NotFoundError('KCHVMHDEV0001E',
>                                   {'vmid': vmid, 'dev_name': dev_name})
>
> +        dev_model = DeviceModel(conn=self.conn)
>           for e in hostdev:
>               deduced_name = DeviceModel.deduce_dev_name(e, self.conn)
>               if deduced_name == dev_name:
> -                return {'name': dev_name, 'type': e.attrib['type']}
> +                dev_info = dev_model.lookup(dev_name)
> +                return {'name': dev_name,
> +                        'type': e.attrib['type'],
> +                        'product': dev_info.get('product', None),
> +                        'vendor': dev_info.get('vendor', None)}
>
>           raise NotFoundError('KCHVMHDEV0001E',
>                               {'vmid': vmid, 'dev_name': dev_name})
>

-- 
Jose Ricardo Ziviani
-----------------------------
Software Engineer
Linux Technology Center - IBM




More information about the Kimchi-devel mailing list