From: ShaoHe Feng <shaohef(a)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(a)linux.vnet.ibm.com>
Signed-off-by: Aline Manera <alinefm(a)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..a3a2576 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"):
+ info['model'] = iface.model.get('type')
if info['type'] == 'network':
info['network'] = iface.source.get('network')
if info['type'] == 'bridge':
--
1.8.4.2