From 998466e611438e9f4381e5d693ef4119a3cf8905 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 15 Apr 2020 00:17:18 +0200 Subject: bug: Address uid collision issue --- .../atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'opendc/opendc-compute/src') diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt index 844938db..08f04760 100644 --- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt +++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt @@ -120,7 +120,7 @@ public class SimpleBareMetalDriver( /** * The internal random instance. */ - private val random = Random(0) + private val random = Random(uid.leastSignificantBits xor uid.mostSignificantBits) override suspend fun init(): Node = withContext(domain.coroutineContext) { nodeState.value @@ -134,7 +134,7 @@ public class SimpleBareMetalDriver( val events = EventFlow() val server = Server( - UUID(node.uid.leastSignificantBits xor node.uid.mostSignificantBits, random.nextLong()), + UUID(random.nextLong(), random.nextLong()), node.name, emptyMap(), flavor, @@ -151,7 +151,7 @@ public class SimpleBareMetalDriver( override suspend fun stop(): Node = withContext(domain.coroutineContext) { val node = nodeState.value - if (node.state == NodeState.SHUTOFF || node.state == NodeState.ERROR) { + if (node.state == NodeState.SHUTOFF) { return@withContext node } -- cgit v1.2.3