Buggy code:
public abstract class CpuAndMemoryBalancingPolicyUnit extends PolicyUnitImpl { private static final Logger log = LoggerFactory . getLogger ( CpuAndMemoryBalancingPolicyUnit . class ) ; protected static final String LOW_MEMORY_LIMIT_FOR_OVER_UTILIZED = "MaxFreeMemoryForOverUtilized" ; protected static final String HIGH_MEMORY_LIMIT_FOR_UNDER_UTILIZED = "MinFreeMemoryForUnderUtilized" ; public CpuAndMemoryBalancingPolicyUnit ( PolicyUnit policyUnit , PendingResourceManager pendingResourceManager ) { } @ Override public Pair < List < Guid > , Guid > balance ( final VDSGroup cluster , List < VDS > hosts , Map < String , String > parameters , ArrayList < String > messages ) { } protected List < VDS > getNormallyUtilizedMemoryHosts ( Collection < VDS > hosts , long minFreeMemory , long maxFreeMemory ) { } protected List < VDS > getUnderUtilizedMemoryHosts ( Collection < VDS > hosts , long lowFreeMemoryLimit , int minVmCount ) { } protected List < VDS > getOverUtilizedMemoryHosts ( Collection < VDS > hosts , long highFreeMemoryLimit ) { } protected List < VDS > getNormallyUtilizedCPUHosts ( VDSGroup cluster , List < VDS > relevantHosts , final int highUtilization , final int cpuOverCommitDurationMinutes , final int highVdsCount ) { } protected List < VDS > getOverUtilizedCPUHosts ( Collection < VDS > relevantHosts , final int highUtilization , final int cpuOverCommitDurationMinutes ) { } protected List < VDS > getUnderUtilizedCPUHosts ( Collection < VDS > relevantHosts , final int lowUtilization , final int minVmCount , final int cpuOverCommitDurationMinutes ) { List < VDS > underUtilizedHosts = LinqUtils . filter ( relevantHosts , new org . ovirt . engine . core . utils . linq . Predicate < VDS > ( ) { @ Override public boolean eval ( VDS p ) { <START_BUG> return ( ( ( ( p . getUsageCpuPercent ( ) ) + ( calcSpmCpuConsumption ( p ) ) ) < lowUtilization ) && ( ( p . getVmCount ( ) ) >= minVmCount ) ) && ( ( ( p . getCpuOverCommitTimestamp ( ) ) == null ) || ( ( ( getTime ( ) . getTime ( ) ) - ( p . getCpuOverCommitTimestamp ( ) . getTime ( ) ) ) < ( TimeUnit . MINUTES . toMillis ( cpuOverCommitDurationMinutes ) ) ) ) ; <END_BUG> } } ) ; if ( ( underUtilizedHosts . size ( ) ) > 1 ) { VDSGroup cluster = getVdsGroupDao ( ) . get ( underUtilizedHosts . get ( 0 ) . getVdsGroupId ( ) ) ; Collections . sort ( underUtilizedHosts , new org . ovirt . engine . core . bll . scheduling . utils . VdsCpuUsageComparator ( ( ( cluster != null ) && ( cluster . getCountThreadsAsCores ( ) ) ) ) ) ; } return underUtilizedHosts ; } protected int calcSpmCpuConsumption ( VDS vds ) { } protected VdsDao getVdsDao ( ) { } protected VmDao getVmDao ( ) { } protected VdsGroupDao getVdsGroupDao ( ) { } protected Date getTime ( ) { } protected int tryParseWithDefault ( String candidate , int defaultValue ) { } protected abstract FindVmAndDestinations getFindVmAndDestinations ( VDSGroup cluster , Map < String , String > parameters ) { } protected abstract List < VDS > getPrimarySources ( VDSGroup cluster , List < VDS > candidateHosts , Map < String , String > parameters ) { } protected abstract List < VDS > getPrimaryDestinations ( VDSGroup cluster , List < VDS > candidateHosts , Map < String , String > parameters ) { } protected abstract List < VDS > getSecondarySources ( VDSGroup cluster , List < VDS > candidateHosts , Map < String , String > parameters ) { } protected abstract List < VDS > getSecondaryDestinations ( VDSGroup cluster , List < VDS > candidateHosts , Map < String , String > parameters ) { } }

Fix:
return ( ( ( ( p . getUsageCpuPercent ( ) ) + ( calcSpmCpuConsumption ( p ) ) ) < lowUtilization ) && ( ( p . getVmCount ( ) ) >= minVmCount ) ) && ( ( ( p . getCpuOverCommitTimestamp ( ) ) == null ) || ( ( ( getTime ( ) . getTime ( ) ) - ( p . getCpuOverCommitTimestamp ( ) . getTime ( ) ) ) >= ( TimeUnit . MINUTES . toMillis ( cpuOverCommitDurationMinutes ) ) ) ) ;