mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
systeminstances field (#7871)
Co-authored-by: Henrique Sato <henrique.sato@scclouds.com.br>
This commit is contained in:
parent
1065e9046b
commit
9083a677ae
@ -682,8 +682,10 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
|
||||
final Float cpuDisableThreshold = DeploymentClusterPlanner.ClusterCPUCapacityDisableThreshold.valueIn(clusterId);
|
||||
final Float memoryDisableThreshold = DeploymentClusterPlanner.ClusterMemoryCapacityDisableThreshold.valueIn(clusterId);
|
||||
|
||||
Long upInstances = 0L;
|
||||
Long totalInstances = 0L;
|
||||
long upInstances = 0L;
|
||||
long totalInstances = 0L;
|
||||
long upSystemInstances = 0L;
|
||||
long totalSystemInstances = 0L;
|
||||
for (final VMInstanceVO instance: vmInstanceDao.listByHostId(hostId)) {
|
||||
if (instance == null) {
|
||||
continue;
|
||||
@ -693,10 +695,16 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
|
||||
if (instance.getState() == VirtualMachine.State.Running) {
|
||||
upInstances++;
|
||||
}
|
||||
} else if (instance.getType().isUsedBySystem()) {
|
||||
totalSystemInstances++;
|
||||
if (instance.getState() == VirtualMachine.State.Running) {
|
||||
upSystemInstances++;
|
||||
}
|
||||
}
|
||||
}
|
||||
metricsResponse.setPowerState(hostResponse.getOutOfBandManagementResponse().getPowerState());
|
||||
metricsResponse.setInstances(upInstances, totalInstances);
|
||||
metricsResponse.setSystemInstances(upSystemInstances, totalSystemInstances);
|
||||
metricsResponse.setCpuTotal(hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
||||
metricsResponse.setCpuUsed(hostResponse.getCpuUsed(), hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
||||
metricsResponse.setCpuAllocated(hostResponse.getCpuAllocated(), hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
||||
|
||||
@ -36,6 +36,10 @@ public class HostMetricsResponse extends HostResponse {
|
||||
@Param(description = "instances on the host")
|
||||
private String instances;
|
||||
|
||||
@SerializedName("systeminstances")
|
||||
@Param(description = "system vm instances on the host")
|
||||
private String systemInstances;
|
||||
|
||||
@SerializedName("cputotalghz")
|
||||
@Param(description = "the total cpu capacity in Ghz")
|
||||
private String cpuTotal;
|
||||
@ -108,10 +112,12 @@ public class HostMetricsResponse extends HostResponse {
|
||||
this.powerState = powerState;
|
||||
}
|
||||
|
||||
public void setInstances(final Long running, final Long total) {
|
||||
if (running != null && total != null) {
|
||||
this.instances = String.format("%d / %d", running, total);
|
||||
}
|
||||
public void setSystemInstances(final long running, final long total) {
|
||||
this.systemInstances = String.format("%d / %d", running, total);
|
||||
}
|
||||
|
||||
public void setInstances(final long running, final long total) {
|
||||
this.instances = String.format("%d / %d", running, total);
|
||||
}
|
||||
|
||||
public void setCpuTotal(final Integer cpuNumber, final Long cpuSpeed) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user