From 1cb70fff353b3ebda22c3d9df44b89cc1a5384e6 Mon Sep 17 00:00:00 2001 From: wangchao Date: Fri, 30 Jan 2004 02:10:53 +0000 Subject: [PATCH] b=1171 r=shaver rewrite new_uuid function for lmc --- lustre/tests/conf-sanity.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++ lustre/utils/lmc | 29 +++++++++++++------------- 2 files changed, 64 insertions(+), 15 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 6c3978e..ea57441 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -385,4 +385,54 @@ test_12() { } run_test 12 "lmc --batch, with single/double quote, backslash in batchfile" +test_13() { + OLDXMLCONFIG=$XMLCONFIG + XMLCONFIG="conf13-1.xml" + SECONDXMLCONFIG="conf13-2.xml" + + # check long uuid will be truncated properly and uniquely + echo "To generate XML configuration file(with long ost name): $XMLCONFIG" + [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG + do_lmc --add net --node localhost --nid localhost.localdomain --nettype tcp + do_lmc --add mds --node localhost --mds mds1_name_longer_than_31characters + do_lmc --add mds --node localhost --mds mds2_name_longer_than_31characters + if [ ! -f "$XMLCONFIG" ]; then + echo "Error:no file $XMLCONFIG created!" + return 1 + fi + EXPECTEDMDS1UUID="e_longer_than_31characters_UUID" + EXPECTEDMDS2UUID="longer_than_31characters_UUID_2" + FOUNDMDS1UUID=`awk -F"'" '/ UUID_MAX_LENGTH: + ret = ret[-UUID_MAX_LENGTH:] + while uuids.has_key(ret): + ret = "%s_UUID_%d" % (name, ctr) + ctr = 1 + ctr + if len(ret) > UUID_MAX_LENGTH: + ret = ret[-UUID_MAX_LENGTH:] + uuids[ret] = 1 + return ret + ldlm_name = 'ldlm' ldlm_uuid = 'ldlm_UUID' @@ -1124,15 +1132,6 @@ 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() -- 1.8.3.1