From patchwork Mon Jun 6 08:16:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 851112 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p568GVU2017387 for ; Mon, 6 Jun 2011 08:16:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756900Ab1FFIQ1 (ORCPT ); Mon, 6 Jun 2011 04:16:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39305 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756720Ab1FFIQU (ORCPT ); Mon, 6 Jun 2011 04:16:20 -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 p568GJmi002336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Jun 2011 04:16:20 -0400 Received: from rincewind.home.kraxel.org (vpn2-8-52.ams2.redhat.com [10.36.8.52]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p568GH7n001857; Mon, 6 Jun 2011 04:16:18 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 52939441AD; 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 3/7] ahci: disk images Date: Mon, 6 Jun 2011 10:16:11 +0200 Message-Id: <1307348175-27830-4-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.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]); Mon, 06 Jun 2011 08:16:31 +0000 (UTC) This patch adds support for AHCI disk images. Signed-off-by: Gerd Hoffmann --- client/virt/kvm_vm.py | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py index af24272..f791851 100644 --- a/client/virt/kvm_vm.py +++ b/client/virt/kvm_vm.py @@ -197,6 +197,13 @@ class VM(virt_vm.BaseVM): def add_drive(help, filename, index=None, format=None, cache=None, werror=None, serial=None, snapshot=False, boot=False): + 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'" % filename if index is not None: cmd += ",index=%s" % index @@ -212,7 +219,9 @@ class VM(virt_vm.BaseVM): cmd += ",snapshot=on" if boot: cmd += ",boot=on" - return cmd + if name: + cmd += ",id=%s" % name + return cmd + dev def add_nic(help, vlan, model=None, mac=None, device_id=None, netdev_id=None, nic_extra_params=None): @@ -353,6 +362,8 @@ class VM(virt_vm.BaseVM): if root_dir is None: root_dir = self.root_dir + have_ahci = False + # Clone this VM using the new params vm = self.clone(name, params, root_dir, copy_state=True) @@ -392,6 +403,9 @@ class VM(virt_vm.BaseVM): image_params = params.object_params(image_name) if image_params.get("boot_drive") == "no": continue + if image_params.get("drive_format") == "ahci" and not have_ahci: + qemu_cmd += " -device ahci,id=ahci" + have_ahci = True qemu_cmd += add_drive(help, virt_vm.get_image_filename(image_params, root_dir), image_params.get("drive_index"),