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

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


The following commit(s) were added to refs/heads/4.19 by this push:
     new 7fbd0a9fb4d linstor: enable discard for Linstor storage pools (#9770)
7fbd0a9fb4d is described below

commit 7fbd0a9fb4d0a2f5764b9f0236d546915b6fea92
Author: Rene Peinthor <[email protected]>
AuthorDate: Thu Oct 17 11:21:47 2024 +0200

    linstor: enable discard for Linstor storage pools (#9770)
    
    * linstor: enable discard for Linstor storage pools
    
    All Linstor storage backends support discard, so it can be safely enabled.
    
    * linstor: enable discard for Linstor storage pools CHANGELOG.md
---
 .../com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java | 6 ++++++
 .../java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java  | 3 +++
 plugins/storage/volume/linstor/CHANGELOG.md                         | 6 ++++++
 3 files changed, 15 insertions(+)

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 342bb87cf41..fc1c30a5988 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
@@ -3128,6 +3128,9 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
                     else {
                         disk.defBlockBasedDisk(physicalDisk.getPath(), devId, 
diskBusType);
                     }
+                    if (pool.getType() == StoragePoolType.Linstor) {
+                        disk.setDiscard(DiscardType.UNMAP);
+                    }
                 } else {
                     if (volume.getType() == Volume.Type.DATADISK && 
!(isWindowsTemplate && isUefiEnabled)) {
                         disk.defFileBasedDisk(physicalDisk.getPath(), devId, 
diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
@@ -3474,6 +3477,9 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
                     diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, 
busT, DiskDef.DiskFmtType.QCOW2);
                 } else if (attachingDisk.getFormat() == 
PhysicalDiskFormat.RAW) {
                     diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, 
busT);
+                    if (attachingPool.getType() == StoragePoolType.Linstor) {
+                        diskdef.setDiscard(DiscardType.UNMAP);
+                    }
                 }
                 if (bytesReadRate != null && bytesReadRate > 0) {
                     diskdef.setBytesReadRate(bytesReadRate);
diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
index 3b0e2e5b371..e3ee131a84b 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
@@ -1444,6 +1444,9 @@ public class KVMStorageProcessor implements 
StorageProcessor {
                     diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, 
busT, DiskDef.DiskFmtType.QCOW2);
                 } else if (attachingDisk.getFormat() == 
PhysicalDiskFormat.RAW) {
                     diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, 
busT);
+                    if (attachingPool.getType() == StoragePoolType.Linstor) {
+                        diskdef.setDiscard(DiscardType.UNMAP);
+                    }
                 }
 
                 if (encryptDetails != null) {
diff --git a/plugins/storage/volume/linstor/CHANGELOG.md 
b/plugins/storage/volume/linstor/CHANGELOG.md
index 30f0225b45e..a69cdf5aa31 100644
--- a/plugins/storage/volume/linstor/CHANGELOG.md
+++ b/plugins/storage/volume/linstor/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to Linstor CloudStack plugin will be 
documented in this file
 The format is based on [Keep a 
Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic 
Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [2024-10-04]
+
+### Added
+
+- Enable qemu discard="unmap" for Linstor block disks
+
 ## [2024-08-27]
 
 ### Changed

Reply via email to