[AUTOTEST PATCH 3/7] ahci: disk images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds support for AHCI disk images.

Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
---
 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"),
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux