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

Merge pull request #1208 from autotest/pep8-fix

PEP8 mass auto fix
......@@ -84,7 +84,7 @@ def run_ksm_base(test, params, env):
"grep MemFree /proc/meminfo")
free_mem = vm.get_memory_size(get_free_mem_cmd)
max_mem = int(free_mem / (1 + TMPFS_OVERHEAD) - guest_script_overhead)
# Keep test from OOM killer
if max_mem < shared_mem:
shared_mem = max_mem
......
......@@ -14,9 +14,11 @@ import re
class PCIBusInfo:
"""
Structured info about PCI bus
"""
def __init__(self, device):
self.name = device.aobject
if device.child_bus:
......
......@@ -4,6 +4,7 @@ from autotest.client import utils
from autotest.client.shared import error
from virttest import utils_misc
@error.context_aware
def run_qemu_option_check(test, params, env):
"""
......@@ -22,8 +23,8 @@ def run_qemu_option_check(test, params, env):
Get qemu support device list
"""
support_device = utils.system_output("%s -device ? 2>&1"
% qemu_binary, timeout=10,
ignore_status=True)
% qemu_binary, timeout=10,
ignore_status=True)
if not support_device:
raise error.TestNAError("Can not get qemu support device list")
device_list = re.findall(r'name\s+"(.*)",', support_device)
......@@ -31,7 +32,6 @@ def run_qemu_option_check(test, params, env):
device_list.extend(device_list_alias)
return device_list
def get_device_option(qemu_binary, device_name):
"""
Get qemu device 'device_name' support options
......@@ -42,8 +42,8 @@ def run_qemu_option_check(test, params, env):
raise error.TestNAError(err_msg % device_name)
device_support_option = utils.run("%s -device %s,? 2>&1" %
(qemu_binary, device_name),
timeout=10,
ignore_status=True)
timeout=10,
ignore_status=True)
if device_support_option.exit_status:
raise error.TestError("Oops, output status is wrong")
if not re.findall(r"%s\.(.*)=(.*)" % device_name,
......@@ -52,7 +52,6 @@ def run_qemu_option_check(test, params, env):
logging.info("Qemu options check successfull. output is:\n%s" %
device_support_option.stdout)
device_name = params.get("device_name")
qemu_binary = utils_misc.get_qemu_binary(params)
......
......@@ -41,7 +41,6 @@ def run_set_link(test, params, env):
err_msg += "Error info: '%s'" % err
raise error.TestFail(err_msg)
def change_queues_number_repeatly(guest_ifname):
"""
Change queues repeatedly, only for mq test
......@@ -49,7 +48,7 @@ def run_set_link(test, params, env):
session = vm.wait_for_serial_login()
try:
queues = params.get("queues", 1)
change_list = xrange(1, int(queues)+1)
change_list = xrange(1, int(queues) + 1)
env["run_change_queues"] = True
change_queues_number(session, guest_ifname, queues)
while env["run_change_queues"]:
......@@ -60,7 +59,6 @@ def run_set_link(test, params, env):
del env["run_change_queues"]
session.close()
def guest_reboot(reboot_method, link_up):
"""
Reboot guest by different method (shell/system_reset)
......@@ -71,7 +69,6 @@ def run_set_link(test, params, env):
if not link_up:
logging.info("Login error is expected when net link is down")
def guest_netwok_connecting_check(guest_ip, link_up, change_queues=False):
"""
Check whether guest network is connective by ping
......@@ -102,7 +99,6 @@ def run_set_link(test, params, env):
env["run_change_queues"] = False
bg_thread.join()
def operstate_check(session, expect_status, guest_ifname=""):
"""
Check Guest interface operstate
......@@ -112,7 +108,7 @@ def run_set_link(test, params, env):
session.cmd)
else:
if_operstate = utils_net.get_windows_nic_attribute(session,
"macaddress", vm.get_mac_address(), "netconnectionstatus")
"macaddress", vm.get_mac_address(), "netconnectionstatus")
if if_operstate != expect_status:
err_msg = "Guest interface %s status error, " % guest_ifname
......@@ -122,7 +118,6 @@ def run_set_link(test, params, env):
logging.info("Guest interface operstate '%s' is exactly as expected" %
if_operstate)
def guest_interface_operstate_check(expect_status, guest_ifname="",
change_queues=False):
"""
......@@ -132,7 +127,7 @@ def run_set_link(test, params, env):
try:
if change_queues:
queues = params.get("queues", 1)
change_list = xrange(1, int(queues)+1)
change_list = xrange(1, int(queues) + 1)
for q_number in change_list:
change_queues_number(session, guest_ifname, q_number)
operstate_check(session, expect_status, guest_ifname)
......@@ -141,7 +136,6 @@ def run_set_link(test, params, env):
finally:
session.close()
def set_link_test(linkid, link_up, expect_status,
operstate_always_up=False, change_queues=False):
"""
......@@ -182,7 +176,6 @@ def run_set_link(test, params, env):
reboot_method, logging.info)
guest_netwok_connecting_check(guest_ip, link_up, change_queues)
vm = env.get_vm(params["main_vm"])
vm.verify_alive()
login_timeout = float(params.get("login_timeout", 360))
......
......@@ -134,7 +134,7 @@ def run_sr_iov_sanity(test, params, env):
if device_type == "vf":
post_device_num = pci_assignable.get_vfs_count()
else:
post_device_num = len(pci_assignable.get_pf_vf_info())
post_device_num = len(pci_assignable.get_pf_vf_info())
if post_device_num != device_num:
msg = "lspci cannot report the correct PF/VF number."
msg += " Correct number is '%s'" % device_num
......
......@@ -34,10 +34,10 @@ def run_suspend_under_stress(test, params, env):
bg_stress_run_flag = params.get("bg_stress_run_flag")
env[bg_stress_run_flag] = False
stress_thread = utils.InterruptedThread(
utils_test.run_virt_sub_test, (test, params, env),
{"sub_type": bg_stress_test})
utils_test.run_virt_sub_test, (test, params, env),
{"sub_type": bg_stress_test})
stress_thread.start()
if not utils_misc.wait_for(lambda : env.get(bg_stress_run_flag),
if not utils_misc.wait_for(lambda: env.get(bg_stress_run_flag),
wait_time, 0, 5,
"Wait %s test start" % bg_stress_test):
raise error.TestError("Run stress test error")
......
......@@ -30,7 +30,6 @@ def run_zero_copy(test, params, env):
else:
return True
def enable_zerocopytx_in_host(enable=True):
"""
Enable or disable vhost_net zero copy in host
......@@ -40,10 +39,9 @@ def run_zero_copy(test, params, env):
cmd += "modprobe vhost-net experimental_zcopytx=1"
else:
cmd += "modprobe vhost-net experimental_zcopytx=0"
if utils.system(cmd) or enable != zerocp_enable_status():
if utils.system(cmd) or enable != zerocp_enable_status():
raise error.TestNAError("Set vhost_net zcopytx failed")
error.context("Set host vhost_net experimental_zcopytx", logging.info)
if params.get("enable_zerocp", 'yes') == 'yes':
enable_zerocopytx_in_host()
......@@ -69,6 +67,6 @@ def run_zero_copy(test, params, env):
err_msg = "All packets lost during ping guest %s." % guest_ip
raise error.TestFail(err_msg)
#in vm.verify_alive will check whether have userspace or kernel crash
# in vm.verify_alive will check whether have userspace or kernel crash
error.context("Check guest is alive and have no crash", logging.info)
vm.verify_alive()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册