Skip to content

Commit 835a5ab

Browse files
code improvements, cleanup
1 parent 30e4796 commit 835a5ab

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/PatchSystemVMCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class PatchSystemVMCmd extends BaseAsyncCmd {
4646
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN,
4747
description = "If true, initiates copy of scripts and restart of the agent, even if the scripts version matches." +
4848
"To be used with ID parameter only")
49-
private Boolean force;
49+
private Boolean forced;
5050

5151
/////////////////////////////////////////////////////
5252
/////////////////// Accessors ///////////////////////
@@ -58,7 +58,7 @@ public Long getId() {
5858
}
5959

6060
public boolean isForced() {
61-
return force != null && force;
61+
return forced != null && forced;
6262
}
6363

6464
/////////////////////////////////////////////////////

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,8 @@ public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long
14561456

14571457
private List<HostVO> getDirectAgentHosts(long msId, boolean excludeHostsInMaintenance) {
14581458
List<HostVO> directAgentHosts = new ArrayList<>();
1459-
List<HostVO> hosts = _hostDao.listHostsByMsResourceState(msId, null);
1459+
List<ResourceState> statesToExclude = excludeHostsInMaintenance ? ResourceState.s_maintenanceStates : List.of();
1460+
List<HostVO> hosts = _hostDao.listHostsByMsResourceState(msId, statesToExclude);
14601461
for (HostVO host : hosts) {
14611462
AgentAttache agent = findAttache(host.getId());
14621463
if (agent instanceof DirectAgentAttache) {

plugins/maintenance/src/main/java/org/apache/cloudstack/api/command/CancelMaintenanceCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class CancelMaintenanceCmd extends BaseMSMaintenanceActionCmd {
3939

4040
public static final String APINAME = "cancelMaintenance";
4141

42-
@Parameter(name = ApiConstants.REBALANCE, type = CommandType.BOOLEAN, description = "Rebalance agents (applicable for indirect agents) after cancelling maintenance, default is true")
42+
@Parameter(name = ApiConstants.REBALANCE, type = CommandType.BOOLEAN, description = "Rebalance agents (applicable for indirect agents, ensure the settings 'host' and 'indirect.agent.lb.algorithm' are properly configured) after cancelling maintenance, default is true")
4343
private Boolean rebalance;
4444

4545
public boolean getRebalance() {

plugins/maintenance/src/main/java/org/apache/cloudstack/maintenance/ManagementServerMaintenanceManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ public ManagementServerMaintenanceResponse cancelMaintenance(CancelMaintenanceCm
461461
}
462462

463463
final Command[] cmds = new Command[1];
464-
cmds[0] = new CancelMaintenanceManagementServerHostCommand(msHost.getMsid(), cmd.getRebalance());
464+
cmds[0] = new CancelMaintenanceManagementServerHostCommand(msHost.getMsid());
465465
executeCmd(msHost, cmds);
466466

467467
msHostDao.updateState(msHost.getId(), State.Up);

plugins/maintenance/src/main/java/org/apache/cloudstack/maintenance/command/CancelMaintenanceManagementServerHostCommand.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,8 @@
1919
package org.apache.cloudstack.maintenance.command;
2020

2121
public class CancelMaintenanceManagementServerHostCommand extends BaseShutdownManagementServerHostCommand {
22-
boolean rebalance;
2322

2423
public CancelMaintenanceManagementServerHostCommand(long msId) {
2524
super(msId);
2625
}
27-
28-
public CancelMaintenanceManagementServerHostCommand(long msId, boolean rebalance) {
29-
super(msId);
30-
this.rebalance = rebalance;
31-
}
32-
33-
public boolean getRebalance() {
34-
return rebalance;
35-
}
3626
}

server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ public void propagateMSListToAgentsInCluster(Long clusterId) {
360360
return;
361361
}
362362

363-
logger.debug("Propagating management server list to the agents in cluster " + clusterId);
363+
logger.debug("Propagating management server list update to the agents in cluster " + clusterId);
364364
ClusterVO cluster = clusterDao.findById(clusterId);
365365
if (cluster == null) {
366366
logger.warn("Unable to propagate management server list, couldn't find cluster " + clusterId);

0 commit comments

Comments
 (0)