Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

remove three other roundings in cpu calculation #2807

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ private void assertHasSpace(Resource resource) throws ResourceExceededException
Resource usedResources = this.getTotalUsedResources();
ByteAmount newRam =
usedResources.getRam().plus(resource.getRam()).increaseBy(paddingPercentage);
double newCpu = Math.round(
PackingUtils.increaseBy(usedResources.getCpu() + resource.getCpu(), paddingPercentage));
double newCpu =
PackingUtils.increaseBy(usedResources.getCpu() + resource.getCpu(), paddingPercentage);
ByteAmount newDisk =
usedResources.getDisk().plus(resource.getDisk()).increaseBy(paddingPercentage);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ private static Set<PackingPlan.ContainerPlan> buildContainerPlans(
new Resource(instanceCpu, instanceRam, instanceDisk)));
}

containerCpu += (paddingPercentage * containerCpu) / 100;
containerCpu = PackingUtils.increaseBy(containerCpu, paddingPercentage);
containerRam = containerRam.increaseBy(paddingPercentage);
containerDiskInBytes = containerDiskInBytes.increaseBy(paddingPercentage);

Resource resource =
new Resource(Math.round(containerCpu), containerRam, containerDiskInBytes);
new Resource(containerCpu, containerRam, containerDiskInBytes);

PackingPlan.ContainerPlan containerPlan =
new PackingPlan.ContainerPlan(containerId, instancePlans, resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ private static void assertIsValidInstance(Resource instanceResources,
instanceRam, maxContainerResources.getRam()));
}

double instanceCpu = Math.round(PackingUtils.increaseBy(
instanceResources.getCpu(), paddingPercentage));
double instanceCpu = PackingUtils.increaseBy(
instanceResources.getCpu(), paddingPercentage);
if (instanceCpu > maxContainerResources.getCpu()) {
throw new PackingException(String.format(
"This instance requires containers with at least %s cpu cores. The current max container"
Expand Down