weizhouapache commented on a change in pull request #3491: KVM: Propagating
changes on host parameters to the agents
URL: https://github.com/apache/cloudstack/pull/3491#discussion_r381521271
##########
File path:
engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
##########
@@ -1788,4 +1788,45 @@ public int getTimeout() {
}
+ protected Map<Long, List<Long>> getHostsPerZone() {
+ List<HostVO> allHosts =
_resourceMgr.listAllHostsInAllZonesByType(Host.Type.Routing);
+ if (allHosts == null) {
+ return null;
+ }
+ Map<Long, List<Long>> hostsByZone = new HashMap<Long, List<Long>>();
+ for (HostVO host : allHosts) {
+ if (host.getHypervisorType() == HypervisorType.KVM ||
host.getHypervisorType() == HypervisorType.LXC) {
+ Long zoneId = host.getDataCenterId();
+ List<Long> hostIds = hostsByZone.get(zoneId);
+ if (hostIds == null) {
+ hostIds = new ArrayList<Long>();
+ }
+ hostIds.add(host.getId());
+ hostsByZone.put(zoneId, hostIds);
+ }
+ }
+ return hostsByZone;
+ }
+
+ private void sendCommandToAgents(Map<Long, List<Long>> hostsPerZone,
Map<String, String> params) {
+ SetHostParamsCommand cmds = new SetHostParamsCommand(params);
+ for (Long zoneId : hostsPerZone.keySet()) {
+ List<Long> hostIds = hostsPerZone.get(zoneId);
+ for (Long hostId : hostIds) {
+ Answer answer = easySend(hostId, cmds);
+ if (answer == null || !answer.getResult()) {
+ s_logger.error("Error sending parameters to agent " +
hostId);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void propagateChangeToAgents() {
+ s_logger.debug("Propagating changes on host parameters to the agents");
+ Map<Long, List<Long>> hostsPerZone = getHostsPerZone();
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("router.aggregation.command.each.timeout",
_configDao.getValue("router.aggregation.command.each.timeout"));
Review comment:
@nvazquez it is absolutely good.
I will create another PR. this PR has already been merged into 4.13 and 4.14
...
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services