sureshanaparti commented on code in PR #6809:
URL: https://github.com/apache/cloudstack/pull/6809#discussion_r1650092593
##########
engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java:
##########
@@ -1883,25 +1894,121 @@ protected Map<Long, List<Long>> getHostsPerZone() {
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);
+ private void sendCommandToAgents(Map<Long, List<Long>> hostsPerZone,
LongFunction<Map<String, String>> paramsGenerator ) {
+ for (List<Long> hostIds : hostsPerZone.values()) {
for (Long hostId : hostIds) {
- Answer answer = easySend(hostId, cmds);
+ Answer answer = easySend(hostId, new
SetHostParamsCommand(paramsGenerator.apply(hostId)));
if (answer == null || !answer.getResult()) {
logger.error("Error sending parameters to agent {}",
hostId);
}
}
}
}
+ private long calculateAvailableMemoryOfHost(HostVO host){
Review Comment:
```suggestion
private long calculateAvailableMemoryOfHost(HostVO host) {
```
##########
engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java:
##########
@@ -1883,25 +1894,121 @@ protected Map<Long, List<Long>> getHostsPerZone() {
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);
+ private void sendCommandToAgents(Map<Long, List<Long>> hostsPerZone,
LongFunction<Map<String, String>> paramsGenerator ) {
+ for (List<Long> hostIds : hostsPerZone.values()) {
for (Long hostId : hostIds) {
- Answer answer = easySend(hostId, cmds);
+ Answer answer = easySend(hostId, new
SetHostParamsCommand(paramsGenerator.apply(hostId)));
if (answer == null || !answer.getResult()) {
logger.error("Error sending parameters to agent {}",
hostId);
}
}
}
}
+ private long calculateAvailableMemoryOfHost(HostVO host){
+ long reservedMemory =
ByteScaleUtils.mebibytesToBytes(ConfigurationManagerImpl.HOST_RESERVED_MEM_MB.valueIn(host.getClusterId()));
+ return host.getTotalMemory() + host.getDom0MinMemory() -
reservedMemory;
+ }
+
+ private void updateMemoriesInDb(HostVO host, long newMemoryValue){
Review Comment:
```suggestion
private void updateMemoriesInDb(HostVO host, long newMemoryValue) {
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]