mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
plugin/shutdown: use mgmt server uuid in the shutdown response (#10717)
This commit is contained in:
parent
8c9216d11b
commit
29e58e906f
@ -38,10 +38,10 @@ public class ReadyForShutdownResponse extends BaseResponse {
|
|||||||
|
|
||||||
@SerializedName(ApiConstants.MANAGEMENT_SERVER_ID)
|
@SerializedName(ApiConstants.MANAGEMENT_SERVER_ID)
|
||||||
@Param(description = "The id of the management server")
|
@Param(description = "The id of the management server")
|
||||||
private Long msId;
|
private String msUuid;
|
||||||
|
|
||||||
public ReadyForShutdownResponse(Long msId, Boolean shutdownTriggered, Boolean readyForShutdown, long pendingJobsCount) {
|
public ReadyForShutdownResponse(String msUuid, Boolean shutdownTriggered, Boolean readyForShutdown, long pendingJobsCount) {
|
||||||
this.msId = msId;
|
this.msUuid = msUuid;
|
||||||
this.shutdownTriggered = shutdownTriggered;
|
this.shutdownTriggered = shutdownTriggered;
|
||||||
this.readyForShutdown = readyForShutdown;
|
this.readyForShutdown = readyForShutdown;
|
||||||
this.pendingJobsCount = pendingJobsCount;
|
this.pendingJobsCount = pendingJobsCount;
|
||||||
@ -70,12 +70,4 @@ public class ReadyForShutdownResponse extends BaseResponse {
|
|||||||
public void setPendingJobsCount(Long pendingJobsCount) {
|
public void setPendingJobsCount(Long pendingJobsCount) {
|
||||||
this.pendingJobsCount = pendingJobsCount;
|
this.pendingJobsCount = pendingJobsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getMsId() {
|
|
||||||
return msId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsId(Long msId) {
|
|
||||||
this.msId = msId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,6 +137,7 @@ public class ShutdownManagerImpl extends ManagerBase implements ShutdownManager,
|
|||||||
public ReadyForShutdownResponse readyForShutdown(Long managementserverid) {
|
public ReadyForShutdownResponse readyForShutdown(Long managementserverid) {
|
||||||
Long[] msIds = null;
|
Long[] msIds = null;
|
||||||
boolean shutdownTriggeredAnywhere = false;
|
boolean shutdownTriggeredAnywhere = false;
|
||||||
|
String msUuid = null;
|
||||||
State[] shutdownTriggeredStates = {State.ShuttingDown, State.PreparingToShutDown, State.ReadyToShutDown};
|
State[] shutdownTriggeredStates = {State.ShuttingDown, State.PreparingToShutDown, State.ReadyToShutDown};
|
||||||
if (managementserverid == null) {
|
if (managementserverid == null) {
|
||||||
List<ManagementServerHostVO> msHosts = msHostDao.listBy(shutdownTriggeredStates);
|
List<ManagementServerHostVO> msHosts = msHostDao.listBy(shutdownTriggeredStates);
|
||||||
@ -149,11 +150,12 @@ public class ShutdownManagerImpl extends ManagerBase implements ShutdownManager,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ManagementServerHostVO msHost = msHostDao.findById(managementserverid);
|
ManagementServerHostVO msHost = msHostDao.findById(managementserverid);
|
||||||
|
msUuid = msHost.getUuid();
|
||||||
msIds = new Long[]{msHost.getMsid()};
|
msIds = new Long[]{msHost.getMsid()};
|
||||||
shutdownTriggeredAnywhere = Arrays.asList(shutdownTriggeredStates).contains(msHost.getState());
|
shutdownTriggeredAnywhere = Arrays.asList(shutdownTriggeredStates).contains(msHost.getState());
|
||||||
}
|
}
|
||||||
long pendingJobCount = countPendingJobs(msIds);
|
long pendingJobCount = countPendingJobs(msIds);
|
||||||
return new ReadyForShutdownResponse(managementserverid, shutdownTriggeredAnywhere, pendingJobCount == 0, pendingJobCount);
|
return new ReadyForShutdownResponse(msUuid, shutdownTriggeredAnywhere, pendingJobCount == 0, pendingJobCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user