[Kimchi-devel] [PATCH V2] bug fix: guest iface does not return model if no model is found

Sheldon shaohef at linux.vnet.ibm.com
Fri Jan 24 18:14:57 UTC 2014


On 01/25/2014 02:13 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> On some distros, libvirt will not set model automatically.
> if no model is found,  guest iface will not return this field.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> Signed-off-by: SAline Manera <alinefm at br.ibm.com>

SAline -> Aline.
Aline please help to fix it, and other problem. thanks,

> ---
>   docs/API.md         | 2 +-
>   src/kimchi/model.py | 3 ++-
>   2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/docs/API.md b/docs/API.md
> index f6f89f9..580728c 100644
> --- a/docs/API.md
> +++ b/docs/API.md
> @@ -180,7 +180,7 @@ A interface represents available network interface on VM.
>       * bridge *(optional)*: the name of resource bridge, only be available when the
>                 interface type is bridge.
>       * mac: Media Access Control Address of the VM interface.
> -    * model: model of emulated network interface card. It will be one of these models:
> +    * model *(optional)*: model of emulated network interface card. It will be one of these models:
>                ne2k_pci, i82551, i82557b, i82559er, rtl8139, e1000, pcnet and virtio.
>       * network *(optional)*: the name of resource network, only be available when the
>                 interface type is network.
> diff --git a/src/kimchi/model.py b/src/kimchi/model.py
> index 63e748e..544fa80 100644
> --- a/src/kimchi/model.py
> +++ b/src/kimchi/model.py
> @@ -1001,7 +1001,8 @@ class Model(object):
>
>           info['type'] = iface.attrib['type']
>           info['mac'] = iface.mac.get('address')
> -        info['model'] = iface.model.get('type')
> +        if iface.find("model") is not None:
> +            info['model'] = iface.model.get('type')
>           if info['type'] == 'network':
>               info['network'] = iface.source.get('network')
>           if info['type'] == 'bridge':


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list