class ConsolidationAlgorithmBase extends ClusterManagementDummyAlgorithm {

    public boolean canMigrateVmToHost(VmResources vm, HostResources host) {
        if (host.getCpus() < vm.getNumberOfCpus()) {
            return false;
        }
        long vmCpuNeeds = vm.getNumberOfCpus() * vm.getCpuSpeed();
        if (getHostAvailableCpu(host) < vmCpuNeeds) {
            return false;
        }
        long vmMemory = vm.getMemoryInMegaBytes();
        long hostAvailableMemory = getHostAvailableMemory(host);
        if (hostAvailableMemory < vmMemory) {
            return false;
        }
        return true;
    }

}