提交 cf629be6 编写于 作者: L Lucas Meneghel Rodrigues

qemu.tests.pktgen: Fix py 2.4 incompatible construct

For now, try/except/finally blocks shouldn't be used.
Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 71655dda
......@@ -80,18 +80,18 @@ def run_pktgen(test, params, env):
vm.get_mac_address(),
server_interface, run_threads)
try:
#Set a run flag in env, when other case call this case as a sub
#backgroud process, can set run flag to False to stop this case.
env["pktgen_run"] = True
start_time = time.time()
stop_time = start_time + pktgen_stress_timeout
while (env["pktgen_run"] and time.time < stop_time):
runner(exec_cmd, timeout= pktgen_stress_timeout)
#using ping to kill the pktgen stress
except aexpect.ShellTimeoutError:
session.cmd("ping pktgen_ip")
try:
#Set a run flag in env, when other case call this case as a sub
#backgroud process, can set run flag to False to stop this case.
start_time = time.time()
stop_time = start_time + pktgen_stress_timeout
while (env["pktgen_run"] and time.time < stop_time):
runner(exec_cmd, timeout= pktgen_stress_timeout)
#using ping to kill the pktgen stress
except aexpect.ShellTimeoutError:
session.cmd("ping pktgen_ip")
finally:
env["pktgen_run"] = False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册