From: wangchao Date: Wed, 31 Dec 2003 07:42:11 +0000 (+0000) Subject: b=1171 X-Git-Tag: 1.0.2~4 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=21b4efcd8f7e696d1ae575c20002da38b07ce7e8;p=fs%2Flustre-release.git b=1171 r=shaver create true uuid in lmc --- diff --git a/lustre/utils/lmc b/lustre/utils/lmc index f8375b9..47076a3 100755 --- a/lustre/utils/lmc +++ b/lustre/utils/lmc @@ -25,7 +25,7 @@ lmc - lustre configuration data manager """ -import sys, os, getopt, string, exceptions +import sys, os, getopt, string, exceptions, random import xml.dom.minidom from xml.dom.ext import PrettyPrint @@ -216,7 +216,11 @@ def new_name(base): return ret def new_uuid(name): - return "%s_UUID" % (name) + ret_uuid = '%05x_%.19s_%05x%05x' % (int(random.random() * 1048576), + name, + int(random.random() * 1048576), + int(random.random() * 1048576)) + return ret_uuid[:36] ldlm_name = 'ldlm' ldlm_uuid = 'ldlm_UUID' @@ -1006,6 +1010,15 @@ def main(): gen = GenConfig(doc) + # 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) + if options.batch: fp = open(options.batch) batchCommands = fp.readlines()