Skip to content

Commit d4df7f1

Browse files
add pending jobs count to ms response
1 parent 1e29347 commit d4df7f1

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
@@ -80,6 +80,10 @@ public class ManagementServerResponse extends BaseResponse {
8080
@Param(description = "the number of host agents this Management Server is responsible for", since = "4.21.0.0")
8181
private Long agentsCount;
8282

83+
@SerializedName(ApiConstants.PENDING_JOBS_COUNT)
84+
@Param(description = "the number of pending jobs in this Management Server", since = "4.21.0.0")
85+
private Long pendingJobsCount;
86+
8387
public String getId() {
8488
return this.id;
8589
}
@@ -128,6 +132,10 @@ public Long getAgentsCount() {
128132
return this.agentsCount;
129133
}
130134

135+
public Long getPendingJobsCount() {
136+
return this.pendingJobsCount;
137+
}
138+
131139
public void setId(String id) {
132140
this.id = id;
133141
}
@@ -180,6 +188,10 @@ public void setAgentsCount(Long agentsCount) {
180188
this.agentsCount = agentsCount;
181189
}
182190

191+
public void setPendingJobsCount(Long pendingJobsCount) {
192+
this.pendingJobsCount = pendingJobsCount;
193+
}
194+
183195
public String getKernelVersion() {
184196
return kernelVersion;
185197
}

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;
@@ -607,6 +608,8 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
607608
@Inject
608609
private ClusterDao clusterDao;
609610

611+
@Inject
612+
private AsyncJobManager jobManager;
610613

611614
private SearchCriteria<ServiceOfferingJoinVO> getMinimumCpuServiceOfferingJoinSearchCriteria(int cpu) {
612615
SearchCriteria<ServiceOfferingJoinVO> sc = _srvOfferingJoinDao.createSearchCriteria();
@@ -5388,6 +5391,7 @@ protected ManagementServerResponse createManagementServerResponse(ManagementServ
53885391
mgmtResponse.setLastBoot(mgmt.getLastSystemBoot());
53895392
mgmtResponse.setServiceIp(mgmt.getServiceIP());
53905393
mgmtResponse.setAgentsCount((long) hostDao.countByMs(mgmt.getMsid()));
5394+
mgmtResponse.setPendingJobsCount(jobManager.countPendingNonPseudoJobs(mgmt.getMsid()));
53915395
mgmtResponse.setObjectName("managementserver");
53925396
return mgmtResponse;
53935397
}

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,7 @@
16711671
"label.payloadurl": "Payload URL",
16721672
"label.pcidevice": "GPU",
16731673
"label.pending.jobs": "Pending Jobs",
1674+
"label.pendingjobscount": "Number Of pending jobs",
16741675
"label.per.account": "Per Account",
16751676
"label.per.zone": "Per zone",
16761677
"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)