enabled discard option (#10077)

Enable the discard option for virtio-blk and virtio-scsi devices for
volumes on StorPool storage
This commit is contained in:
slavkap 2025-06-14 12:20:47 +03:00 committed by GitHub
parent 685ee9e78f
commit 28ff19b751
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}
}
}