From patchwork Tue Jun 9 08:41:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yolkfull Chow X-Patchwork-Id: 28889 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n598gHgT013692 for ; Tue, 9 Jun 2009 08:42:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755761AbZFIImJ (ORCPT ); Tue, 9 Jun 2009 04:42:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752668AbZFIImI (ORCPT ); Tue, 9 Jun 2009 04:42:08 -0400 Received: from mx2.redhat.com ([66.187.237.31]:54647 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754839AbZFIImG (ORCPT ); Tue, 9 Jun 2009 04:42:06 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n598g808007175 for ; Tue, 9 Jun 2009 04:42:09 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n598g7FF024510; Tue, 9 Jun 2009 04:42:08 -0400 Received: from localhost.localdomain (dhcp-66-70-57.nay.redhat.com [10.66.70.57]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n598g4lv016177; Tue, 9 Jun 2009 04:42:05 -0400 Message-ID: <4A2E2052.7050304@redhat.com> Date: Tue, 09 Jun 2009 16:41:54 +0800 From: Yolkfull Chow User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b5pre) Gecko/20090513 Fedora/3.0-2.4.b3pre.hg.6a6386c16e98.fc11 Thunderbird/3.0b3pre MIME-Version: 1.0 To: kvm@vger.kernel.org CC: Uri Lublin Subject: [KVM-AUTOTEST PATCH] A test patch - Boot VMs until one of them becomes unresponsive References: <1244433717-3391-1-git-send-email-lmr@redhat.com> In-Reply-To: <1244433717-3391-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi, This test will boot VMs until one of them becomes unresponsive, and records the maximum number of VMs successfully started. diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py index cccc48e..7d00277 100644 --- a/client/tests/kvm/kvm_tests.py +++ b/client/tests/kvm/kvm_tests.py @@ -466,3 +466,70 @@ def run_linux_s3(test, params, env): logging.info("VM resumed after S3") session.close() + +def run_boot_vms(tests, params, env): + """ + Boots VMs until one of them becomes unresponsive, and records the maximum + number of VMs successfully started: + 1) boot the first vm + 2) boot the second vm cloned from the first vm, check whether it boots up + and all booted vms can ssh-login + 3) go on until cannot create VM anymore or cannot allocate memory for VM + + @param test: kvm test object + @param params: Dictionary with the test parameters + @param env: Dictionary with test environment. + """ + # boot the first vm + vm1 = kvm_utils.env_get_vm(env, params.get("main_vm")) + + if not vm1: + raise error.TestError("VM object not found in environment") + if not vm1.is_alive(): + raise error.TestError("VM seems to be dead; Test requires a living VM") + + logging.info("Waiting for first guest to be up...") + + vm1_session = kvm_utils.wait_for(vm1.ssh_login, 240, 0, 2) + if not vm1_session: + raise error.TestFail("Could not log into first guest") + + num = 1 + vms = [vm1] + sessions = [vm1_session] + + # boot the VMs + while True: + try: + num += 1 + vm_name = "vm" + str(num) + + # clone vm according to the first one + curr_vm = vm1.clone(vm_name) + logging.info(" Booting the %dth guest" % num) + if not curr_vm.create(): + raise error.TestFail("Cannot boot vm anylonger") + + curr_vm_session = kvm_utils.wait_for(curr_vm.ssh_login, 240, 0, 2) + + if not curr_vm_session: + curr_vm.send_monitor_cmd("quit") + raise error.TestFail("Could not log into %dth guest" % num) + + logging.info(" %dth guest boots up successfully" % num) + sessions.append(curr_vm_session) + vms.append(curr_vm) + + # check whether all previous ssh sessions are responsive + for vm_session in sessions: + if not vm_session.is_responsive(): + logging.error("%dth guest's session is not responsive" \ + % (sessions.index(vm_session) + 1)) + + except (error.TestFail, OSError): + for vm in vms: + logging.info("Shut down the %dth guest" % (vms.index(vm) + 1)) + vm.destroy(gracefully = params.get("kill_vm_gracefully") \ + == "yes") + logging.info("Total number booted successfully: %d" % (num - 1)) + break