提交 dcb05ee0 编写于 作者: L Liping Cheng

Update for libvirt_hooks case

When failed to attach qemu process, we need to clean 'qemu-kvm'
process to avoid following cases failed.
Signed-off-by: NLiping Cheng <lcheng@redhat.com>
上级 56d3a7c4
...@@ -300,12 +300,16 @@ def run(test, params, env): ...@@ -300,12 +300,16 @@ def run(test, params, env):
sta, pid = process.getstatusoutput("pgrep qemu-kvm") sta, pid = process.getstatusoutput("pgrep qemu-kvm")
if not pid: if not pid:
test.fail("Cannot get pid of qemu command") test.fail("Cannot get pid of qemu command")
ret = virsh.qemu_attach(pid, **virsh_dargs) try:
if ret.exit_status: ret = virsh.qemu_attach(pid, **virsh_dargs)
if ret.exit_status:
utils_misc.kill_process_tree(pid)
test.fail("Cannot attach qemu process")
else:
virsh.destroy(vm_test)
except Exception as detail:
utils_misc.kill_process_tree(pid) utils_misc.kill_process_tree(pid)
test.fail("Cannot attach qemu process") test.fail("Failed to attach qemu process: %s" % str(detail))
else:
virsh.destroy(vm_test)
hook_str = hook_file + " " + vm_test + " attach begin -" hook_str = hook_file + " " + vm_test + " attach begin -"
if not check_hooks(hook_str): if not check_hooks(hook_str):
test.fail("Failed to check attach hooks") test.fail("Failed to check attach hooks")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册