From 425fc95552ca518c10bc6d1a0625695bb5cdad0b Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Wed, 4 Dec 2024 11:36:54 -0500 Subject: [PATCH 1/9] Rename ambiguous global setting: enable.kvm.host.auto.enable.disable --- .../src/main/java/com/cloud/agent/AgentManager.java | 4 ++-- .../java/com/cloud/agent/manager/AgentManagerImpl.java | 8 ++++---- .../java/com/cloud/resource/ResourceManagerImpl.java | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java index 2182dfc542d3..0e1a4a829677 100644 --- a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java +++ b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java @@ -39,8 +39,8 @@ public interface AgentManager { static final ConfigKey Wait = new ConfigKey("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return", true); - ConfigKey EnableKVMAutoEnableDisable = new ConfigKey<>(Boolean.class, - "enable.kvm.host.auto.enable.disable", + ConfigKey KVMAutoEnableDisable = new ConfigKey<>(Boolean.class, + "enable.kvm.host.auto.enable", "Advanced", "false", "(KVM only) Enable Auto Disable/Enable KVM hosts in the cluster " + diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java index 27b3ac2d7511..0c93d86c7694 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java @@ -1268,9 +1268,9 @@ private void processHostHealthCheckResult(Boolean hostHealthCheckResult, long ho logger.error("Unable to find host with ID: {}", hostId); return; } - if (!BooleanUtils.toBoolean(EnableKVMAutoEnableDisable.valueIn(host.getClusterId()))) { - logger.debug("{} is disabled for the cluster {}, cannot process the health check result " + - "received for the host {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host.getName()); + if (!BooleanUtils.toBoolean(KVMAutoEnableDisable.valueIn(host.getClusterId()))) { + logger.debug(String.format("%s is disabled for the cluster %s, cannot process the health check result " + + "received for the host %s", KVMAutoEnableDisable.key(), host.getClusterId(), host.getName())); return; } @@ -1802,7 +1802,7 @@ public String getConfigComponentName() { @Override public ConfigKey[] getConfigKeys() { return new ConfigKey[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize, - DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait }; + DirectAgentPoolSize, DirectAgentThreadCap, KVMAutoEnableDisable, ReadyCommandWait }; } protected class SetHostParamsListener implements Listener { diff --git a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java index 228373896204..e722f4437008 100755 --- a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java @@ -1841,7 +1841,7 @@ private void handleAutoEnableDisableKVMHost(boolean autoEnableDisableKVMSetting, Boolean.parseBoolean(hostDetail.getValue()) && resourceEvent == ResourceState.Event.Disable) { logger.info(String.format("The setting %s is enabled but the host %s is manually set into %s state," + "ignoring future auto enabling of the host based on health check results", - AgentManager.EnableKVMAutoEnableDisable.key(), host.getName(), resourceEvent)); + AgentManager.KVMAutoEnableDisable.key(), host.getName(), resourceEvent)); hostDetail.setValue(Boolean.FALSE.toString()); _hostDetailsDao.update(hostDetail.getId(), hostDetail); } else if (hostDetail == null) { @@ -1853,7 +1853,7 @@ private void handleAutoEnableDisableKVMHost(boolean autoEnableDisableKVMSetting, } private boolean updateHostAllocationState(HostVO host, String allocationState, boolean isUpdateFromHostHealthCheck) throws NoTransitionException { - boolean autoEnableDisableKVMSetting = AgentManager.EnableKVMAutoEnableDisable.valueIn(host.getClusterId()) && + boolean autoEnableDisableKVMSetting = AgentManager.KVMAutoEnableDisable.valueIn(host.getClusterId()) && host.getHypervisorType() == HypervisorType.KVM; ResourceState.Event resourceEvent = getResourceEventFromAllocationStateString(allocationState); DetailVO hostDetail = _hostDetailsDao.findDetail(host.getId(), ApiConstants.AUTO_ENABLE_KVM_HOST); @@ -1867,7 +1867,7 @@ private boolean updateHostAllocationState(HostVO host, String allocationState, if (isAutoEnableAttemptForADisabledHost(autoEnableDisableKVMSetting, isUpdateFromHostHealthCheck, hostDetail, resourceEvent)) { logger.debug(String.format("The setting '%s' is enabled and the health check succeeds on the host, " + "but the host has been manually disabled previously, ignoring auto enabling", - AgentManager.EnableKVMAutoEnableDisable.key())); + AgentManager.KVMAutoEnableDisable.key())); return false; } @@ -1981,7 +1981,7 @@ private void sendAlertAndAnnotationForAutoEnableDisableKVMHostFeature(HostVO hos boolean isUpdateFromHostHealthCheck, boolean isUpdateHostAllocation, String annotation) { boolean isAutoEnableDisableKVMSettingEnabled = host.getHypervisorType() == HypervisorType.KVM && - AgentManager.EnableKVMAutoEnableDisable.valueIn(host.getClusterId()); + AgentManager.KVMAutoEnableDisable.valueIn(host.getClusterId()); if (!isAutoEnableDisableKVMSettingEnabled) { if (StringUtils.isNotBlank(annotation)) { annotationService.addAnnotation(annotation, AnnotationService.EntityType.HOST, host.getUuid(), true); @@ -2005,7 +2005,7 @@ private void sendAlertAndAnnotationForAutoEnableDisableKVMHostFeature(HostVO hos host.getPodId(), msg, msg); } else { msg += String.format("is %s despite the setting '%s' is enabled for the cluster %s", - isEventEnable ? "enabled" : "disabled", AgentManager.EnableKVMAutoEnableDisable.key(), + isEventEnable ? "enabled" : "disabled", AgentManager.KVMAutoEnableDisable.key(), host.getClusterId()); if (StringUtils.isNotBlank(annotation)) { msg += String.format(", reason: %s", annotation); From 544f8d5b208f44c6124148682af9027a0e33a584 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Wed, 4 Dec 2024 11:44:44 -0500 Subject: [PATCH 2/9] Update name and UI dialog box --- .../src/main/java/com/cloud/agent/AgentManager.java | 2 +- .../main/resources/META-INF/db/schema-41910to42000.sql | 2 ++ ui/src/views/infra/HostEnableDisable.vue | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java index 0e1a4a829677..45a9cd5d613b 100644 --- a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java +++ b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java @@ -40,7 +40,7 @@ public interface AgentManager { static final ConfigKey Wait = new ConfigKey("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return", true); ConfigKey KVMAutoEnableDisable = new ConfigKey<>(Boolean.class, - "enable.kvm.host.auto.enable", + "kvm.host.auto.enable.disable", "Advanced", "false", "(KVM only) Enable Auto Disable/Enable KVM hosts in the cluster " + diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql b/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql index c36b71c2f250..3a8b40ee685d 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql @@ -425,3 +425,5 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervi CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_instance', 'delete_protection', 'boolean DEFAULT FALSE COMMENT "delete protection for vm" '); CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'delete_protection', 'boolean DEFAULT FALSE COMMENT "delete protection for volumes" '); + +UPDATE `cloud`.`configuration` set name = "kvm.host.auto.enable.disable" where name = "enable.kvm.host.auto.enable.disable"; diff --git a/ui/src/views/infra/HostEnableDisable.vue b/ui/src/views/infra/HostEnableDisable.vue index bc71aa270809..2ed0b6f43b92 100644 --- a/ui/src/views/infra/HostEnableDisable.vue +++ b/ui/src/views/infra/HostEnableDisable.vue @@ -31,7 +31,7 @@ -
+
{ - if (json.listconfigurationsresponse.configuration[0]) { - this.enableKVMAutoEnableDisableSetting = json.listconfigurationsresponse.configuration[0].value + api('listConfigurations', { name: 'kvm.host.auto.enable.disable', clusterid: this.resource.clusterid }).then(json => { + if (json.listconfigurationsresponse.configuration?.[0]) { + this.kvmAutoEnableDisableSetting = json?.listconfigurationsresponse?.configuration?.[0]?.value || false } }) }, From c9a9c4b2c78448852b73fd2e38329e14fc721a8c Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Wed, 12 Feb 2025 10:38:16 -0500 Subject: [PATCH 3/9] address comments --- .../src/main/resources/META-INF/db/schema-41910to42000.sql | 2 -- .../src/main/resources/META-INF/db/schema-42000to42010.sql | 2 ++ ui/src/views/infra/HostEnableDisable.vue | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql b/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql index 3a8b40ee685d..c36b71c2f250 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41910to42000.sql @@ -425,5 +425,3 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervi CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_instance', 'delete_protection', 'boolean DEFAULT FALSE COMMENT "delete protection for vm" '); CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'delete_protection', 'boolean DEFAULT FALSE COMMENT "delete protection for volumes" '); - -UPDATE `cloud`.`configuration` set name = "kvm.host.auto.enable.disable" where name = "enable.kvm.host.auto.enable.disable"; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql b/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql index aef99dd0c7f6..8328d4dc57f2 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql @@ -32,3 +32,5 @@ CALL `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`('cloud.mshost_peer', 'fk_mshost_peer__ -- Add last_id to the volumes table CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'last_id', 'bigint(20) unsigned DEFAULT NULL'); + +UPDATE `cloud`.`configuration` set name = "kvm.host.auto.enable.disable" where name = "enable.kvm.host.auto.enable.disable"; diff --git a/ui/src/views/infra/HostEnableDisable.vue b/ui/src/views/infra/HostEnableDisable.vue index 2ed0b6f43b92..2973f94d618b 100644 --- a/ui/src/views/infra/HostEnableDisable.vue +++ b/ui/src/views/infra/HostEnableDisable.vue @@ -28,7 +28,7 @@ >
@@ -36,7 +36,7 @@ class="form__item" name="reason" ref="reason" - :label="'The setting \'enable.kvm.host.auto.enable.disable\' is enabled, ' + + :label="'The setting \'kvm.host.auto.enable.disable\' is enabled, ' + ' can specify a reason for ' + (resourcestate === 'Enabled' ? 'disabling' : 'enabling') + ' this host'"> Date: Wed, 12 Feb 2025 20:46:03 -0500 Subject: [PATCH 4/9] Do not rename the setting --- .../src/main/java/com/cloud/agent/AgentManager.java | 4 ++-- .../com/cloud/agent/manager/AgentManagerImpl.java | 6 +++--- .../resources/META-INF/db/schema-42000to42010.sql | 2 -- .../java/com/cloud/resource/ResourceManagerImpl.java | 12 ++++++------ ui/src/views/infra/HostEnableDisable.vue | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java index c817fb99e698..81525ca13f1b 100644 --- a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java +++ b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java @@ -39,8 +39,8 @@ public interface AgentManager { static final ConfigKey Wait = new ConfigKey("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return", true); - ConfigKey KVMAutoEnableDisable = new ConfigKey<>(Boolean.class, - "kvm.host.auto.enable.disable", + ConfigKey EnableKVMAutoEnableDisable = new ConfigKey<>(Boolean.class, + "enable.kvm.host.auto.enable.disable", "Advanced", "false", "(KVM only) Enable Auto Disable/Enable KVM hosts in the cluster " + diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java index 00c22463facf..df1ba55c713b 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java @@ -1398,9 +1398,9 @@ private void processHostHealthCheckResult(Boolean hostHealthCheckResult, long ho return; } - if (!BooleanUtils.toBoolean(KVMAutoEnableDisable.valueIn(host.getClusterId()))) { + if (!BooleanUtils.toBoolean(EnableKVMAutoEnableDisable.valueIn(host.getClusterId()))) { logger.debug("{} is disabled for the cluster {}, cannot process the health check result " + - "received for the host %s", KVMAutoEnableDisable.key(), host.getClusterId(), host.getName()); + "received for the host %s", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host.getName()); return; } @@ -1958,7 +1958,7 @@ public String getConfigComponentName() { @Override public ConfigKey[] getConfigKeys() { return new ConfigKey[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize, - DirectAgentPoolSize, DirectAgentThreadCap, KVMAutoEnableDisable, ReadyCommandWait, + DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait, GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections }; } diff --git a/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql b/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql index 097f859aa3b4..bf13e5eee1ac 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql @@ -42,8 +42,6 @@ CALL `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`('cloud.mshost_peer', 'fk_mshost_peer__ -- Add last_id to the volumes table CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'last_id', 'bigint(20) unsigned DEFAULT NULL'); -UPDATE `cloud`.`configuration` set name = "kvm.host.auto.enable.disable" where name = "enable.kvm.host.auto.enable.disable"; - -- Add used_iops column to support IOPS data in storage stats CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.storage_pool', 'used_iops', 'bigint unsigned DEFAULT NULL COMMENT "IOPS currently in use for this storage pool" '); diff --git a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java index 2fac92113e01..e34be7507a2f 100755 --- a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java @@ -1840,9 +1840,9 @@ private void handleAutoEnableDisableKVMHost(boolean autoEnableDisableKVMSetting, _hostDetailsDao.update(hostDetail.getId(), hostDetail); } else if (!isUpdateFromHostHealthCheck && hostDetail != null && Boolean.parseBoolean(hostDetail.getValue()) && resourceEvent == ResourceState.Event.Disable) { - logger.info(String.format("The setting %s is enabled but the host %s is manually set into %s state," + + logger.info("The setting {} is enabled but the host {} is manually set into {} state," + "ignoring future auto enabling of the host based on health check results", - AgentManager.KVMAutoEnableDisable.key(), host.getName(), resourceEvent)); + AgentManager.EnableKVMAutoEnableDisable.key(), host.getName(), resourceEvent); hostDetail.setValue(Boolean.FALSE.toString()); _hostDetailsDao.update(hostDetail.getId(), hostDetail); } else if (hostDetail == null) { @@ -1854,7 +1854,7 @@ private void handleAutoEnableDisableKVMHost(boolean autoEnableDisableKVMSetting, } private boolean updateHostAllocationState(HostVO host, String allocationState, boolean isUpdateFromHostHealthCheck) throws NoTransitionException { - boolean autoEnableDisableKVMSetting = AgentManager.KVMAutoEnableDisable.valueIn(host.getClusterId()) && + boolean autoEnableDisableKVMSetting = AgentManager.EnableKVMAutoEnableDisable.valueIn(host.getClusterId()) && host.getHypervisorType() == HypervisorType.KVM; ResourceState.Event resourceEvent = getResourceEventFromAllocationStateString(allocationState); DetailVO hostDetail = _hostDetailsDao.findDetail(host.getId(), ApiConstants.AUTO_ENABLE_KVM_HOST); @@ -1868,7 +1868,7 @@ private boolean updateHostAllocationState(HostVO host, String allocationState, if (isAutoEnableAttemptForADisabledHost(autoEnableDisableKVMSetting, isUpdateFromHostHealthCheck, hostDetail, resourceEvent)) { logger.debug(String.format("The setting '%s' is enabled and the health check succeeds on the host, " + "but the host has been manually disabled previously, ignoring auto enabling", - AgentManager.KVMAutoEnableDisable.key())); + AgentManager.EnableKVMAutoEnableDisable.key())); return false; } @@ -1982,7 +1982,7 @@ private void sendAlertAndAnnotationForAutoEnableDisableKVMHostFeature(HostVO hos boolean isUpdateFromHostHealthCheck, boolean isUpdateHostAllocation, String annotation) { boolean isAutoEnableDisableKVMSettingEnabled = host.getHypervisorType() == HypervisorType.KVM && - AgentManager.KVMAutoEnableDisable.valueIn(host.getClusterId()); + AgentManager.EnableKVMAutoEnableDisable.valueIn(host.getClusterId()); if (!isAutoEnableDisableKVMSettingEnabled) { if (StringUtils.isNotBlank(annotation)) { annotationService.addAnnotation(annotation, AnnotationService.EntityType.HOST, host.getUuid(), true); @@ -2006,7 +2006,7 @@ private void sendAlertAndAnnotationForAutoEnableDisableKVMHostFeature(HostVO hos host.getPodId(), msg, msg); } else { msg += String.format("is %s despite the setting '%s' is enabled for the cluster %s", - isEventEnable ? "enabled" : "disabled", AgentManager.KVMAutoEnableDisable.key(), + isEventEnable ? "enabled" : "disabled", AgentManager.EnableKVMAutoEnableDisable.key(), host.getClusterId()); if (StringUtils.isNotBlank(annotation)) { msg += String.format(", reason: %s", annotation); diff --git a/ui/src/views/infra/HostEnableDisable.vue b/ui/src/views/infra/HostEnableDisable.vue index 2973f94d618b..1d9839243d8f 100644 --- a/ui/src/views/infra/HostEnableDisable.vue +++ b/ui/src/views/infra/HostEnableDisable.vue @@ -36,7 +36,7 @@ class="form__item" name="reason" ref="reason" - :label="'The setting \'kvm.host.auto.enable.disable\' is enabled, ' + + :label="'The Auto Enable/Disable KVM Hosts functionality is enabled, ' + ' can specify a reason for ' + (resourcestate === 'Enabled' ? 'disabling' : 'enabling') + ' this host'"> Date: Thu, 13 Feb 2025 06:30:44 -0500 Subject: [PATCH 5/9] rever gs name change --- ui/src/views/infra/HostEnableDisable.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/views/infra/HostEnableDisable.vue b/ui/src/views/infra/HostEnableDisable.vue index 1d9839243d8f..84310a0051fd 100644 --- a/ui/src/views/infra/HostEnableDisable.vue +++ b/ui/src/views/infra/HostEnableDisable.vue @@ -90,7 +90,7 @@ export default { if (this.resource.hypervisor !== 'KVM') { return } - api('listConfigurations', { name: 'kvm.host.auto.enable.disable', clusterid: this.resource.clusterid }).then(json => { + api('listConfigurations', { name: 'enable.kvm.host.auto.enable.disable', clusterid: this.resource.clusterid }).then(json => { if (json.listconfigurationsresponse.configuration?.[0]) { this.kvmAutoEnableDisableSetting = json?.listconfigurationsresponse?.configuration?.[0]?.value || false } From 62825489e77561a7e03d0e79379bd40c91e30236 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Thu, 13 Feb 2025 06:34:22 -0500 Subject: [PATCH 6/9] debug log --- .../src/main/java/com/cloud/agent/manager/AgentManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java index df1ba55c713b..da61f181e843 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java @@ -1400,7 +1400,7 @@ private void processHostHealthCheckResult(Boolean hostHealthCheckResult, long ho if (!BooleanUtils.toBoolean(EnableKVMAutoEnableDisable.valueIn(host.getClusterId()))) { logger.debug("{} is disabled for the cluster {}, cannot process the health check result " + - "received for the host %s", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host.getName()); + "received for the host {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host.getName()); return; } From 155665a474692116379719927299008fdb959319 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Thu, 13 Feb 2025 06:44:10 -0500 Subject: [PATCH 7/9] revert newline --- .../src/main/java/com/cloud/agent/manager/AgentManagerImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java index da61f181e843..e7f0ec16b611 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java @@ -1397,7 +1397,6 @@ private void processHostHealthCheckResult(Boolean hostHealthCheckResult, long ho logger.error("Unable to find host with ID: {}", hostId); return; } - if (!BooleanUtils.toBoolean(EnableKVMAutoEnableDisable.valueIn(host.getClusterId()))) { logger.debug("{} is disabled for the cluster {}, cannot process the health check result " + "received for the host {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host.getName()); From 04e5a4413d92aa262513c6ce88ff8f3bac323344 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Thu, 13 Feb 2025 08:17:33 -0500 Subject: [PATCH 8/9] change log statements --- .../main/java/com/cloud/agent/manager/AgentManagerImpl.java | 2 +- .../src/main/java/com/cloud/resource/ResourceManagerImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java index e7f0ec16b611..9c14dfd07bdb 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java @@ -1399,7 +1399,7 @@ private void processHostHealthCheckResult(Boolean hostHealthCheckResult, long ho } if (!BooleanUtils.toBoolean(EnableKVMAutoEnableDisable.valueIn(host.getClusterId()))) { logger.debug("{} is disabled for the cluster {}, cannot process the health check result " + - "received for the host {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host.getName()); + "received for the {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host); return; } diff --git a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java index e34be7507a2f..5f870cc9a3bf 100755 --- a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java @@ -1840,9 +1840,9 @@ private void handleAutoEnableDisableKVMHost(boolean autoEnableDisableKVMSetting, _hostDetailsDao.update(hostDetail.getId(), hostDetail); } else if (!isUpdateFromHostHealthCheck && hostDetail != null && Boolean.parseBoolean(hostDetail.getValue()) && resourceEvent == ResourceState.Event.Disable) { - logger.info("The setting {} is enabled but the host {} is manually set into {} state," + + logger.info("The setting {} is enabled but the {} is manually set into {} state," + "ignoring future auto enabling of the host based on health check results", - AgentManager.EnableKVMAutoEnableDisable.key(), host.getName(), resourceEvent); + AgentManager.EnableKVMAutoEnableDisable.key(), host, resourceEvent); hostDetail.setValue(Boolean.FALSE.toString()); _hostDetailsDao.update(hostDetail.getId(), hostDetail); } else if (hostDetail == null) { From d2b2419a54cf2e4d896a6c7b496789fa244b73ce Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Tue, 18 Feb 2025 09:30:30 -0500 Subject: [PATCH 9/9] modify logs --- .../src/main/java/com/cloud/agent/manager/AgentManagerImpl.java | 2 +- .../src/main/java/com/cloud/resource/ResourceManagerImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java index 9c14dfd07bdb..592d45678057 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java @@ -1399,7 +1399,7 @@ private void processHostHealthCheckResult(Boolean hostHealthCheckResult, long ho } if (!BooleanUtils.toBoolean(EnableKVMAutoEnableDisable.valueIn(host.getClusterId()))) { logger.debug("{} is disabled for the cluster {}, cannot process the health check result " + - "received for the {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host); + "received for {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host); return; } diff --git a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java index 5f870cc9a3bf..7428475231d9 100755 --- a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java @@ -1840,7 +1840,7 @@ private void handleAutoEnableDisableKVMHost(boolean autoEnableDisableKVMSetting, _hostDetailsDao.update(hostDetail.getId(), hostDetail); } else if (!isUpdateFromHostHealthCheck && hostDetail != null && Boolean.parseBoolean(hostDetail.getValue()) && resourceEvent == ResourceState.Event.Disable) { - logger.info("The setting {} is enabled but the {} is manually set into {} state," + + logger.info("The setting {} is enabled but {} is manually set into {} state," + "ignoring future auto enabling of the host based on health check results", AgentManager.EnableKVMAutoEnableDisable.key(), host, resourceEvent); hostDetail.setValue(Boolean.FALSE.toString());