[PATCH] KVM Test: nicdriver_unload.py: Fix some failure whan running RHEL4.8 guest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1. readlink in RHEL4.8 doesn't have a '-e' parameter, replace it with '-f'.
2. nic driver parameter path in '/sys' is different, get it from config file.

Signed-off-by: Qingtang Zhou <qzhou@xxxxxxxxxx>
---
 client/tests/kvm/tests/nicdriver_unload.py |   13 ++++++++++---
 client/tests/kvm/tests_base.cfg.sample     |    9 +++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/client/tests/kvm/tests/nicdriver_unload.py b/client/tests/kvm/tests/nicdriver_unload.py
index 15a73ce..4849f74 100644
--- a/client/tests/kvm/tests/nicdriver_unload.py
+++ b/client/tests/kvm/tests/nicdriver_unload.py
@@ -26,9 +26,16 @@ def run_nicdriver_unload(test, params, env):
 
     ethname = kvm_test_utils.get_linux_ifname(session_serial,
                                               vm.get_mac_address(0))
-    sys_path = "/sys/class/net/%s/device/driver" % (ethname)
-    driver = os.path.basename(session_serial.cmd("readlink -e %s" %
-                                                 sys_path).strip())
+
+    # get ethernet driver from '/sys' directory.
+    # ethtool can do the same thing and doesn't care about os type.
+    # if we make sure all guests have ethtool, we can make a change here.
+    sys_path = params.get("sys_path") % (ethname)
+
+    # readlink in RHEL4.8 doesn't have '-e' param, should use '-f' in RHEL4.8.
+    readlink_cmd = params.get("readlink_command", "readlink -e")
+    driver = os.path.basename(session_serial.cmd("%s %s" % (readlink_cmd,
+                                                 sys_path)).strip())
     logging.info("driver is %s", driver)
 
     try:
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index eef8c97..7616888 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -1009,6 +1009,9 @@ variants:
         file_transfer:
             tmp_dir = /tmp/
             clean_cmd = rm -f
+        nicdriver_unload:
+            readlink_command = readlink -e
+            sys_path = "/sys/class/net/%s/device/driver"
 
         variants:
             - Fedora:
@@ -1602,6 +1605,9 @@ variants:
                             cdrom_cd1 = isos/linux/RHEL-4.8-i386-DVD.iso
                             md5sum_cd1 = b024f0af5079539d3ef51f71fed0b194
                             md5sum_1m_cd1 = 969c197402b9058f28a278c1f807d15b
+                        nicdriver_unload:
+                            readlink_command = readlink -f
+                            sys_path = "/sys/class/net/%s/driver"
 
 
                     - 4.8.x86_64:
@@ -1617,6 +1623,9 @@ variants:
                             cdrom_cd1 = isos/linux/RHEL-4.8-x86_64-DVD.iso
                             md5sum_cd1 = 696bc877b0200cc942626673fcc3fc09
                             md5sum_1m_cd1 = b11ac0ef7fd345ad712966972db63886
+                        nicdriver_unload:
+                            readlink_command = readlink -f
+                            sys_path = "/sys/class/net/%s/driver"
 
 
                     - 5.3.i386:
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux