Skip to content

Commit 28ff19b

Browse files
authored
enabled discard option (#10077)
Enable the discard option for virtio-blk and virtio-scsi devices for volumes on StorPool storage
1 parent 685ee9e commit 28ff19b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStoragePool.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.cloud.agent.properties.AgentProperties;
3030
import com.cloud.agent.properties.AgentPropertiesFileHandler;
3131
import com.cloud.hypervisor.kvm.resource.KVMHABase.HAStoragePool;
32+
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef;
3233
import com.cloud.storage.Storage;
3334
import com.cloud.storage.Storage.StoragePoolType;
3435
import com.cloud.utils.script.OutputInterpreter;
@@ -302,4 +303,11 @@ private String executeStorPoolServiceListCmd(OutputInterpreter.AllLinesParser pa
302303
public Boolean vmActivityCheck(HAStoragePool pool, HostTO host, Duration activityScriptTimeout, String volumeUuidListString, String vmActivityCheckPath, long duration) {
303304
return checkingHeartBeat(pool, host);
304305
}
306+
307+
@Override
308+
public void customizeLibvirtDiskDef(LibvirtVMDef.DiskDef disk) {
309+
if (LibvirtVMDef.DiskDef.DiskBus.VIRTIO.equals(disk.getBusType()) || LibvirtVMDef.DiskDef.DiskBus.SCSI.equals(disk.getBusType())) {
310+
disk.setDiscard(LibvirtVMDef.DiskDef.DiscardType.UNMAP);
311+
}
312+
}
305313
}

0 commit comments

Comments
 (0)