Skip to content

Commit 425fc95

Browse files
committed
Rename ambiguous global setting: enable.kvm.host.auto.enable.disable
1 parent 0eb94a1 commit 425fc95

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

engine/components-api/src/main/java/com/cloud/agent/AgentManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
public interface AgentManager {
4040
static final ConfigKey<Integer> Wait = new ConfigKey<Integer>("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return",
4141
true);
42-
ConfigKey<Boolean> EnableKVMAutoEnableDisable = new ConfigKey<>(Boolean.class,
43-
"enable.kvm.host.auto.enable.disable",
42+
ConfigKey<Boolean> KVMAutoEnableDisable = new ConfigKey<>(Boolean.class,
43+
"enable.kvm.host.auto.enable",
4444
"Advanced",
4545
"false",
4646
"(KVM only) Enable Auto Disable/Enable KVM hosts in the cluster " +

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,9 +1268,9 @@ private void processHostHealthCheckResult(Boolean hostHealthCheckResult, long ho
12681268
logger.error("Unable to find host with ID: {}", hostId);
12691269
return;
12701270
}
1271-
if (!BooleanUtils.toBoolean(EnableKVMAutoEnableDisable.valueIn(host.getClusterId()))) {
1272-
logger.debug("{} is disabled for the cluster {}, cannot process the health check result " +
1273-
"received for the host {}", EnableKVMAutoEnableDisable.key(), host.getClusterId(), host.getName());
1271+
if (!BooleanUtils.toBoolean(KVMAutoEnableDisable.valueIn(host.getClusterId()))) {
1272+
logger.debug(String.format("%s is disabled for the cluster %s, cannot process the health check result " +
1273+
"received for the host %s", KVMAutoEnableDisable.key(), host.getClusterId(), host.getName()));
12741274
return;
12751275
}
12761276

@@ -1802,7 +1802,7 @@ public String getConfigComponentName() {
18021802
@Override
18031803
public ConfigKey<?>[] getConfigKeys() {
18041804
return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize,
1805-
DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait };
1805+
DirectAgentPoolSize, DirectAgentThreadCap, KVMAutoEnableDisable, ReadyCommandWait };
18061806
}
18071807

18081808
protected class SetHostParamsListener implements Listener {

server/src/main/java/com/cloud/resource/ResourceManagerImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,7 @@ private void handleAutoEnableDisableKVMHost(boolean autoEnableDisableKVMSetting,
18411841
Boolean.parseBoolean(hostDetail.getValue()) && resourceEvent == ResourceState.Event.Disable) {
18421842
logger.info(String.format("The setting %s is enabled but the host %s is manually set into %s state," +
18431843
"ignoring future auto enabling of the host based on health check results",
1844-
AgentManager.EnableKVMAutoEnableDisable.key(), host.getName(), resourceEvent));
1844+
AgentManager.KVMAutoEnableDisable.key(), host.getName(), resourceEvent));
18451845
hostDetail.setValue(Boolean.FALSE.toString());
18461846
_hostDetailsDao.update(hostDetail.getId(), hostDetail);
18471847
} else if (hostDetail == null) {
@@ -1853,7 +1853,7 @@ private void handleAutoEnableDisableKVMHost(boolean autoEnableDisableKVMSetting,
18531853
}
18541854
private boolean updateHostAllocationState(HostVO host, String allocationState,
18551855
boolean isUpdateFromHostHealthCheck) throws NoTransitionException {
1856-
boolean autoEnableDisableKVMSetting = AgentManager.EnableKVMAutoEnableDisable.valueIn(host.getClusterId()) &&
1856+
boolean autoEnableDisableKVMSetting = AgentManager.KVMAutoEnableDisable.valueIn(host.getClusterId()) &&
18571857
host.getHypervisorType() == HypervisorType.KVM;
18581858
ResourceState.Event resourceEvent = getResourceEventFromAllocationStateString(allocationState);
18591859
DetailVO hostDetail = _hostDetailsDao.findDetail(host.getId(), ApiConstants.AUTO_ENABLE_KVM_HOST);
@@ -1867,7 +1867,7 @@ private boolean updateHostAllocationState(HostVO host, String allocationState,
18671867
if (isAutoEnableAttemptForADisabledHost(autoEnableDisableKVMSetting, isUpdateFromHostHealthCheck, hostDetail, resourceEvent)) {
18681868
logger.debug(String.format("The setting '%s' is enabled and the health check succeeds on the host, " +
18691869
"but the host has been manually disabled previously, ignoring auto enabling",
1870-
AgentManager.EnableKVMAutoEnableDisable.key()));
1870+
AgentManager.KVMAutoEnableDisable.key()));
18711871
return false;
18721872
}
18731873

@@ -1981,7 +1981,7 @@ private void sendAlertAndAnnotationForAutoEnableDisableKVMHostFeature(HostVO hos
19811981
boolean isUpdateFromHostHealthCheck,
19821982
boolean isUpdateHostAllocation, String annotation) {
19831983
boolean isAutoEnableDisableKVMSettingEnabled = host.getHypervisorType() == HypervisorType.KVM &&
1984-
AgentManager.EnableKVMAutoEnableDisable.valueIn(host.getClusterId());
1984+
AgentManager.KVMAutoEnableDisable.valueIn(host.getClusterId());
19851985
if (!isAutoEnableDisableKVMSettingEnabled) {
19861986
if (StringUtils.isNotBlank(annotation)) {
19871987
annotationService.addAnnotation(annotation, AnnotationService.EntityType.HOST, host.getUuid(), true);
@@ -2005,7 +2005,7 @@ private void sendAlertAndAnnotationForAutoEnableDisableKVMHostFeature(HostVO hos
20052005
host.getPodId(), msg, msg);
20062006
} else {
20072007
msg += String.format("is %s despite the setting '%s' is enabled for the cluster %s",
2008-
isEventEnable ? "enabled" : "disabled", AgentManager.EnableKVMAutoEnableDisable.key(),
2008+
isEventEnable ? "enabled" : "disabled", AgentManager.KVMAutoEnableDisable.key(),
20092009
host.getClusterId());
20102010
if (StringUtils.isNotBlank(annotation)) {
20112011
msg += String.format(", reason: %s", annotation);

0 commit comments

Comments
 (0)