private static Set < PackingPlan . ContainerPlan > buildContainerPlans ( Map < Integer , Container > containerInstances ) { Set < PackingPlan . ContainerPlan > containerPlans = new LinkedHashSet <> ( ) ; for ( Integer containerId : containerInstances . keySet ( ) ) { Container container = containerInstances . get ( containerId ) ; if ( container . getInstances ( ) . size ( ) == 0 ) { continue ; } Resource totalUsedResources = container . getTotalUsedResources ( ) ; Resource resource = new Resource ( Math . round ( totalUsedResources . getCpu ( ) ) , totalUsedResources . getRam ( ) , totalUsedResources . getDisk ( ) ) ; PackingPlan . ContainerPlan containerPlan = new PackingPlan . ContainerPlan ( containerId , container . getInstances ( ) , resource ) ; containerPlans . add ( containerPlan ) ; } return containerPlans ; }
Estimate the per instance and topology resources for the packing plan based on the ramMap instance defaults and paddingPercentage .