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 cpuDisableThreshold = DeploymentClusterPlanner.ClusterCPUCapacityDisableThreshold.valueIn(clusterId);
|
||||||
final Float memoryDisableThreshold = DeploymentClusterPlanner.ClusterMemoryCapacityDisableThreshold.valueIn(clusterId);
|
final Float memoryDisableThreshold = DeploymentClusterPlanner.ClusterMemoryCapacityDisableThreshold.valueIn(clusterId);
|
||||||
|
|
||||||
Long upInstances = 0L;
|
long upInstances = 0L;
|
||||||
Long totalInstances = 0L;
|
long totalInstances = 0L;
|
||||||
|
long upSystemInstances = 0L;
|
||||||
|
long totalSystemInstances = 0L;
|
||||||
for (final VMInstanceVO instance: vmInstanceDao.listByHostId(hostId)) {
|
for (final VMInstanceVO instance: vmInstanceDao.listByHostId(hostId)) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -693,10 +695,16 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
|
|||||||
if (instance.getState() == VirtualMachine.State.Running) {
|
if (instance.getState() == VirtualMachine.State.Running) {
|
||||||
upInstances++;
|
upInstances++;
|
||||||
}
|
}
|
||||||
|
} else if (instance.getType().isUsedBySystem()) {
|
||||||
|
totalSystemInstances++;
|
||||||
|
if (instance.getState() == VirtualMachine.State.Running) {
|
||||||
|
upSystemInstances++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
metricsResponse.setPowerState(hostResponse.getOutOfBandManagementResponse().getPowerState());
|
metricsResponse.setPowerState(hostResponse.getOutOfBandManagementResponse().getPowerState());
|
||||||
metricsResponse.setInstances(upInstances, totalInstances);
|
metricsResponse.setInstances(upInstances, totalInstances);
|
||||||
|
metricsResponse.setSystemInstances(upSystemInstances, totalSystemInstances);
|
||||||
metricsResponse.setCpuTotal(hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
metricsResponse.setCpuTotal(hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
||||||
metricsResponse.setCpuUsed(hostResponse.getCpuUsed(), hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
metricsResponse.setCpuUsed(hostResponse.getCpuUsed(), hostResponse.getCpuNumber(), hostResponse.getCpuSpeed());
|
||||||
metricsResponse.setCpuAllocated(hostResponse.getCpuAllocated(), 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")
|
@Param(description = "instances on the host")
|
||||||
private String instances;
|
private String instances;
|
||||||
|
|
||||||
|
@SerializedName("systeminstances")
|
||||||
|
@Param(description = "system vm instances on the host")
|
||||||
|
private String systemInstances;
|
||||||
|
|
||||||
@SerializedName("cputotalghz")
|
@SerializedName("cputotalghz")
|
||||||
@Param(description = "the total cpu capacity in Ghz")
|
@Param(description = "the total cpu capacity in Ghz")
|
||||||
private String cpuTotal;
|
private String cpuTotal;
|
||||||
@ -108,10 +112,12 @@ public class HostMetricsResponse extends HostResponse {
|
|||||||
this.powerState = powerState;
|
this.powerState = powerState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInstances(final Long running, final Long total) {
|
public void setSystemInstances(final long running, final long total) {
|
||||||
if (running != null && total != null) {
|
this.systemInstances = String.format("%d / %d", running, total);
|
||||||
this.instances = 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) {
|
public void setCpuTotal(final Integer cpuNumber, final Long cpuSpeed) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user