Blame SOURCES/virt-manager-addhardware-Move-controller-addition-before-target-g.patch

343f27
From 9425b5beaa81fe35394942b358e2d343540d5c56 Mon Sep 17 00:00:00 2001
343f27
From: Martin Kletzander <mkletzan@redhat.com>
343f27
Date: Thu, 27 Feb 2014 13:56:20 +0100
343f27
Subject: [PATCH 1/3] addhardware: Move controller addition before target
343f27
 generation
343f27
343f27
https://bugzilla.redhat.com/show_bug.cgi?id=1036716
343f27
343f27
RHEL-only; upstream this is a part of commit 00d5312b in which there's
343f27
a _set_disk_controller() function created with the code that is being
343f27
moved in there.
343f27
343f27
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
343f27
---
343f27
 virtManager/addhardware.py | 36 ++++++++++++++++++------------------
343f27
 1 file changed, 18 insertions(+), 18 deletions(-)
343f27
343f27
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
343f27
index 7719f8f..90cec84 100644
343f27
--- a/virtManager/addhardware.py
343f27
+++ b/virtManager/addhardware.py
343f27
@@ -1478,6 +1478,24 @@ class vmmAddHardware(vmmGObjectUI):
343f27
         for d in disks:
343f27
             used.append(d.target)
343f27
 
343f27
+        # Add a SCSI controller with model virtio-scsi if needed
343f27
+        disk.vmm_controller = None
343f27
+        if (controller_model == "virtio-scsi") and (bus == "scsi"):
343f27
+            controllers = self.vm.get_controller_devices()
343f27
+            controller = VirtualControllerSCSI(conn=self.conn.vmm)
343f27
+            controller.set_model(controller_model)
343f27
+            disk.vmm_controller = controller
343f27
+            for d in controllers:
343f27
+                if controller.type == d.type:
343f27
+                    controller.index += 1
343f27
+                if controller_model == d.model:
343f27
+                    disk.vmm_controller = None
343f27
+                    controller = d
343f27
+                    break
343f27
+
343f27
+            disk.address.type = disk.address.ADDRESS_TYPE_DRIVE
343f27
+            disk.address.controller = controller.index
343f27
+
343f27
         disk.generate_target(used)
343f27
 
343f27
         isfatal, errmsg = disk.is_size_conflict()
343f27
@@ -1498,24 +1516,6 @@ class vmmAddHardware(vmmGObjectUI):
343f27
         uihelpers.check_path_search_for_qemu(self.topwin,
343f27
                                              self.conn, disk.path)
343f27
 
343f27
-        # Add a SCSI controller with model virtio-scsi if needed
343f27
-        disk.vmm_controller = None
343f27
-        if (controller_model == "virtio-scsi") and (bus == "scsi"):
343f27
-            controllers = self.vm.get_controller_devices()
343f27
-            controller = VirtualControllerSCSI(conn=self.conn.vmm)
343f27
-            controller.set_model(controller_model)
343f27
-            disk.vmm_controller = controller
343f27
-            for d in controllers:
343f27
-                if controller.type == d.type:
343f27
-                    controller.index += 1
343f27
-                if controller_model == d.model:
343f27
-                    disk.vmm_controller = None
343f27
-                    controller = d
343f27
-                    break
343f27
-
343f27
-            disk.address.type = disk.address.ADDRESS_TYPE_DRIVE
343f27
-            disk.address.controller = controller.index
343f27
-
343f27
         self._dev = disk
343f27
         return True
343f27
 
343f27
-- 
343f27
1.8.5.3
343f27