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

Aline Manera alinefm at linux.vnet.ibm.com
Sat Jan 25 21:28:32 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 01/24/2014 04:13 PM, 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>
> ---
>   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':




More information about the Kimchi-devel mailing list