You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2025/06/14 09:20:56 UTC
(cloudstack) branch main updated: enabled discard option (#10077)
This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 28ff19b7516 enabled discard option (#10077)
28ff19b7516 is described below
commit 28ff19b751634399fb9b1e2e2cb07ac2fa02b064
Author: slavkap <51...@users.noreply.github.com>
AuthorDate: Sat Jun 14 12:20:47 2025 +0300
enabled discard option (#10077)
Enable the discard option for virtio-blk and virtio-scsi devices for
volumes on StorPool storage
---
.../com/cloud/hypervisor/kvm/storage/StorPoolStoragePool.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStoragePool.java b/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStoragePool.java
index ac7138420c0..ab5dc03d343 100644
--- a/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStoragePool.java
+++ b/plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStoragePool.java
@@ -29,6 +29,7 @@ import com.cloud.agent.api.to.HostTO;
import com.cloud.agent.properties.AgentProperties;
import com.cloud.agent.properties.AgentPropertiesFileHandler;
import com.cloud.hypervisor.kvm.resource.KVMHABase.HAStoragePool;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef;
import com.cloud.storage.Storage;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.utils.script.OutputInterpreter;
@@ -302,4 +303,11 @@ public class StorPoolStoragePool implements KVMStoragePool {
public Boolean vmActivityCheck(HAStoragePool pool, HostTO host, Duration activityScriptTimeout, String volumeUuidListString, String vmActivityCheckPath, long duration) {
return checkingHeartBeat(pool, host);
}
+
+ @Override
+ public void customizeLibvirtDiskDef(LibvirtVMDef.DiskDef disk) {
+ if (LibvirtVMDef.DiskDef.DiskBus.VIRTIO.equals(disk.getBusType()) || LibvirtVMDef.DiskDef.DiskBus.SCSI.equals(disk.getBusType())) {
+ disk.setDiscard(LibvirtVMDef.DiskDef.DiscardType.UNMAP);
+ }
+ }
}