From cc6912418f554c4dadd8e95d80b4c229d947907b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 12 Apr 2020 15:27:58 +0200 Subject: bug: Fix scheduling slices to minimum 5 min --- .../com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt index 9b741ce1..d81b8825 100644 --- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt +++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt @@ -182,7 +182,7 @@ class SimpleVirtDriver( val pCPUs = hostContext.cpus.indices.sortedBy { hostContext.cpus[it].frequency } val vms = mutableMapOf>() - val requests = TreeSet(cpuRequestComparator) + val requests = TreeSet(cpuRequestComparator) val usage = DoubleArray(hostContext.cpus.size) val burst = LongArray(hostContext.cpus.size) @@ -239,7 +239,8 @@ class SimpleVirtDriver( deadline = min(deadline, req.vm.deadline) } - duration = ceil(duration) + // XXX We set the minimum duration to 5 minutes here to prevent the rounding issues that are occurring with the FLOPs. + duration = max(300.0, ceil(duration)) val totalAllocatedUsage = maxUsage - availableUsage var totalAllocatedBurst = 0L -- cgit v1.2.3