[KVM-AUTOTEST PATCH 1/1] KVM test: kvm_subprocess: don't immediately check /proc/$PID/cmdline

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

 



kvm_spawn.is_alive() incorrectly assumes that /proc/$PID/cmdline immediately
reflects the new command line of the forked process.  This makes it report
false negatives occasionally.  To prevent that, perform the command line check
only if the process is more than 10 seconds old, or if the process has been
pickled and unpickled.  In both cases, there is more than enough time for
/proc/$PID/cmdline to get updated.

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_subprocess.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py
index df1d562..457c12e 100644
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -214,6 +214,8 @@ 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 = {}
@@ -379,6 +381,10 @@ class kvm_spawn:
         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
-- 
1.5.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