Skip to content

Commit 1bf4dd3

Browse files
skattoju4yadvr
authored andcommitted
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 configuration results in VMs that cannot be started. This issue does not occur when using NFS as the storage provider due to logic in that KVM agent that makes all data volumes (non root) use a virtio controller for file based disk. Similar logic was added for raw physical disks so that managed storage has the same behavior as NFS. In addition specific versions were removed from the code that guesses the disk controller to be used based on the platform emulator string since most modern operating systems support virtio. Fixes #3089
1 parent 5df11b5 commit 1bf4dd3

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,6 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
23362336

23372337
// if params contains a rootDiskController key, use its value (this is what other HVs are doing)
23382338
DiskDef.DiskBus diskBusType = getDiskModelFromVMDetail(vmSpec);
2339-
23402339
if (diskBusType == null) {
23412340
diskBusType = getGuestDiskModel(vmSpec.getPlatformEmulator());
23422341
}
@@ -2375,7 +2374,12 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
23752374
disk.defNetworkBasedDisk(glusterVolume + path.replace(mountpoint, ""), pool.getSourceHost(), pool.getSourcePort(), null,
23762375
null, devId, diskBusType, DiskProtocol.GLUSTER, DiskDef.DiskFmtType.QCOW2);
23772376
} else if (pool.getType() == StoragePoolType.CLVM || physicalDisk.getFormat() == PhysicalDiskFormat.RAW) {
2378-
disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusType);
2377+
if (volume.getType() == Volume.Type.DATADISK) {
2378+
disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData);
2379+
}
2380+
else {
2381+
disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusType);
2382+
}
23792383
} else {
23802384
if (volume.getType() == Volume.Type.DATADISK) {
23812385
disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
@@ -3197,12 +3201,14 @@ private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) {
31973201
return DiskDef.DiskBus.IDE;
31983202
} else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) {
31993203
return DiskDef.DiskBus.SCSI;
3200-
} else if (platformEmulator.startsWith("Ubuntu") || platformEmulator.startsWith("Fedora 13") || platformEmulator.startsWith("Fedora 12") || platformEmulator.startsWith("Fedora 11") ||
3201-
platformEmulator.startsWith("Fedora 10") || platformEmulator.startsWith("Fedora 9") || platformEmulator.startsWith("CentOS 5.3") || platformEmulator.startsWith("CentOS 5.4") ||
3202-
platformEmulator.startsWith("CentOS 5.5") || platformEmulator.startsWith("CentOS") || platformEmulator.startsWith("Fedora") ||
3203-
platformEmulator.startsWith("Red Hat Enterprise Linux 5.3") || platformEmulator.startsWith("Red Hat Enterprise Linux 5.4") ||
3204-
platformEmulator.startsWith("Red Hat Enterprise Linux 5.5") || platformEmulator.startsWith("Red Hat Enterprise Linux 6") || platformEmulator.startsWith("Debian GNU/Linux") ||
3205-
platformEmulator.startsWith("FreeBSD 10") || platformEmulator.startsWith("Oracle") || platformEmulator.startsWith("Other PV")) {
3204+
} else if (platformEmulator.contains("Ubuntu") ||
3205+
platformEmulator.startsWith("Fedora") ||
3206+
platformEmulator.startsWith("CentOS") ||
3207+
platformEmulator.startsWith("Red Hat Enterprise Linux") ||
3208+
platformEmulator.startsWith("Debian GNU/Linux") ||
3209+
platformEmulator.startsWith("FreeBSD") ||
3210+
platformEmulator.startsWith("Oracle") ||
3211+
platformEmulator.startsWith("Other PV")) {
32063212
return DiskDef.DiskBus.VIRTIO;
32073213
} else {
32083214
return DiskDef.DiskBus.IDE;

0 commit comments

Comments
 (0)