Commit 6a695c33 authored by Julien Muchembled's avatar Julien Muchembled

master: do not regenerate UUID if it was unused

parent f8cce9b0
...@@ -433,9 +433,10 @@ class Application(object): ...@@ -433,9 +433,10 @@ class Application(object):
self.cluster_state = state self.cluster_state = state
def getNewUUID(self, uuid, address, node_type): def getNewUUID(self, uuid, address, node_type):
if None != uuid != self.uuid and \ if None != uuid != self.uuid:
self.nm.getByAddress(address) is self.nm.getByUUID(uuid): node = self.nm.getByUUID(uuid)
return uuid if node is None or node.getAddress() == address:
return uuid
while True: while True:
uuid = UUID_NAMESPACES[node_type] + os.urandom(15) uuid = UUID_NAMESPACES[node_type] + os.urandom(15)
if uuid != self.uuid and self.nm.getByUUID(uuid) is None: if uuid != self.uuid and self.nm.getByUUID(uuid) is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment