Skip to content

Commit 7233d17

Browse files
committed
kvm: drop the virtio-blk checks on running disks, which can never match
A virtio-blk disk is written to the domain XML with libvirt's 'virtio' bus, so the running domain reports it back as VIRTIO and the VIRTIOBLK checks on the parsed disks are dead code. Attaching to a virtio-blk VM is handled by the fallback to the VM's rootDiskController detail in getAttachDiskBusType(). LibvirtComputingResource.attachOrDetachDisk() is back to what it was; nothing calls it.
1 parent 3d7ab65 commit 7233d17

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,15 +3613,13 @@ public synchronized String attachOrDetachDisk(final Connect conn,
36133613
if (disk.getDeviceType() == DeviceType.DISK) {
36143614
if (disk.getBusType() == DiskDef.DiskBus.SCSI) {
36153615
busT = DiskDef.DiskBus.SCSI;
3616-
} else if (disk.getBusType() == DiskDef.DiskBus.VIRTIOBLK) {
3617-
busT = DiskDef.DiskBus.VIRTIOBLK;
36183616
}
36193617
break;
36203618
}
36213619
}
36223620

36233621
diskdef = new DiskDef();
3624-
if (busT == DiskDef.DiskBus.SCSI || busT == DiskDef.DiskBus.VIRTIOBLK) {
3622+
if (busT == DiskDef.DiskBus.SCSI) {
36253623
diskdef.setQemuDriver(true);
36263624
diskdef.setDiscard(DiscardType.UNMAP);
36273625
}

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,8 +1544,6 @@ protected DiskDef.DiskBus getAttachDiskBusType(int deviceId, List<DiskDef> disks
15441544
}
15451545
if (disk.getBusType() == DiskDef.DiskBus.SCSI) {
15461546
return DiskDef.DiskBus.SCSI;
1547-
} else if (disk.getBusType() == DiskDef.DiskBus.VIRTIOBLK) {
1548-
return DiskDef.DiskBus.VIRTIOBLK;
15491547
}
15501548
}
15511549
if (deviceId != 0 && DiskDef.DiskBus.VIRTIOBLK == DiskDef.DiskBus.fromValue(

0 commit comments

Comments
 (0)