This is an automated email from the ASF dual-hosted git repository.
gutoveronezi 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 fdfbb4fad13 Prioritize hypervisor.uri configuration (#8254)
fdfbb4fad13 is described below
commit fdfbb4fad13ace9290df8887acbd21ae9d099915
Author: sato03 <[email protected]>
AuthorDate: Wed Dec 6 16:43:04 2023 -0300
Prioritize hypervisor.uri configuration (#8254)
Co-authored-by: Henrique Sato <[email protected]>
---
.../hypervisor/kvm/resource/LibvirtComputingResource.java | 5 +----
.../com/cloud/hypervisor/kvm/resource/LibvirtConnection.java | 11 +++++++++--
2 files changed, 10 insertions(+), 6 deletions(-)
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 81f43dd53c0..da769052c45 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
@@ -1004,10 +1004,7 @@ public class LibvirtComputingResource extends
ServerResourceBase implements Serv
rollingMaintenanceExecutor =
BooleanUtils.isTrue(AgentPropertiesFileHandler.getPropertyValue(AgentProperties.ROLLING_MAINTENANCE_SERVICE_EXECUTOR_DISABLED))
? new RollingMaintenanceAgentExecutor(hooksDir) :
new RollingMaintenanceServiceExecutor(hooksDir);
- hypervisorURI =
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.HYPERVISOR_URI);
- if (hypervisorURI == null) {
- hypervisorURI =
LibvirtConnection.getHypervisorURI(hypervisorType.toString());
- }
+ hypervisorURI =
LibvirtConnection.getHypervisorURI(hypervisorType.toString());
networkDirectSourceMode =
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.NETWORK_DIRECT_SOURCE_MODE);
networkDirectDevice =
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.NETWORK_DIRECT_DEVICE);
diff --git
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
index c70a72f399c..7563f964759 100644
---
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
+++
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
@@ -19,6 +19,8 @@ package com.cloud.hypervisor.kvm.resource;
import java.util.HashMap;
import java.util.Map;
+import com.cloud.agent.properties.AgentProperties;
+import com.cloud.agent.properties.AgentPropertiesFileHandler;
import org.apache.log4j.Logger;
import org.libvirt.Connect;
import org.libvirt.LibvirtException;
@@ -88,10 +90,15 @@ public class LibvirtConnection {
}
static String getHypervisorURI(String hypervisorType) {
+ String uri =
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.HYPERVISOR_URI);
+ if (uri != null) {
+ return uri;
+ }
+
if ("LXC".equalsIgnoreCase(hypervisorType)) {
return "lxc:///";
- } else {
- return "qemu:///system";
}
+
+ return "qemu:///system";
}
}