Skip to content

Commit

Permalink
virt.env_process: Close monitor socket after test
Browse files Browse the repository at this point in the history
The socket connection is stll alive after a test finishes,
normally it works well.
But there is one situation that the next test case tries to
re-connect to these monitor sockets after unpickled from env
file, even though the former monitor socket connection is
still established. In this case auotest will report a error
of "Could not find (qemu) prompt", though the monitor works
well in fact.

To avoid this problem, this patch just close all monitors'
socket connections at the end of a test case, and let the
following test case try to re-connect if needed.

Signed-off-by: Qingtang Zhou <[email protected]>
  • Loading branch information
zhouqt authored and lmr committed May 8, 2013
1 parent 6c5e01f commit 209a401
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion virttest/env_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,17 @@ def postprocess(test, params, env):
# Kill all aexpect tail threads
aexpect.kill_tail_threads()

# Terminate tcpdump if no VMs are alive
living_vms = [vm for vm in env.get_all_vms() if vm.is_alive()]
# Close all monitor socket connections of living vm.
for vm in living_vms:
if hasattr(vm, "monitors"):
for m in vm.monitors:
try:
m.close()
except Exception:
pass

# Terminate tcpdump if no VMs are alive
if not living_vms and "tcpdump" in env:
env["tcpdump"].close()
del env["tcpdump"]
Expand Down

0 comments on commit 209a401

Please sign in to comment.