Skip to contentSkip to conversation

KVM test: Put os.kill in kvm_stat into try block to avoid traceback

PATCH Applied Yolkfull Chow 2 participants 2 messages Mar 29, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM test: Put os.kill in kvm_stat into try block to avoid traceback

Sometimes it tried to kill an already terminated process which can cause a traceback. This patch fixes the problem.

---
 client/profilers/kvm_stat/kvm_stat.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
client/profilers/kvm_stat/kvm_stat.py +4 -1
index 7568a03..59d6ff6 100644
@@ -51,7 +51,10 @@ class kvm_stat(profiler.profiler):
 
         @param test: Autotest test on which this profiler will operate on.
         """
-        os.kill(self.pid, 15)
+        try:
+            os.kill(self.pid, 15)
+        except OSError:
+            pass
 
 
     def report(self, test):
Signature · 1 line
1.7.0.1
#1 lore raw
Quoted 2 lines · Yolkfull Chow

Sometimes it tried to kill an already terminated process which can cause a traceback. This patch fixes the problem.

Thanks, applied!

Quoted 21 lines
---
 client/profilers/kvm_stat/kvm_stat.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
client/profilers/kvm_stat/kvm_stat.py +4 -1
index 7568a03..59d6ff6 100644
@@ -51,7 +51,10 @@ class kvm_stat(profiler.profiler):
 
         @param test: Autotest test on which this profiler will operate on.
         """
-        os.kill(self.pid, 15)
+        try:
+            os.kill(self.pid, 15)
+        except OSError:
+            pass
 
 
     def report(self, test):