From aa6a0131f98b164b7caaf25c89ca7ae2c7c8b9dc Mon Sep 17 00:00:00 2001 From: pschwan Date: Sun, 3 Nov 2002 20:51:44 +0000 Subject: [PATCH] The "random" addition to the UUID were in fact not very random: dev is time- synchronized, and this caused big trouble. I fixed this by seeding the PRNG from /dev/urandom at startup; my first multi-line python hackery, so I hope I didn't pooch it. --- lustre/utils/lconf | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 8692970..3399248 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -1002,7 +1002,7 @@ class MDC(Module): host = socket.gethostname() self.name = 'MDC_%s' % (self.mds.name) - self.uuid = '%s_%4.4x_UUID' % (self.name , int(random.random() * 100000 )) + self.uuid = '%s_%05x_UUID' % (self.name , int(random.random() * 100000)) self.lookup_server(self.mds.uuid) self.add_module('lustre/mdc', 'mdc') @@ -1668,6 +1668,16 @@ def main(): global TCP_ACCEPTOR, lctl, MAXTCPBUF host = socket.gethostname() + # the PRNG is normally seeded with time(), which is not so good for starting + # time-synchronized clusters + input = open('/dev/urandom', 'r') + if not input: + print 'Unable to open /dev/urandom!' + sys.exit(1) + seed = input.read(32) + input.close() + random.seed(seed) + sanitise_path() args = parse_cmdline(sys.argv[1:]) -- 1.8.3.1