On 09/26/2013 03:28 AM, Xu Wang wrote:
The name of interface should be read based on the type of it. There
are two basic types for interface device (bridge and network). The
name should be fetched in different way. I don't clear if Xen could
support network type so I didn't make any change for it and just
enhanced the logic in "virt == 'KVM'". I'll submit a set of
patches
and they solved XFAIL of VirtualSystemManagementService/
22_addmulti_brg_interface.py. So it's necessary to fix it.
Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
suites/libvirt-cim/lib/XenKvmLib/vsms_util.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
This doesn't apply to top of tree. I made a change in this area back in
May 2013:
https://www.redhat.com/archives/libvirt-cim/2013-May/msg00022.html
Please rework this patch based on those changes.
John
diff --git a/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py
b/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py
index 075c09f..7839a38 100644
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py
@@ -189,10 +189,19 @@ def add_net_res(server, service, virt, cxml, vssd_ref, nasd,
attr):
% attr['nmac'])
if virt == "KVM":
- name = cxml.get_value_xpath(
+ if attr['ntype'] == "network":
+ name = cxml.get_value_xpath(
'/domain/devices/interface/source/@network[. =
"%s"]'
% attr['net_name'])
-
+ elif attr['ntype'] == "bridge":
+ br = get_bridge_from_network_xml(attr['net_name'], server,
virt)
+ name = cxml.get_value_xpath(
+ '/domain/devices/interface/source/@bridge[. =
"%s"]'
+ % br)
+ if name != None:
+ name = attr['net_name']
+ else:
+ logger.error("Unrecognized interface type: %s" % type)
else:
# For Xen, network interfaces are converted to bridge interfaces.
br = get_bridge_from_network_xml(attr['net_name'], server, virt)