From patchwork Mon Jun 6 08:16:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 851122 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p568GaUD022619 for ; Mon, 6 Jun 2011 08:16:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756915Ab1FFIQb (ORCPT ); Mon, 6 Jun 2011 04:16:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7041 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752310Ab1FFIQY (ORCPT ); Mon, 6 Jun 2011 04:16:24 -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 p568GN0I018611 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Jun 2011 04:16:23 -0400 Received: from rincewind.home.kraxel.org (vpn2-8-52.ams2.redhat.com [10.36.8.52]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p568GLRW019264; Mon, 6 Jun 2011 04:16:22 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 8EB91441CD; Mon, 6 Jun 2011 10:16:16 +0200 (CEST) From: Gerd Hoffmann To: kvm@vger.kernel.org, autotest@test.kernel.org Cc: Gerd Hoffmann Subject: [AUTOTEST PATCH 4/7] ahci: cdroms Date: Mon, 6 Jun 2011 10:16:12 +0200 Message-Id: <1307348175-27830-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1307348175-27830-1-git-send-email-kraxel@redhat.com> References: <1307348175-27830-1-git-send-email-kraxel@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 (demeter2.kernel.org [140.211.167.43]); Mon, 06 Jun 2011 08:16:36 +0000 (UTC) This patch adds support for AHCI cdroms. SCSI cdroms work too as side effect. The patch also adds cd_format, which is the same as disk_format but for cdroms. Signed-off-by: Gerd Hoffmann --- client/virt/kvm_vm.py | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py index f791851..948d14f 100644 --- a/client/virt/kvm_vm.py +++ b/client/virt/kvm_vm.py @@ -187,11 +187,23 @@ class VM(virt_vm.BaseVM): def add_smp(help, smp): return " -smp %s" % smp - def add_cdrom(help, filename, index=None): + def add_cdrom(help, filename, index=None, format=None): if has_option(help, "drive"): + name = None; + dev = ""; + if format == "ahci": + name = "ahci%s" % index + dev += " -device ide-drive,bus=ahci.%s,drive=%s" % (index, name) + format = "none" + index = None cmd = " -drive file='%s',media=cdrom" % filename - if index is not None: cmd += ",index=%s" % index - return cmd + if index is not None: + cmd += ",index=%s" % index + if format: + cmd += ",if=%s" % format + if name: + cmd += ",id=%s" % name + return cmd + dev else: return " -cdrom '%s'" % filename @@ -468,9 +480,13 @@ class VM(virt_vm.BaseVM): for cdrom in params.objects("cdroms"): cdrom_params = params.object_params(cdrom) iso = cdrom_params.get("cdrom") + if cdrom_params.get("cd_format") == "ahci" and not have_ahci: + qemu_cmd += " -device ahci,id=ahci" + have_ahci = True if iso: qemu_cmd += add_cdrom(help, virt_utils.get_path(root_dir, iso), - cdrom_params.get("drive_index")) + cdrom_params.get("drive_index"), + cdrom_params.get("cd_format")) # We may want to add {floppy_otps} parameter for -fda # {fat:floppy:}/path/. However vvfat is not usually recommended.