KVM test: kvm_subprocess: allow garbage collection of kvm_tail instances

Tail threads refer to kvm_tail objects, preventing them from being garbage-
collected.

1) Before a tail thread exits, remove the reference to the thread from the
   kvm_tail object.
2) Add a function kill_tail_threads() which asks all tail threads to terminate
   and waits for them to do so.
3) Use kill_tail_threads() instead of VM.kill_tail_thread() (which was there
   for a different reason) in kvm_preprocessing.py.

Signed-off-by: Michael Goldish <mgoldish@redhat.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@4709 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py
index 9ae0e08..e3de0b3 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -344,9 +344,8 @@
                 else:
                     vm.destroy(gracefully=False)
 
-    # Kill the tailing threads of all VMs
-    for vm in kvm_utils.env_get_all_vms(env):
-        vm.kill_tail_thread()
+    # Kill all kvm_subprocess tail threads
+    kvm_subprocess.kill_tail_threads()
 
     # Terminate tcpdump if no VMs are alive
     living_vms = [vm for vm in kvm_utils.env_get_all_vms(env) if vm.is_alive()]