Skip to content

Commit a74a4a8

Browse files
committed
Refactor condition to enable iouring
1 parent b349e75 commit a74a4a8

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

‎agent/conf/agent.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,5 +286,5 @@ iscsi.session.cleanup.enabled=false
286286
# Enable manually setting CPU's topology on KVM's VM.
287287
# enable.manually.setting.cpu.topology.on.kvm.vm=true
288288

289-
# Enable/disable IO driver for Qemu (requires an io_uring supported qemu version)
289+
# Enable/disable IO driver for Qemu (in case it is not set CloudStack can also detect if its supported by qemu)
290290
# enable.io.uring=true

‎agent/src/main/java/com/cloud/agent/properties/AgentProperties.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ public class AgentProperties{
5555
public static final Property<Boolean> ENABLE_MANUALLY_SETTING_CPU_TOPOLOGY_ON_KVM_VM = new Property<Boolean>("enable.manually.setting.cpu.topology.on.kvm.vm", true);
5656

5757
/**
58-
* Enable manually IO driver on KVM's VM. To be applied it also requires qemu supports io_uring <br>
58+
* Enable manually IO driver on KVM's VM. If it is not manually enabled CloudStack can detect if its available<br>
5959
* Data type: boolean.<br>
60-
* Default value: true.
60+
* Default value: null.
6161
*/
62-
public static final Property<Boolean> ENABLE_IO_URING = new Property<>("enable.io.uring", true);
62+
public static final Property<Boolean> ENABLE_IO_URING = new Property<>("enable.io.uring", null);
6363

6464
public static class Property <T>{
6565
private final String name;

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2964,7 +2964,7 @@ protected boolean isIoUringSupportedByQemu() {
29642964
}
29652965

29662966
protected String getIoUringCheckCommand() {
2967-
String[] qemuPaths = {"/usr/bin/qemu-system-x86_64", "/usr/libexec/qemu-kvm", "/usr/bin/qemu-kvm" };
2967+
String[] qemuPaths = { "/usr/bin/qemu-system-x86_64", "/usr/libexec/qemu-kvm", "/usr/bin/qemu-kvm" };
29682968
for (String qemuPath : qemuPaths) {
29692969
File file = new File(qemuPath);
29702970
if (file.exists()) {
@@ -2991,10 +2991,19 @@ && isIoUringEnabled()) {
29912991
}
29922992

29932993
/**
2994-
* IO_URING supported if it is supported by qemu AND the property 'enable.io.uring' is set to true
2994+
* IO_URING supported if the property 'enable.io.uring' is set to true OR it is supported by qemu
29952995
*/
29962996
private boolean isIoUringEnabled() {
2997-
return isIoUringSupportedByQemu() && AgentPropertiesFileHandler.getPropertyValue(AgentProperties.ENABLE_IO_URING);
2997+
Boolean propertyValue = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.ENABLE_IO_URING);
2998+
return BooleanUtils.isTrue(propertyValue) || isBaseOsUbuntu() || isIoUringSupportedByQemu();
2999+
}
3000+
3001+
private boolean isBaseOsUbuntu() {
3002+
Map<String, String> versionString = getVersionStrings();
3003+
if (MapUtils.isEmpty(versionString) || !versionString.containsKey("Host.OS") || versionString.get("Host.OS") == null) {
3004+
return false;
3005+
}
3006+
return versionString.get("Host.OS").equalsIgnoreCase("ubuntu");
29983007
}
29993008

30003009
private KVMPhysicalDisk getPhysicalDiskFromNfsStore(String dataStoreUrl, DataTO data) {

0 commit comments

Comments
 (0)