diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-10-05 12:57:31 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-10-05 12:57:31 +0200 |
| commit | 374960cd15a2893a124c42975167f8bf6e45e868 (patch) | |
| tree | 207f2deb8e3782f1a52e6b32290e274c6ff7ba1f /simulator/opendc-compute/opendc-compute-simulator | |
| parent | feda2ade4069f0582feed0873c9a0d0a2e5401f6 (diff) | |
Address compilation warnings
Diffstat (limited to 'simulator/opendc-compute/opendc-compute-simulator')
2 files changed, 3 insertions, 3 deletions
diff --git a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ComparableAllocationPolicyLogic.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ComparableAllocationPolicyLogic.kt index 6aff2bab..8defe8b7 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ComparableAllocationPolicyLogic.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ComparableAllocationPolicyLogic.kt @@ -44,6 +44,6 @@ public interface ComparableAllocationPolicyLogic : AllocationPolicy.Logic { val fitsCpu = hv.server.flavor.cpuCount >= image.flavor.cpuCount fitsMemory && fitsCpu } - .minWith(comparator.thenBy { it.server.uid }) + .minWithOrNull(comparator.thenBy { it.server.uid }) } } diff --git a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ReplayAllocationPolicy.kt b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ReplayAllocationPolicy.kt index fda863bb..5312f4da 100644 --- a/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ReplayAllocationPolicy.kt +++ b/simulator/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/allocation/ReplayAllocationPolicy.kt @@ -46,10 +46,10 @@ public class ReplayAllocationPolicy(private val vmPlacements: Map<String, String if (machinesInCluster.isEmpty()) { logger.info { "Could not find any machines belonging to cluster $clusterName for image ${image.name}, assigning randomly." } - return hypervisors.maxBy { it.availableMemory } + return hypervisors.maxByOrNull { it.availableMemory } } - return machinesInCluster.maxBy { it.availableMemory } + return machinesInCluster.maxByOrNull { it.availableMemory } ?: throw IllegalStateException("Cloud not find any machine and could not randomly assign") } } |
