[PATCH] KVM Test: Make sar profiler could work in python 2.4

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

 



Popen.terminate() is new in python 2.6, which make sar
profiler could not work in python older than 2.6.
So replace Popen.terminate() with os.kill.

Add a necessary space in sar command.

Signed-off-by: Feng Yang <fyang@xxxxxxxxxx>
---
 client/profilers/sar/sar.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/client/profilers/sar/sar.py b/client/profilers/sar/sar.py
index 2618646..7ee28b3 100644
--- a/client/profilers/sar/sar.py
+++ b/client/profilers/sar/sar.py
@@ -41,8 +41,8 @@ class sar(profiler.profiler):
         else:
             # Sar process didn't return, so 0 means generate continuously
             # Just terminate the process
-            self.cmd = self.sar_path + "-o %s %d 0"
-            t_process.terminate()
+            self.cmd = self.sar_path + " -o %s %d 0"
+            os.kill(t_process.pid, 15)
 
 
     def start(self, test):
@@ -65,8 +65,10 @@ class sar(profiler.profiler):
 
         @param test: Autotest test on which this profiler will operate on.
         """
-        self.sar_process.terminate()
-
+        try:
+            os.kill(self.sar_process.pid, 15)
+        except OSError:
+            pass
 
     def report(self, test):
         """
-- 
1.5.5.6

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