summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2020-04-11 13:06:44 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2020-04-11 13:06:44 +0200
commit443761098b5fff8a197deca2bca064da250dbd5f (patch)
tree83b048c0e35a16a3e6ea4c2f0b311478b0e8e7b1
parent9bbdce2758f2b2f66f159bba0c19ccc70b91086d (diff)
parent3b8a3a8a1988200befb56ec1840666f68439be13 (diff)
Merge branch 'bug/virt-driver-behavior' into '2.x'
Improve behavior of VirtDriver metrics See merge request opendc/opendc-simulator!56
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt9
1 files changed, 6 insertions, 3 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 dcfa1174..5f15084d 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
@@ -310,8 +310,9 @@ class SimpleVirtDriver(
hasFinished = true
}
- if (vm.deadline <= end) {
+ if (vm.deadline <= end && hostContext.server.state != ServerState.ERROR) {
// Request must have its entire burst consumed or otherwise we have overcommission
+ // Note that we count the overcommissioned burst if the hypervisor has failed.
totalOvercommissionedBurst += req.burst
}
}
@@ -329,11 +330,13 @@ class SimpleVirtDriver(
eventFlow.emit(
HypervisorEvent.SliceFinished(
this@SimpleVirtDriver,
- totalRequestedBurst,
+ // 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
totalOvercommissionedBurst,
totalInterferedBurst, // Might be smaller than zero due to FP rounding errors
- vmCount, // Some of the VMs might already have finished, so keep initial VM count
+ vmCount, // Some VMs might already have finished, so keep initial VM count
server
)
)