public HypervisorStatistics getHypervisorsStatistics() throws CloudException {
checkDomainAdmin();
HypervisorStatistics response = new HypervisorStatistics();
Hypervisor stats = null;
for (SchedulerHost host : scheduler.getAllHosts()) {
if (stats == null) {
stats = toModel(host);
stats.count = 1L;
} else {
Hypervisor model = toModel(host);
add(stats, model);
}
}
if (stats == null) {
stats = new Hypervisor();
stats.count = 0L;
}
response.hypervisor_statistics = stats;