Skip to content

Commit 20901c7

Browse files
Merge remote-tracking branch 'origin/4.19'
2 parents 627784e + 7fbd0a9 commit 20901c7

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -3152,6 +3152,9 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
31523152
else {
31533153
disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusType);
31543154
}
3155+
if (pool.getType() == StoragePoolType.Linstor) {
3156+
disk.setDiscard(DiscardType.UNMAP);
3157+
}
31553158
} else {
31563159
if (volume.getType() == Volume.Type.DATADISK && !(isWindowsTemplate && isUefiEnabled)) {
31573160
disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
@@ -3498,6 +3501,9 @@ public synchronized String attachOrDetachDisk(final Connect conn,
34983501
diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, busT, DiskDef.DiskFmtType.QCOW2);
34993502
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {
35003503
diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, busT);
3504+
if (attachingPool.getType() == StoragePoolType.Linstor) {
3505+
diskdef.setDiscard(DiscardType.UNMAP);
3506+
}
35013507
}
35023508
if (bytesReadRate != null && bytesReadRate > 0) {
35033509
diskdef.setBytesReadRate(bytesReadRate);

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

+3
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,9 @@ protected synchronized void attachOrDetachDisk(final Connect conn, final boolean
14471447
diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, busT, DiskDef.DiskFmtType.QCOW2);
14481448
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {
14491449
diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, busT);
1450+
if (attachingPool.getType() == StoragePoolType.Linstor) {
1451+
diskdef.setDiscard(DiscardType.UNMAP);
1452+
}
14501453
}
14511454

14521455
if (encryptDetails != null) {

plugins/storage/volume/linstor/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to Linstor CloudStack plugin will be documented in this file
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2024-10-04]
9+
10+
### Added
11+
12+
- Enable qemu discard="unmap" for Linstor block disks
13+
814
## [2024-08-27]
915

1016
### Changed

0 commit comments

Comments
 (0)