class HostResourcesService {

    protected List<VmResources> listVmsFromHost(HostResources host) {
        List<VMInstanceVO> vmInstanceList = vmInstanceDao.listByHostId(host.getHostId());
        List<VmResources> vmResourcesList = new ArrayList<>();

        for (VMInstanceVO vmInstance : vmInstanceList) {
            if (!isVmCurrentlyUsingHostResource(vmInstance)) {
                continue;
            }
            ServiceOfferingVO serviceOffering = serviceOfferingDao.findById(vmInstance.getServiceOfferingId());
            vmResourcesList.add(new VmResources(vmInstance.getId(), serviceOffering.getCpu(), serviceOffering.getSpeed(), serviceOffering.getRamSize()));
        }
        return vmResourcesList;
    }

}