Vitor de Lima has uploaded a new change for review.

Change subject: core, engine: Fix CD-ROM payload in ppc64 VMs
......................................................................

core, engine: Fix CD-ROM payload in ppc64 VMs

This change fixes the addressing for payload CD-ROMs in ppc64 VMs,
previously there was not a way to address two virtual CD drives at the
same time in the sPAPR VSCSI controller.

Change-Id: I0d5e6b514bfdaafd8e2df6c979bab5800db0f64b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1073540
Signed-off-by: Vitor de Lima <vitor.l...@eldorado.org.br>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
1 file changed, 14 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/33057/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
index fab0817..55d27f3 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilder.java
@@ -728,8 +728,16 @@
             struct.put(VdsProperties.Path, (isPayload) ? "" : path);
         }
         if (isPayload) {
-            // 3 is magic number for payload - we are using it as hdd
-            struct.put(VdsProperties.Index, "3");
+            String cdInterface = osRepository.getCdInterface(vm.getOs(),
+                    vm.getVdsGroupCompatibilityVersion());
+
+            if ("scsi".equals(cdInterface)) {
+                struct.put(VdsProperties.Index, "1"); // SCSI unit 1 is 
reserved for payload
+                struct.put(VdsProperties.Address, createAddressForScsiDisk(0, 
1));
+            } else if ("ide".equals(cdInterface)) {
+                // 3 is magic number for payload - we are using it as hdd
+                struct.put(VdsProperties.Index, "3");
+            }
         }
         struct.put(VdsProperties.SpecParams, specParams);
         struct.put(VdsProperties.DeviceId, 
String.valueOf(vmDevice.getId().getDeviceId()));
@@ -959,7 +967,7 @@
 
     public static Map<VmDevice, Integer> getVmDeviceUnitMapForScsiDisks(VM vm,
             DiskInterface scsiInterface,
-            boolean reserveFirstLun) {
+            boolean reserveFirstTwoLuns) {
         List<Disk> disks = new ArrayList<Disk>(vm.getDiskMap().values());
         Map<VmDevice, Integer> vmDeviceUnitMap = new HashMap<>();
         Map<VmDevice, Disk> vmDeviceDiskMap = new HashMap<>();
@@ -983,15 +991,15 @@
 
         // Find available unit (disk's index in VirtIO-SCSI controller) for 
disks with empty address
         for (Entry<VmDevice, Disk> entry : vmDeviceDiskMap.entrySet()) {
-            int unit = getAvailableUnitForScsiDisk(vmDeviceUnitMap, 
reserveFirstLun);
+            int unit = getAvailableUnitForScsiDisk(vmDeviceUnitMap, 
reserveFirstTwoLuns);
             vmDeviceUnitMap.put(entry.getKey(), unit);
         }
 
         return vmDeviceUnitMap;
     }
 
-    public static int getAvailableUnitForScsiDisk(Map<VmDevice, Integer> 
vmDeviceUnitMap, boolean reserveFirstLun) {
-        int unit = reserveFirstLun ? 1 : 0;
+    public static int getAvailableUnitForScsiDisk(Map<VmDevice, Integer> 
vmDeviceUnitMap, boolean reserveFirstTwoLuns) {
+        int unit = reserveFirstTwoLuns ? 2 : 0;
         while (vmDeviceUnitMap.containsValue(unit)) {
             unit++;
         }


-- 
To view, visit http://gerrit.ovirt.org/33057
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d5e6b514bfdaafd8e2df6c979bab5800db0f64b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Vitor de Lima <vdel...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to