summaryrefslogtreecommitdiff
path: root/opendc/opendc-compute/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-15 00:17:18 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-04-15 00:17:18 +0200
commit998466e611438e9f4381e5d693ef4119a3cf8905 (patch)
tree1d0234ae2e6e8f692553752063793498aa021380 /opendc/opendc-compute/src
parent60372f0022d423efd5267ef4008d9afcbe870911 (diff)
bug: Address uid collision issue
Diffstat (limited to 'opendc/opendc-compute/src')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt6
1 files changed, 3 insertions, 3 deletions
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<ServerEvent>()
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
}