This is an automated email from the ASF dual-hosted git repository. nvazquez 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 83c0b61 Externalize KVM Agent storage's reboot configuration (#4586) 83c0b61 is described below commit 83c0b61ab20236592181ca9f6786274c0d335c90 Author: Daniel Augusto Veronezi Salvador <38945620+gutoveron...@users.noreply.github.com> AuthorDate: Tue Aug 24 01:06:00 2021 -0300 Externalize KVM Agent storage's reboot configuration (#4586) Co-authored-by: GutoVeronezi <dan...@scclouds.com.br> --- agent/conf/agent.properties | 3 +++ .../src/main/java/com/cloud/agent/properties/AgentProperties.java | 8 ++++++++ .../main/java/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties index 2586327..784abf7 100644 --- a/agent/conf/agent.properties +++ b/agent/conf/agent.properties @@ -271,5 +271,8 @@ iscsi.session.cleanup.enabled=false # Depending on the use case, this timeout might need increasing/decreasing. # heartbeat.update.timeout=60000 +# This parameter specifies if the host must be rebooted when something goes wrong with the heartbeat. +# reboot.host.and.alert.management.on.heartbeat.timeout=true + # Enable manually setting CPU's topology on KVM's VM. # enable.manually.setting.cpu.topology.on.kvm.vm=true diff --git a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java index d04e98f..9e5f167 100644 --- a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java +++ b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java @@ -33,6 +33,14 @@ public class AgentProperties{ public static final Property<Integer> HEARTBEAT_UPDATE_TIMEOUT = new Property<Integer>("heartbeat.update.timeout", 60000); /** + * Reboot host and alert management on heartbeat timeout. <br> + * Data type: boolean.<br> + * Default value: true. + */ + public static final Property<Boolean> REBOOT_HOST_AND_ALERT_MANAGEMENT_ON_HEARTBEAT_TIMEOUT + = new Property<Boolean>("reboot.host.and.alert.management.on.heartbeat.timeout", true); + + /** * Enable manually setting CPU's topology on KVM's VM. <br> * Data type: boolean.<br> * Default value: true. diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java index a939abe..022b48c 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java @@ -36,6 +36,7 @@ public class KVMHAMonitor extends KVMHABase implements Runnable { private static final Logger s_logger = Logger.getLogger(KVMHAMonitor.class); private final Map<String, NfsStoragePool> storagePool = new ConcurrentHashMap<>(); + private final boolean rebootHostAndAlertManagementOnHeartbeatTimeout; private final String hostPrivateIp; @@ -47,6 +48,7 @@ public class KVMHAMonitor extends KVMHABase implements Runnable { configureHeartBeatPath(scriptPath); _heartBeatUpdateTimeout = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.HEARTBEAT_UPDATE_TIMEOUT); + rebootHostAndAlertManagementOnHeartbeatTimeout = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.REBOOT_HOST_AND_ALERT_MANAGEMENT_ON_HEARTBEAT_TIMEOUT); } private static synchronized void configureHeartBeatPath(String scriptPath) { @@ -134,7 +136,7 @@ public class KVMHAMonitor extends KVMHABase implements Runnable { } - if (result != null) { + if (result != null && rebootHostAndAlertManagementOnHeartbeatTimeout) { s_logger.warn(String.format("Write heartbeat for pool [%s] failed: %s; stopping cloudstack-agent.", uuid, result)); Script cmd = createHeartBeatCommand(primaryStoragePool, null, false); result = cmd.execute();