summaryrefslogtreecommitdiff
path: root/opendc
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-13 00:26:09 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-13 00:26:09 +0200
commit6e7c253cb61f2c529f6e852183c997d733ad864d (patch)
treee3b1a046866a0847bd66f077e554127ae1c61c38 /opendc
parent310daf42af741dee2f11d98eb929d2b6c0db141c (diff)
parent0b70599086ce8397fead00e2c69ed8922ecc84b7 (diff)
Merge branch 'bug/2.x-requested-cap' into '2.x'
Uncap total requested burst See merge request opendc/opendc-simulator!59
Diffstat (limited to 'opendc')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt9
1 files changed, 4 insertions, 5 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 d81b8825..730d49f5 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
@@ -274,7 +274,8 @@ class SimpleVirtDriver(
continue
}
- // The total burst that the VMs wanted to run in the time-frame that we ran.
+ // The total requested burst that the VMs wanted to run in the time-frame that we ran.
+ val totalRequestedSubBurst = min(totalRequestedBurst, ceil(totalRequestedUsage * duration).toLong())
val totalRemainder = burst.sum()
val totalGrantedBurst = totalAllocatedBurst - totalRemainder
@@ -331,10 +332,8 @@ class SimpleVirtDriver(
eventFlow.emit(
HypervisorEvent.SliceFinished(
this@SimpleVirtDriver,
- // Only consider the burst that we could allocate in the time-frame that we ran, not the entire
- // requested burst, since we some requests may be run in multiple slices
- min(totalRequestedBurst, totalAllocatedBurst),
- min(totalRequestedBurst, totalGrantedBurst), // We can run more than requested due to timing
+ totalRequestedSubBurst,
+ min(totalRequestedSubBurst, totalGrantedBurst), // We can run more than requested due to timing
totalOvercommissionedBurst,
totalInterferedBurst, // Might be smaller than zero due to FP rounding errors,
totalAllocatedUsage,