From patchwork Tue Jun 28 03:47:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 923112 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5S3uJcs002248 for ; Tue, 28 Jun 2011 03:56:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756543Ab1F1Dti (ORCPT ); Mon, 27 Jun 2011 23:49:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37743 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756537Ab1F1DsN (ORCPT ); Mon, 27 Jun 2011 23:48:13 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5S3mCfu000872 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Jun 2011 23:48:12 -0400 Received: from freedom.redhat.com (vpn-8-200.rdu.redhat.com [10.11.8.200]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5S3m7pH008972; Mon, 27 Jun 2011 23:48:11 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues , Pradeep K Surisetty Subject: [PATCH 2/3] Virt: Adding softlockup subtest Date: Tue, 28 Jun 2011 00:47:58 -0300 Message-Id: <1309232879-30465-3-git-send-email-lmr@redhat.com> In-Reply-To: <1309232879-30465-1-git-send-email-lmr@redhat.com> References: <1309232879-30465-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 28 Jun 2011 03:56:21 +0000 (UTC) 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 --- 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 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 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()