summaryrefslogtreecommitdiff
path: root/opendc
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-11 12:35:13 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-11 12:35:13 +0200
commit3b8a3a8a1988200befb56ec1840666f68439be13 (patch)
tree8ac0f35fd720ab3c40f7d920b1b9ef6d0ec36f53 /opendc
parent5310dd64606f398bddcaef87f26eee94b663b39d (diff)
bug: Improve behavior of VirtDriver metrics
Diffstat (limited to 'opendc')
-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
)
)