Use a much shorter and simpler is_alive() instead of the current one.
Signed-off-by: Michael Goldish <[email protected]>
---
client/tests/kvm/kvm_subprocess.py | 25 +------------------------
1 files changed, 1 insertions(+), 24 deletions(-)
diff --git a/client/tests/kvm/kvm_subprocess.py
b/client/tests/kvm/kvm_subprocess.py
index 41b9d80..dcb20cc 100644
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -214,8 +214,6 @@ class kvm_spawn:
# Wait for the server to complete its initialization
while not "Server %s ready" % self.id in sub.stdout.readline():
pass
- # Remember the start time for is_alive()
- self.start_time = time.time()
# Open the reading pipes
self.reader_fds = {}
@@ -366,28 +364,7 @@ class kvm_spawn:
"""
Return True if the process is running.
"""
- pid = self.get_shell_pid()
- # See if the PID exists
- try:
- os.kill(pid, 0)
- except:
- return False
- # Make sure the PID belongs to the original process
- filename = "/proc/%d/cmdline" % pid
- try:
- file = open(filename, "r")
- cmdline = file.read()
- file.close()
- except:
- # If we couldn't find the file for some reason, skip the check
- return True
- # If this process is new (less than 10 secs old) skip the check
- if hasattr(self, "start_time") and time.time() < self.start_time + 10:
- return True
- # Perform the check
- if self.id in cmdline:
- return True
- return False
+ return _locked(self.lock_server_running_filename)
def close(self, sig=signal.SIGTERM):
--
1.5.4.1
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html