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 @@ -682,8 +682,10 @@ public List<HostMetricsResponse> listHostMetrics(List<HostResponse> hostResponse
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;
Expand All @@ -693,10 +695,16 @@ public List<HostMetricsResponse> listHostMetrics(List<HostResponse> hostResponse
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -108,10 +112,12 @@ public void setPowerState(final OutOfBandManagement.PowerState powerState) {
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) {
Expand Down