public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM Test: nicdriver_unload.py: Fix some failure whan running RHEL4.8 guest
@ 2011-03-04  6:14 Qingtang Zhou
  2011-03-13 19:37 ` Lucas Meneghel Rodrigues
  0 siblings, 1 reply; 2+ messages in thread
From: Qingtang Zhou @ 2011-03-04  6:14 UTC (permalink / raw)
  To: autotest; +Cc: kvm, Qingtang Zhou

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@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM Test: nicdriver_unload.py: Fix some failure whan running RHEL4.8 guest
  2011-03-04  6:14 [PATCH] KVM Test: nicdriver_unload.py: Fix some failure whan running RHEL4.8 guest Qingtang Zhou
@ 2011-03-13 19:37 ` Lucas Meneghel Rodrigues
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-03-13 19:37 UTC (permalink / raw)
  To: Qingtang Zhou; +Cc: autotest, kvm

On Fri, 2011-03-04 at 14:14 +0800, Qingtang Zhou wrote:
> 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.

Hi, thanks for your patch! A little comment below:

> Signed-off-by: Qingtang Zhou <qzhou@redhat.com>
> ---
>  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.

^ I wish we could count on ethtool installed on all guests, but from
what I could see, it is not available on the install DVD of some Fedora
and RHEL versions, so I guess it's safer to stick with the approach
we've been using.

Thanks!

> +    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:



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-13 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-04  6:14 [PATCH] KVM Test: nicdriver_unload.py: Fix some failure whan running RHEL4.8 guest Qingtang Zhou
2011-03-13 19:37 ` Lucas Meneghel Rodrigues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox