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

From: ShaoHe Feng <shaohef@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@linux.vnet.ibm.com> Signed-off-by: SAline Manera <alinefm@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': -- 1.8.4.2

On 01/25/2014 02:13 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@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@linux.vnet.ibm.com> Signed-off-by: SAline Manera <alinefm@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@linux.vnet.ibm.com> IBM Linux Technology Center

Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 01/24/2014 04:13 PM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@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@linux.vnet.ibm.com> Signed-off-by: SAline Manera <alinefm@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':
participants (3)
-
Aline Manera
-
shaohef@linux.vnet.ibm.com
-
Sheldon