From patchwork Mon Apr 18 22:40:43 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: 716641 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3IMf2qI024696 for ; Mon, 18 Apr 2011 22:41:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753379Ab1DRWk6 (ORCPT ); Mon, 18 Apr 2011 18:40:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14556 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753378Ab1DRWk4 (ORCPT ); Mon, 18 Apr 2011 18:40:56 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3IMetG9023736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 18 Apr 2011 18:40:55 -0400 Received: from freedom.redhat.com (vpn-10-142.rdu.redhat.com [10.11.10.142]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3IMemIC003557; Mon, 18 Apr 2011 18:40:54 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH 3/5] KVM test: unattended_install: Introduce wait_no_ack param Date: Mon, 18 Apr 2011 19:40:43 -0300 Message-Id: <1303166445-17898-4-git-send-email-lmr@redhat.com> In-Reply-To: <1303166445-17898-1-git-send-email-lmr@redhat.com> References: <1303166445-17898-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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]); Mon, 18 Apr 2011 22:41:03 +0000 (UTC) Some distros such as OpenSUSE won't let the install test to communicate the guest ACK for some weird reason [1], this commit modifies the unattended_install test introducing a wait_no_ack param that will skip the ACK check, and break the unattended install loop when the machine turns off itself (directive halt on OpenSUSE and SLES unattended file). Other distros shouldn't be affected by this change, their install behavior was kept the same. [1] Tried several ways of transmitting the ACK by means of chroot scripts, no way. In the end of the day, I was short on time to spend too much of it figuring out a way to do it, hence the wait_no_ack param was born. I really could use some help from the guys that introduced OpenSUSE and SLES support to kvm autotest. Signed-off-by: Lucas Meneghel Rodrigues --- client/tests/kvm/tests/unattended_install.py | 25 +++++++++++++++++-------- client/tests/kvm/tests_base.cfg.sample | 2 ++ client/tests/kvm/unattended/OpenSUSE-11.xml | 13 ++----------- client/tests/kvm/unattended/SLES-11.xml | 13 ++----------- 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py index fe7222e..8513e0b 100644 --- a/client/tests/kvm/tests/unattended_install.py +++ b/client/tests/kvm/tests/unattended_install.py @@ -526,15 +526,23 @@ def run_unattended_install(test, params, env): start_time = time.time() while (time.time() - start_time) < install_timeout: - vm.verify_alive() - vm.verify_kernel_crash() - client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: - client.connect((vm.get_address(), port)) - if client.recv(1024) == "done": + vm.verify_alive() + except kvm_vm.VMDeadError, e: + if params.get("wait_no_ack", "no") == "yes": break - except (socket.error, kvm_vm.VMAddressError): - pass + else: + raise e + vm.verify_kernel_crash() + if params.get("wait_no_ack", "no") == "no": + client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + client.connect((vm.get_address(), port)) + if client.recv(1024) == "done": + break + except (socket.error, kvm_vm.VMAddressError): + pass + if migrate_background: # Drop the params which may break the migration # Better method is to use dnsmasq to do the @@ -549,7 +557,8 @@ def run_unattended_install(test, params, env): vm.migrate(timeout=mig_timeout, protocol=mig_protocol) else: time.sleep(1) - client.close() + if params.get("wait_no_ack", "no") == "no": + client.close() else: raise error.TestFail("Timeout elapsed while waiting for install to " "finish") diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index b96755d..fbe416e 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -1296,6 +1296,7 @@ variants: # hold your autoyast file extra_params += " --append 'autoyast=floppy console=ttyS0,115200 console=tty0'" #extra_params += " --append 'autoyast=cdrom console=ttyS0,115200 console=tty0'" + wait_no_ack = yes variants: - 11.0.32: @@ -1437,6 +1438,7 @@ variants: #extra_params += " --append 'autoyast=cdrom console=ttyS0,115200 console=tty0'" kernel = linux initrd = initrd + wait_no_ack = yes variants: - 11.0.32: diff --git a/client/tests/kvm/unattended/OpenSUSE-11.xml b/client/tests/kvm/unattended/OpenSUSE-11.xml index 0ade836..0f11ac9 100644 --- a/client/tests/kvm/unattended/OpenSUSE-11.xml +++ b/client/tests/kvm/unattended/OpenSUSE-11.xml @@ -65,6 +65,7 @@ false + true none @@ -160,17 +161,7 @@ server -#!/usr/bin/python -import socket, os -server=socket.socket(socket.AF_INET, socket.SOCK_STREAM) -server.bind(('',12323)) -server.listen(1) -(client, addr) = server.accept() -client.send("done") -client.close() -EOF -python server +service sshd restart ]]> diff --git a/client/tests/kvm/unattended/SLES-11.xml b/client/tests/kvm/unattended/SLES-11.xml index c694a31..16c25d0 100644 --- a/client/tests/kvm/unattended/SLES-11.xml +++ b/client/tests/kvm/unattended/SLES-11.xml @@ -92,6 +92,7 @@ false + true none @@ -542,17 +543,7 @@ server -#!/usr/bin/python -import socket, os -server=socket.socket(socket.AF_INET, socket.SOCK_STREAM) -server.bind(('',12323)) -server.listen(1) -(client, addr) = server.accept() -client.send("done") -client.close() -EOF -python server +service sshd restart ]]>