Skip to content

Commit 9bb038a

Browse files
add pending jobs count to ms response
1 parent 10f46f9 commit 9bb038a

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

api/src/main/java/org/apache/cloudstack/api/response/ManagementServerResponse.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public class ManagementServerResponse extends BaseResponse {
8686
@Param(description = "the number of host agents this Management Server is responsible for", since = "4.21.0.0")
8787
private Long agentsCount;
8888

89+
@SerializedName(ApiConstants.PENDING_JOBS_COUNT)
90+
@Param(description = "the number of pending jobs in this Management Server", since = "4.21.0.0")
91+
private Long pendingJobsCount;
92+
8993
public String getId() {
9094
return this.id;
9195
}
@@ -134,6 +138,10 @@ public Long getAgentsCount() {
134138
return this.agentsCount;
135139
}
136140

141+
public Long getPendingJobsCount() {
142+
return this.pendingJobsCount;
143+
}
144+
137145
public void setId(String id) {
138146
this.id = id;
139147
}
@@ -186,6 +194,10 @@ public void setAgentsCount(Long agentsCount) {
186194
this.agentsCount = agentsCount;
187195
}
188196

197+
public void setPendingJobsCount(Long pendingJobsCount) {
198+
this.pendingJobsCount = pendingJobsCount;
199+
}
200+
189201
public String getKernelVersion() {
190202
return kernelVersion;
191203
}

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
144144
import org.apache.cloudstack.framework.config.ConfigKey;
145145
import org.apache.cloudstack.framework.config.Configurable;
146+
import org.apache.cloudstack.framework.jobs.AsyncJobManager;
146147
import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
147148
import org.apache.cloudstack.outofbandmanagement.OutOfBandManagementVO;
148149
import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao;
@@ -613,6 +614,8 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
613614
@Inject
614615
private ManagementServerHostPeerJoinDao mshostPeerJoinDao;
615616

617+
@Inject
618+
private AsyncJobManager jobManager;
616619

617620
private SearchCriteria<ServiceOfferingJoinVO> getMinimumCpuServiceOfferingJoinSearchCriteria(int cpu) {
618621
SearchCriteria<ServiceOfferingJoinVO> sc = _srvOfferingJoinDao.createSearchCriteria();
@@ -5429,6 +5432,7 @@ protected ManagementServerResponse createManagementServerResponse(ManagementServ
54295432
}
54305433
}
54315434
mgmtResponse.setAgentsCount((long) hostDao.countByMs(mgmt.getMsid()));
5435+
mgmtResponse.setPendingJobsCount(jobManager.countPendingNonPseudoJobs(mgmt.getMsid()));
54325436
mgmtResponse.setObjectName("managementserver");
54335437
return mgmtResponse;
54345438
}

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,7 @@
16831683
"label.peerstate": "Peer State",
16841684
"label.peerstate.lastupdated": "Peer State Updated Time",
16851685
"label.pending.jobs": "Pending Jobs",
1686+
"label.pendingjobscount": "Number Of pending jobs",
16861687
"label.per.account": "Per Account",
16871688
"label.per.zone": "Per zone",
16881689
"label.percentage": "Percentage",

ui/src/config/section/infra/managementServers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ export default {
2626
permission: ['listManagementServersMetrics'],
2727
resourceType: 'ManagementServer',
2828
columns: () => {
29-
const fields = ['name', 'state', 'serviceip', 'version', 'osdistribution', 'agentscount']
29+
const fields = ['name', 'state', 'serviceip', 'version', 'osdistribution', 'pendingjobscount', 'agentscount']
3030
const metricsFields = ['collectiontime', 'availableprocessors', 'cpuload', 'heapmemoryused']
3131
if (store.getters.metrics) {
3232
fields.push(...metricsFields)
3333
}
3434
return fields
3535
},
36-
details: ['collectiontime', 'usageislocal', 'dbislocal', 'lastserverstart', 'lastserverstop', 'lastboottime', 'version', 'loginfo', 'systemtotalcpucycles', 'systemloadaverages', 'systemcycleusage', 'systemmemorytotal', 'systemmemoryfree', 'systemmemoryvirtualsize', 'availableprocessors', 'javadistribution', 'javaversion', 'osdistribution', 'kernelversion', 'agentscount', 'sessions', 'heapmemoryused', 'heapmemorytotal', 'threadsblockedcount', 'threadsdeamoncount', 'threadsnewcount', 'threadsrunnablecount', 'threadsterminatedcount', 'threadstotalcount', 'threadswaitingcount'],
36+
details: ['collectiontime', 'usageislocal', 'dbislocal', 'lastserverstart', 'lastserverstop', 'lastboottime', 'version', 'loginfo', 'systemtotalcpucycles', 'systemloadaverages', 'systemcycleusage', 'systemmemorytotal', 'systemmemoryfree', 'systemmemoryvirtualsize', 'availableprocessors', 'javadistribution', 'javaversion', 'osdistribution', 'kernelversion', 'pendingjobscount', 'agentscount', 'sessions', 'heapmemoryused', 'heapmemorytotal', 'threadsblockedcount', 'threadsdeamoncount', 'threadsnewcount', 'threadsrunnablecount', 'threadsterminatedcount', 'threadstotalcount', 'threadswaitingcount'],
3737
tabs: [
3838
{
3939
name: 'details',

0 commit comments

Comments
 (0)