From patchwork Thu Aug 4 07:18:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Yang X-Patchwork-Id: 1034192 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 p747IlAE001874 for ; Thu, 4 Aug 2011 07:18:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752371Ab1HDHSl (ORCPT ); Thu, 4 Aug 2011 03:18:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46438 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752369Ab1HDHSl (ORCPT ); Thu, 4 Aug 2011 03:18:41 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p747IdjX018879 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Aug 2011 03:18:39 -0400 Received: from fyang.redhat.com (dhcp-65-138.nay.redhat.com [10.66.65.138]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p747Ia92009286; Thu, 4 Aug 2011 03:18:38 -0400 From: fyang@redhat.com To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Feng Yang Subject: [PATCH] KVM Test: Call postprocess_vm before postprocess_image. Date: Thu, 4 Aug 2011 15:18:30 +0800 Message-Id: <1312442310-6594-1-git-send-email-fyang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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]); Thu, 04 Aug 2011 07:18:48 +0000 (UTC) From: Feng Yang Current we call postprocess_image befor postprocess_vm. If exception is thrown in postprocess_image, postprocess_vm will be skipped. So vm could not be killed, it may fail following case in same loop. Signed-off-by: Feng Yang Acked-by: Amos Kong --- client/virt/virt_env_process.py | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py index 12918eb..8fd5c21 100644 --- a/client/virt/virt_env_process.py +++ b/client/virt/virt_env_process.py @@ -163,7 +163,7 @@ def process_command(test, params, env, command, command_timeout, raise -def process(test, params, env, image_func, vm_func): +def process(test, params, env, image_func, vm_func, vm_first=False): """ Pre- or post-process VMs and images according to the instructions in params. Call image_func for each image listed in params and vm_func for each VM. @@ -177,13 +177,20 @@ def process(test, params, env, image_func, vm_func): # Get list of VMs specified for this test for vm_name in params.objects("vms"): vm_params = params.object_params(vm_name) - # Get list of images specified for this VM - for image_name in vm_params.objects("images"): - image_params = vm_params.object_params(image_name) - # Call image_func for each image - image_func(test, image_params) - # Call vm_func for each vm - vm_func(test, vm_params, env, vm_name) + if not vm_first: + # Get list of images specified for this VM + for image_name in vm_params.objects("images"): + image_params = vm_params.object_params(image_name) + # Call image_func for each image + image_func(test, image_params) + # Call vm_func for each vm + vm_func(test, vm_params, env, vm_name) + else: + vm_func(test, vm_params, env, vm_name) + for image_name in vm_params.objects("images"): + image_params = vm_params.object_params(image_name) + image_func(test, image_params) + @error.context_aware @@ -293,7 +300,7 @@ def postprocess(test, params, env): error.context("postprocessing") # Postprocess all VMs and images - process(test, params, env, postprocess_image, postprocess_vm) + process(test, params, env, postprocess_image, postprocess_vm, vm_first=True) # Terminate the screendump thread global _screendump_thread, _screendump_thread_termination_event