diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-02-18 14:59:54 +0100 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-02-18 15:32:49 +0100 |
| commit | c82b1725cc606769084155d6c4fba982cd320c41 (patch) | |
| tree | 510659fc8c85fc4a7196d1a769ed2dbcfd4ed787 /opendc-compute/opendc-compute-workload/src/main/kotlin | |
| parent | 77aaf078650c054ccbaf5f46a71ab218390a571e (diff) | |
fix(compute): Disallow duplicate UIDs for SimHost
This change fixes an issue with the ComputeServiceHelper where it
allowed users to register multiple SimHost objects with the same UID.
See this issue for more information:
https://github.com/atlarge-research/opendc/issues/51
Diffstat (limited to 'opendc-compute/opendc-compute-workload/src/main/kotlin')
| -rw-r--r-- | opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeServiceHelper.kt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeServiceHelper.kt b/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeServiceHelper.kt index a1a65da3..4b0b343f 100644 --- a/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeServiceHelper.kt +++ b/opendc-compute/opendc-compute-workload/src/main/kotlin/org/opendc/compute/workload/ComputeServiceHelper.kt @@ -169,7 +169,7 @@ public class ComputeServiceHelper( optimize = optimize ) - _hosts.add(host) + require(_hosts.add(host)) { "Host with uid ${spec.uid} already exists" } service.addHost(host) return host |
