From patchwork Tue Aug 21 18:01:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 1357041 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E2AC1DFB34 for ; Tue, 21 Aug 2012 18:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932230Ab2HUSVq (ORCPT ); Tue, 21 Aug 2012 14:21:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30619 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932196Ab2HUSVo (ORCPT ); Tue, 21 Aug 2012 14:21:44 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7LILTIf014458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 Aug 2012 14:21:43 -0400 Received: from freedom.redhat.com (vpn-9-181.rdu.redhat.com [10.11.9.181]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7LI1dNe023161; Tue, 21 Aug 2012 14:01:40 -0400 From: Lucas Meneghel Rodrigues To: autotest-kernel@redhat.com Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues , Gerd Hoffmann Subject: [PATCH] virt.kvm_vm: Autodetect whenever bootindex should be used Date: Tue, 21 Aug 2012 15:01:38 -0300 Message-Id: <1345572098-19701-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Also, avoid checking twice and use the result when to add boot=on/off to the command line. Signed-off-by: Gerd Hoffmann Signed-off-by: Lucas Meneghel Rodrigues --- client/virt/kvm_vm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py index 19d018d..35e12b6 100644 --- a/client/virt/kvm_vm.py +++ b/client/virt/kvm_vm.py @@ -474,7 +474,7 @@ class VM(virt_vm.BaseVM): lun=None): name = None dev = "" - if self.params.get("use_bootindex") in ['yes', 'on', True]: + if not re.search("boot=on\|off", help, re.MULTILINE): if boot in ['yes', 'on', True]: bootindex = "1" boot = "unused" @@ -550,7 +550,8 @@ class VM(virt_vm.BaseVM): cmd += _add_option("werror", werror) cmd += _add_option("serial", serial) cmd += _add_option("snapshot", snapshot, bool) - if re.search("boot=on\|off", help, re.MULTILINE): + # Only add boot=on/off if necessary (deprecated in newer qemu) + if boot != "unused": cmd += _add_option("boot", boot, bool) cmd += _add_option("id", name) cmd += _add_option("readonly", readonly, bool)