This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 1bf4dd3  kvm: use IDE as the bus type for root disks and VIRTIO for 
data disks on platforms without support for para virtualization when using 
managed storage (#3319)
1bf4dd3 is described below

commit 1bf4dd39ca0bad2f3ddf0ca57303bf3a1ef6414f
Author: Sid Kattoju <45833770+skatto...@users.noreply.github.com>
AuthorDate: Fri Jul 12 03:05:23 2019 -0400

    kvm: use IDE as the bus type for root disks and VIRTIO for data disks on 
platforms without support for para virtualization when using managed storage 
(#3319)
    
    This change addresses #3089. There was an issue when disks were being added 
with bus type IDE when creating windows VMs from ISOs. It is not possible to 
select bus type when creating a VM with an ISO. The bus type is inferred based 
on the platform emulator string provided to the KVM agent. Currently when 
creating a VM with managed storage (ex: Solidfire) and OS type string Windows*, 
all disks are added as IDE. Qemu currently does not support multiple IDE 
controllers and this configura [...]
    
    Fixes #3089
---
 .../kvm/resource/LibvirtComputingResource.java     | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 9319ee5..b20f1a5 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -2336,7 +2336,6 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
 
             // if params contains a rootDiskController key, use its value 
(this is what other HVs are doing)
             DiskDef.DiskBus diskBusType = getDiskModelFromVMDetail(vmSpec);
-
             if (diskBusType == null) {
                 diskBusType = getGuestDiskModel(vmSpec.getPlatformEmulator());
             }
@@ -2375,7 +2374,12 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
                     disk.defNetworkBasedDisk(glusterVolume + 
path.replace(mountpoint, ""), pool.getSourceHost(), pool.getSourcePort(), null,
                             null, devId, diskBusType, DiskProtocol.GLUSTER, 
DiskDef.DiskFmtType.QCOW2);
                 } else if (pool.getType() == StoragePoolType.CLVM || 
physicalDisk.getFormat() == PhysicalDiskFormat.RAW) {
-                    disk.defBlockBasedDisk(physicalDisk.getPath(), devId, 
diskBusType);
+                    if (volume.getType() == Volume.Type.DATADISK) {
+                        disk.defBlockBasedDisk(physicalDisk.getPath(), devId, 
diskBusTypeData);
+                    }
+                    else {
+                        disk.defBlockBasedDisk(physicalDisk.getPath(), devId, 
diskBusType);
+                    }
                 } else {
                     if (volume.getType() == Volume.Type.DATADISK) {
                         disk.defFileBasedDisk(physicalDisk.getPath(), devId, 
diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
@@ -3197,12 +3201,14 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
             return DiskDef.DiskBus.IDE;
         } else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) {
             return DiskDef.DiskBus.SCSI;
-        } else if (platformEmulator.startsWith("Ubuntu") || 
platformEmulator.startsWith("Fedora 13") || platformEmulator.startsWith("Fedora 
12") || platformEmulator.startsWith("Fedora 11") ||
-                platformEmulator.startsWith("Fedora 10") || 
platformEmulator.startsWith("Fedora 9") || platformEmulator.startsWith("CentOS 
5.3") || platformEmulator.startsWith("CentOS 5.4") ||
-                platformEmulator.startsWith("CentOS 5.5") || 
platformEmulator.startsWith("CentOS") || platformEmulator.startsWith("Fedora") 
||
-                platformEmulator.startsWith("Red Hat Enterprise Linux 5.3") || 
platformEmulator.startsWith("Red Hat Enterprise Linux 5.4") ||
-                platformEmulator.startsWith("Red Hat Enterprise Linux 5.5") || 
platformEmulator.startsWith("Red Hat Enterprise Linux 6") || 
platformEmulator.startsWith("Debian GNU/Linux") ||
-                platformEmulator.startsWith("FreeBSD 10") || 
platformEmulator.startsWith("Oracle") || platformEmulator.startsWith("Other 
PV")) {
+        } else if (platformEmulator.contains("Ubuntu") ||
+                platformEmulator.startsWith("Fedora") ||
+                platformEmulator.startsWith("CentOS") ||
+                platformEmulator.startsWith("Red Hat Enterprise Linux") ||
+                platformEmulator.startsWith("Debian GNU/Linux") ||
+                platformEmulator.startsWith("FreeBSD") ||
+                platformEmulator.startsWith("Oracle") ||
+                platformEmulator.startsWith("Other PV")) {
             return DiskDef.DiskBus.VIRTIO;
         } else {
             return DiskDef.DiskBus.IDE;

Reply via email to