Skip to content

Commit b4fdf22

Browse files
authored
kvm: fix/optimize propogating configs (#3911)
Make some changes based on @nvazquez 's comments in PR #3491 Fix a bug in #3491
1 parent 313e21a commit b4fdf22

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

core/src/main/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,12 @@ private Answer execute(GetDomRVersionCmd cmd) {
319319
}
320320

321321
public boolean configureHostParams(final Map<String, String> params) {
322-
if (_params.get("router.aggregation.command.each.timeout") == null) {
322+
if (_params.get("router.aggregation.command.each.timeout") != null) {
323323
String value = (String)params.get("router.aggregation.command.each.timeout");
324-
_eachTimeout = Duration.standardSeconds(NumbersUtil.parseInt(value, 10));
324+
_eachTimeout = Duration.standardSeconds(NumbersUtil.parseLong(value, 600));
325+
if (s_logger.isDebugEnabled()){
326+
s_logger.debug("The router.aggregation.command.each.timeout in seconds is set to " + _eachTimeout.getStandardSeconds());
327+
}
325328
}
326329

327330
return true;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package com.cloud.agent;
1818

19+
import java.util.Map;
20+
1921
import org.apache.cloudstack.framework.config.ConfigKey;
2022

2123
import com.cloud.agent.api.Answer;
@@ -153,5 +155,5 @@ public enum TapAgentsAction {
153155

154156
void notifyMonitorsOfRemovedHost(long hostId, long clusterId);
155157

156-
void propagateChangeToAgents();
158+
void propagateChangeToAgents(Map<String, String> params);
157159
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,11 +1822,11 @@ private void sendCommandToAgents(Map<Long, List<Long>> hostsPerZone, Map<String,
18221822
}
18231823

18241824
@Override
1825-
public void propagateChangeToAgents() {
1826-
s_logger.debug("Propagating changes on host parameters to the agents");
1827-
Map<Long, List<Long>> hostsPerZone = getHostsPerZone();
1828-
Map<String, String> params = new HashMap<String, String>();
1829-
params.put("router.aggregation.command.each.timeout", _configDao.getValue("router.aggregation.command.each.timeout"));
1830-
sendCommandToAgents(hostsPerZone, params);
1825+
public void propagateChangeToAgents(Map<String, String> params) {
1826+
if (params != null && ! params.isEmpty()) {
1827+
s_logger.debug("Propagating changes on host parameters to the agents");
1828+
Map<Long, List<Long>> hostsPerZone = getHostsPerZone();
1829+
sendCommandToAgents(hostsPerZone, params);
1830+
}
18311831
}
18321832
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,8 @@ public boolean configureHostParams(final Map<String, String> params) {
11061106
storage.configure("Storage", new HashMap<String, Object>());
11071107
if (params.get("router.aggregation.command.each.timeout") != null) {
11081108
String value = (String)params.get("router.aggregation.command.each.timeout");
1109-
Integer intValue = NumbersUtil.parseInt(value, 600);
1110-
storage.persist("router.aggregation.command.each.timeout", String.valueOf(intValue));
1109+
Long longValue = NumbersUtil.parseLong(value, 600);
1110+
storage.persist("router.aggregation.command.each.timeout", String.valueOf(longValue));
11111111
}
11121112

11131113
return true;

server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ public void onPublishMessage(String serderAddress, String subject, Object args)
483483
globalSettingUpdated.equals(IndirectAgentLBServiceImpl.IndirectAgentLBAlgorithm.key())) {
484484
_indirectAgentLB.propagateMSListToAgents();
485485
} else if (globalSettingUpdated.equals(Config.RouterAggregationCommandEachTimeout.toString())) {
486-
_agentManager.propagateChangeToAgents();
486+
Map<String, String> params = new HashMap<String, String>();
487+
params.put(Config.RouterAggregationCommandEachTimeout.toString(), _configDao.getValue(Config.RouterAggregationCommandEachTimeout.toString()));
488+
_agentManager.propagateChangeToAgents(params);
487489
}
488490
}
489491
});

0 commit comments

Comments
 (0)