From: Xu Wang <cngesaint(a)gmail.com>
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 except lo.
Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
.../28_definesystem_with_vsi_profile.py | 9 +++++++++
1 files changed, 9 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..a901ae7 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
@@ -33,6 +33,7 @@
#
import sys
+import os
from CimTest.Globals import logger
from CimTest.ReturnCodes import FAIL, PASS, SKIP, XFAIL_RC, XFAIL
from VirtLib import utils
@@ -188,6 +189,14 @@ 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.
+ net_info = os.popen('ip addr').read()
+ if net_info.find(vsi_defaults['SourceDevice']) == -1:
+ vsi_defaults['SourceDevice'] = net_info.split(': ')[3]
+
nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
status = FAIL
cxml = None
--
1.7.1