From patchwork Mon May 24 07:37:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Yang X-Patchwork-Id: 101824 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4O7bgAD031616 for ; Mon, 24 May 2010 07:37:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756176Ab0EXHhk (ORCPT ); Mon, 24 May 2010 03:37:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30531 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756147Ab0EXHhk (ORCPT ); Mon, 24 May 2010 03:37:40 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4O7bd5J029927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 May 2010 03:37:39 -0400 Received: from localhost.localdomain (dhcp-91-72.nay.redhat.com [10.66.91.72]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4O7ba56029836; Mon, 24 May 2010 03:37:37 -0400 From: Feng Yang To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Feng Yang Subject: [Autotest][PATCH V3] KVM Test: Add ioquit test case Date: Mon, 24 May 2010 15:37:36 +0800 Message-Id: <1274686656-9326-1-git-send-email-fyang@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 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.3 (demeter.kernel.org [140.211.167.41]); Mon, 24 May 2010 07:37:43 +0000 (UTC) diff --git a/client/tests/kvm/tests/ioquit.py b/client/tests/kvm/tests/ioquit.py new file mode 100644 index 0000000..389a867 --- /dev/null +++ b/client/tests/kvm/tests/ioquit.py @@ -0,0 +1,38 @@ +import logging, time, random +from autotest_lib.client.common_lib import error +import kvm_test_utils + + +def run_ioquit(test, params, env): + """ + Emulate the poweroff under IO workload(dd so far) using kill -9. + + @param test: Kvm test object + @param params: Dictionary with the test parameters. + @param env: Dictionary with test environment. + """ + + vm = kvm_test_utils.get_living_vm(env, params.get("main_vm")) + session = kvm_test_utils.wait_for_login(vm, + timeout=int(params.get("login_timeout", 360))) + session2 = kvm_test_utils.wait_for_login(vm, + timeout=int(params.get("login_timeout", 360))) + try: + bg_cmd = params.get("background_cmd") + logging.info("Add IO workload for guest OS.") + (s, o) = session.get_command_status_output(bg_cmd, timeout=60) + check_cmd = params.get("check_cmd") + (s, o) = session2.get_command_status_output(check_cmd, timeout=60) + if int(o) <= 0: + raise error.TestError("Fail to add IO workload for Guest OS") + + logging.info("Sleep for a while") + time.sleep(random.randrange(30,100)) + (s, o) = session2.get_command_status_output(check_cmd, timeout=300) + if int(o) <= 0: + logging.info("IO workload finished before the VM was killed") + logging.info("Kill the virtual machine") + vm.process.close() + finally: + session.close() + session2.close() diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index be96dc1..e0e1ba7 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -348,6 +348,12 @@ variants: - vmexit: case = vmexit + - ioquit: + type = ioquit + background_cmd = "for i in 1 2 3 4; do (nohup dd if=/dev/urandom of=/tmp/file bs=102400 count=10000000 &) done" + check_cmd = ps -a |grep dd |wc -l + login_timeout = 360 + - qemu_img: type = qemu_img vms = '' @@ -1359,6 +1365,12 @@ variants: extra_params += " -mem-path /mnt/kvm_hugepage" +ioquit: + post_command_noncritical = no + only qcow2 + only Linux + + variants: - @no_pci_assignable: pci_assignable = no