Skip to content

Commit

Permalink
Use uuid4 instead of uuid1
Browse files Browse the repository at this point in the history
Until now the prefix uuid was generated with 'uuid1' command. In cases
where you started two environments with the same network names - the uuid1 usage
caused us to pass the same network name to libvirt, despite the environments being
different, thus throwing a libvirt error.

The reason is that we truncated the 8 last bytes of the uuid1 and joined
that with the network name. The 8 last bytes of uuid1 are most
definitely not random.
I see no reason to have the uuid not completely random - therefore this
patch changes the prefix uuid to be generated with uuid4, which should
be completely random.

Signed-off-by: Nadav Goldin <[email protected]>
  • Loading branch information
nvgoldin committed Jul 1, 2017
1 parent d0959e2 commit ab3919a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lago/prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ def initialize(self):
rollback.prependDefer(shutil.rmtree, prefix)

with open(self.paths.uuid(), 'w') as f, \
LogTask('Generate prefix uuid'):
f.write(uuid.uuid1().hex)
LogTask('Generate prefix uuid4'):
f.write(uuid.uuid4().hex)

with LogTask('Create ssh keys'):
self._create_ssh_keys()
Expand Down
2 changes: 1 addition & 1 deletion lago/virt.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@


def _gen_ssh_command_id():
return uuid.uuid1().hex[:8]
return uuid.uuid4().hex[:8]


def _guestfs_copy_path(g, guest_path, host_path):
Expand Down

0 comments on commit ab3919a

Please sign in to comment.