Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

@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;

Check warning on line 44 in plugins/shutdown/src/main/java/org/apache/cloudstack/api/response/ReadyForShutdownResponse.java

View check run for this annotation

Codecov / codecov/patch

plugins/shutdown/src/main/java/org/apache/cloudstack/api/response/ReadyForShutdownResponse.java#L43-L44

Added lines #L43 - L44 were not covered by tests
this.shutdownTriggered = shutdownTriggered;
this.readyForShutdown = readyForShutdown;
this.pendingJobsCount = pendingJobsCount;
Expand Down Expand Up @@ -70,12 +70,4 @@
public void setPendingJobsCount(Long pendingJobsCount) {
this.pendingJobsCount = pendingJobsCount;
}

public Long getMsId() {
return msId;
}

public void setMsId(Long msId) {
this.msId = msId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
public ReadyForShutdownResponse readyForShutdown(Long managementserverid) {
Long[] msIds = null;
boolean shutdownTriggeredAnywhere = false;
String msUuid = null;

Check warning on line 140 in plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java#L140

Added line #L140 was not covered by tests
State[] shutdownTriggeredStates = {State.ShuttingDown, State.PreparingToShutDown, State.ReadyToShutDown};
if (managementserverid == null) {
List<ManagementServerHostVO> msHosts = msHostDao.listBy(shutdownTriggeredStates);
Expand All @@ -149,11 +150,12 @@
}
} else {
ManagementServerHostVO msHost = msHostDao.findById(managementserverid);
msUuid = msHost.getUuid();

Check warning on line 153 in plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java#L153

Added line #L153 was not covered by tests
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
Expand Down