Merge release branch 4.19 to 4.20

* 4.19:
  plugin/shutdown: use mgmt server uuid in the shutdown response (#10717)
This commit is contained in:
Daan Hoogland 2025-04-18 11:54:03 +02:00
commit 2771586b87
2 changed files with 6 additions and 12 deletions

View File

@ -38,10 +38,10 @@ public class ReadyForShutdownResponse extends BaseResponse {
@SerializedName(ApiConstants.MANAGEMENT_SERVER_ID)
@Param(description = "The id of the management server")
private Long msId;
private String msUuid;
public ReadyForShutdownResponse(Long msId, Boolean shutdownTriggered, Boolean readyForShutdown, long pendingJobsCount) {
this.msId = msId;
public ReadyForShutdownResponse(String msUuid, Boolean shutdownTriggered, Boolean readyForShutdown, long pendingJobsCount) {
this.msUuid = msUuid;
this.shutdownTriggered = shutdownTriggered;
this.readyForShutdown = readyForShutdown;
this.pendingJobsCount = pendingJobsCount;
@ -70,12 +70,4 @@ public class ReadyForShutdownResponse extends BaseResponse {
public void setPendingJobsCount(Long pendingJobsCount) {
this.pendingJobsCount = pendingJobsCount;
}
public Long getMsId() {
return msId;
}
public void setMsId(Long msId) {
this.msId = msId;
}
}

View File

@ -134,6 +134,7 @@ public class ShutdownManagerImpl extends ManagerBase implements ShutdownManager,
public ReadyForShutdownResponse readyForShutdown(Long managementserverid) {
Long[] msIds = null;
boolean shutdownTriggeredAnywhere = false;
String msUuid = null;
State[] shutdownTriggeredStates = {State.ShuttingDown, State.PreparingToShutDown, State.ReadyToShutDown};
if (managementserverid == null) {
List<ManagementServerHostVO> msHosts = msHostDao.listBy(shutdownTriggeredStates);
@ -146,11 +147,12 @@ public class ShutdownManagerImpl extends ManagerBase implements ShutdownManager,
}
} else {
ManagementServerHostVO msHost = msHostDao.findById(managementserverid);
msUuid = msHost.getUuid();
msIds = new Long[]{msHost.getMsid()};
shutdownTriggeredAnywhere = Arrays.asList(shutdownTriggeredStates).contains(msHost.getState());
}
long pendingJobCount = countPendingJobs(msIds);
return new ReadyForShutdownResponse(managementserverid, shutdownTriggeredAnywhere, pendingJobCount == 0, pendingJobCount);
return new ReadyForShutdownResponse(msUuid, shutdownTriggeredAnywhere, pendingJobCount == 0, pendingJobCount);
}
@Override