From patchwork Wed Feb 10 16:28:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yogi X-Patchwork-Id: 78444 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 o1AGSioi028093 for ; Wed, 10 Feb 2010 16:28:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754916Ab0BJQ2m (ORCPT ); Wed, 10 Feb 2010 11:28:42 -0500 Received: from e6.ny.us.ibm.com ([32.97.182.146]:42175 "EHLO e6.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754230Ab0BJQ2l (ORCPT ); Wed, 10 Feb 2010 11:28:41 -0500 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e6.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o1AGPESQ005452 for ; Wed, 10 Feb 2010 11:25:14 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o1AGSZts1052810 for ; Wed, 10 Feb 2010 11:28:35 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o1AGSYMp024105 for ; Wed, 10 Feb 2010 11:28:35 -0500 Received: from [9.124.158.64] (yogi-laptop.in.ibm.com [9.124.158.64]) by d01av01.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o1AGSWbv023843; Wed, 10 Feb 2010 11:28:33 -0500 Subject: [Autotest] [KVM-AUTOTEST PATCH 1/5] KVM test: Support for Parallel install of guest OS From: yogi To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Ryan Harper In-Reply-To: <1265818995.6747.25.camel@yogi-laptop> References: <1265818995.6747.25.camel@yogi-laptop> Date: Wed, 10 Feb 2010 21:58:30 +0530 Message-Id: <1265819310.6747.27.camel@yogi-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 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]); Wed, 10 Feb 2010 16:28:44 +0000 (UTC) diff --git a/client/tests/kvm/tests/unattended_install.py b/client/tests/kvm/tests/unattended_install.py index e3df72a..3978e26 100644 --- a/client/tests/kvm/tests/unattended_install.py +++ b/client/tests/kvm/tests/unattended_install.py @@ -13,11 +13,11 @@ def run_unattended_install(test, params, env): @param params: Dictionary with the test parameters. @param env: Dictionary with test environment. """ + buf = 1024 vm = kvm_test_utils.get_living_vm(env, params.get("main_vm")) - server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - server.bind(('', 12323)) - server.listen(1) + port = vm.get_port(int(params.get("guest_port_unattend_shell"))) + addr = ('localhost', port) install_timeout = float(params.get("timeout", 3000)) logging.info("Starting unattended install watch process. " @@ -26,21 +26,19 @@ def run_unattended_install(test, params, env): start_time = time.time() while True: - server.settimeout(install_timeout) + client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: - (client, addr) = server.accept() - except socket.timeout: - server.close() - raise error.TestFail('Timeout elapsed while waiting for install to ' - 'finish.') - msg = client.recv(1024) - logging.debug("Received '%s' from %s", msg, addr) - if msg == 'done': - end_time = time.time() - time_elapsed = int(end_time - start_time) - logging.info('Guest reported successful installation after %ds ' - '(%d min)', time_elapsed, time_elapsed/60) - server.close() - break - else: - logging.error('Got invalid string from client: %s.' % msg) + client.connect(addr) + msg = client.recv(1024) + if msg == 'thank u for connecting': + break + else: + raise Exception + except: + time.sleep(1) + client.close() + + end_time = time.time() + time_elapsed = int(end_time - start_time)