From patchwork Thu Jul 15 15:57:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 112258 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6FFvaBM008868 for ; Thu, 15 Jul 2010 15:57:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932776Ab0GOP5e (ORCPT ); Thu, 15 Jul 2010 11:57:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29009 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932437Ab0GOP5d (ORCPT ); Thu, 15 Jul 2010 11:57:33 -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.13.8/8.13.8) with ESMTP id o6FFvW3e002536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Jul 2010 11:57:32 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6FFvWjJ008222; Thu, 15 Jul 2010 11:57:32 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o6FFvUQK021960; Thu, 15 Jul 2010 11:57:30 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 1/9] KVM test: kvm_vm.py: make -drive index optional for both images and cdrom ISOs Date: Thu, 15 Jul 2010 18:57:30 +0300 Message-Id: <1279209458-19590-1-git-send-email-mgoldish@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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 15 Jul 2010 15:57:36 +0000 (UTC) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index 6cd0688..248aeca 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -214,16 +214,18 @@ class VM: def add_smp(help, smp): return " -smp %s" % smp - def add_cdrom(help, filename, index=2): + def add_cdrom(help, filename, index=None): if has_option(help, "drive"): - return " -drive file='%s',index=%d,media=cdrom" % (filename, - index) + cmd = " -drive file='%s',media=cdrom" % filename + if index is not None: cmd += ",index=%s" % index + return cmd else: return " -cdrom '%s'" % filename - def add_drive(help, filename, format=None, cache=None, werror=None, - serial=None, snapshot=False, boot=False): + def add_drive(help, filename, index=None, format=None, cache=None, + werror=None, serial=None, snapshot=False, boot=False): cmd = " -drive file='%s'" % filename + if index is not None: cmd += ",index=%s" % index if format: cmd += ",if=%s" % format if cache: cmd += ",cache=%s" % cache if werror: cmd += ",werror=%s" % werror @@ -362,6 +364,7 @@ class VM: continue qemu_cmd += add_drive(help, get_image_filename(image_params, root_dir), + image_params.get("drive_index"), image_params.get("drive_format"), image_params.get("drive_cache"), image_params.get("drive_werror"), @@ -414,7 +417,7 @@ class VM: iso = params.get("cdrom") if iso: iso = kvm_utils.get_path(root_dir, iso) - qemu_cmd += add_cdrom(help, iso) + qemu_cmd += add_cdrom(help, iso, 2) # Even though this is not a really scalable approach, # it doesn't seem like we are going to need more than