On 08/07/2013 04:37 AM, Xu Wang wrote:
The default network card name is 'eth0' or 'em1'. But
if the network
card name doesn't contain those values, error would occur. So this patch
will check if the default network card name exists in the network
card name list. If not, the network card name would changed into
the first one in the network card name list.
Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
.../28_definesystem_with_vsi_profile.py | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
index 2b108f9..b7f8a5e 100644
---
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
+++
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
@@ -188,6 +188,23 @@ def main():
if rc == 0:
vsi_defaults['SourceDevice'] = "em1"
+ # The default device name may not named 'eth1' or 'em1' so this case
would
+ # return FAIL. The following code will check if default device exists in
+ # the network card list and if not, source_dev will be changed into the 1st
+ # network card in the list.
+ f = open("/proc/net/dev")
+ lines = f.readlines()
+ f.close()
+ if str(lines).find(vsi_defaults['SourceDevice']) <> -1:
+ """
+ Default net dev exists in the network info list and keep it.
+ """
+ else:
+ line = lines[2]
+ con = line.split(":")
+ vsi_defaults['SourceDevice'] = con[0].strip(" ")
+
+
Like 1/3 - needs to be common routine. Again you're getting different
and unexpected results.
John
nrasd_cn = get_typed_class(virt,
'NetResourceAllocationSettingData')
status = FAIL
cxml = None