This test conists in copying the heartbeat monitor to guests and then putting the guest to stress with the stress program. If any soft lockups are detected, the monitor will detect it. Signed-off-by: Pradeep K Surisetty <psuriset@xxxxxxxxxxxxxxxxxx> --- client/virt/tests/softlockup.py | 80 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) create mode 100644 client/virt/tests/softlockup.py diff --git a/client/virt/tests/softlockup.py b/client/virt/tests/softlockup.py new file mode 100644 index 0000000..d206ba4 --- /dev/null +++ b/client/virt/tests/softlockup.py @@ -0,0 +1,80 @@ +import logging, os, socket +from autotest_lib.client.bin import utils + + +def run_softlockup(test, params, env): + """ + Network stress test with netperf. + + 1) Boot up a VM + 2) Build stress on host and guest + 3) run heartbeat with the given options on server and host + 3) Run for longer duration. ex: 12 or ,18 or 24 hours. + 4) Output the test result and observe drift. + + @param test: KVM test object. + @param params: Dictionary with the test parameters. + @param env: Dictionary with test environment. + """ + setup_cmd = params.get("stress_setup_cmd") + stress_cmd = params.get("stress_cmd") + server_setup_cmd = params.get("server_setup_cmd") + threshold = int(params.get("stress_threshold")) + monitor_log_file = params.get("monitor_log_file") + test_duration = 3600 * int(params.get("test_duration")) + vm = env.get_vm(params["main_vm"]) + login_timeout = int(params.get("login_timeout", 360)) + + + def client(): + vm.verify_alive() + session = vm.wait_for_login(timeout=login_timeout) + + # Get required files and copy from host to guest + monitor_path = os.path.join(test.bindir, 'deps', 'heartbeat_slu.py') + stress_path = os.path.join(os.environ['AUTODIR'], "tests", "stress", + "stress-1.0.4.tar.gz") + vm.copy_files_to(monitor_path, "/tmp") + vm.copy_files_to(stress_path, "/tmp") + + host_ip = socket.gethostbyname(socket.gethostname()) + + logging.info("Setup client, run stress and heartbeat on guest") + # Setup guest + session.cmd(setup_cmd % "/tmp", timeout=200) + # Start heartbeat on guest + session.cmd(params.get("client_setup_cmd") % ("/tmp", host_ip)) + # Where <num_threads> should be twice the number of vcpus allocated to + # the guest. + num_threads = 2* int(params.get("smp", 1)) + # Run stress test + session.cmd(stress_cmd % num_threads, timeout=test_duration) + + + def server(): + # Get number of threads to run stress. where <num_threads> should be + # twice the number of hardware/hyper threads + threads = 2 * utils.count_cpus() + logging.info("Setup server, run stress and heartbeat on host") + + # Setup server + utils.run(setup_cmd % softlockup_dir) + # Run heartbeat script + utils.run(server_setup_cmd % (sofmonitor_log_filekup_dir, threshold, + monitor_log_file)) + # Run stress test, as it generates several types of stress + # (CPU,IO, network) + utils.run(stress_cmd % threads, timeout=test_duration) + + + def wait_for_timeout(): + session1 = vm.wait_for_login(timeout=login_timeout) + session1.cmd("pkill -f stress") + session1.cmd("pkill -f heartbeat") + utils.run("pkill -f stress") + utils.run("pkill -f heartbeat") + + + server() + client() + wait_for_timeout() -- 1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html