From aa73475d11a1a3b61a2997201cda953eea403a0d Mon Sep 17 00:00:00 2001 From: rread Date: Wed, 17 Jul 2002 00:10:09 +0000 Subject: [PATCH] - lov config works now --- lustre/tests/lov.xml | 6 +++--- lustre/utils/lconf | 42 ++++++++++++++++++++++++++++-------------- lustre/utils/lustre.dtd | 2 +- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/lustre/tests/lov.xml b/lustre/tests/lov.xml index ccf02db..04c931c 100644 --- a/lustre/tests/lov.xml +++ b/lustre/tests/lov.xml @@ -26,14 +26,14 @@ - - + + - + diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 43a3a2a..d9cca6c 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -46,7 +46,9 @@ def usage(): config.xml Lustre configuration in xml format. -v | --verbose Print system commands as they are run -d | --debug Print system commands, but does not run them +--host Load config for --cleanup Cleans up config. (Shutdown) +-h | --help Print this help """ TODO = """ --ldap server LDAP server with lustre config database @@ -313,9 +315,11 @@ def prepare_ldlm(node): setup ="") def prepare_lov(node): - (name, uuid, mdcuuid, stripe_cnt, strip_sz, pattern, devlist) = getLOVInfo(node) + (name, uuid, mdcuuid, stripe_cnt, strip_sz, pattern, devlist, mdsname) = getLOVInfo(node) print 'LOV:', name, uuid - lctl.lovconfig(uuid, mdcuuid, stripe_cnt, strip_sz, pattern, devlist) + lctl.lovconfig(uuid, mdsname, stripe_cnt, strip_sz, pattern, devlist) + lctl.newdev(attach="lov %s %s" % (name, uuid), + setup ="%s" % (mdcuuid)) def prepare_network(node): (name, uuid, type, nid, port) = getNetworkInfo(node) @@ -486,14 +490,17 @@ def getLOVInfo(node): mdcref = node.getElementsByTagName('mdc_ref')[0] mdcuuid = mdcref.getAttribute('uuidref') mdc= lookup(node.parentNode, mdcuuid) - mdcname = getName(mdc) + mdsref = mdc.getElementsByTagName('mds_ref')[0] + mdsuuid = mdsref.getAttribute('uuidref') + mds= lookup(node.parentNode, mdsuuid) + mdsname = getName(mds) devlist = "" stripe_cnt = 0 for child in devs.childNodes: - if child.nodeName == 'obd_ref': + if child.nodeName == 'osc_ref': devlist = devlist + child.getAttribute('uuidref') + " " strip_cnt = stripe_cnt + 1 - return (name, uuid, mdcname, stripe_cnt, stripe_sz, pattern, devlist) + return (name, uuid, mdcuuid, stripe_cnt, stripe_sz, pattern, devlist, mdsname) # extract device attributes for an obd def getMDSInfo(node): @@ -697,12 +704,14 @@ def cleanupProfile(lustreNode, profileNode): stopService(s[1]) -def doHost(lustreNode, hostname, cleanFlag): - node = getByName(lustreNode, 'node', hostname) - if not node: - node = getByName(lustreNode, 'node', 'localhost') - if not node: - panic("no node for ", hostname) +# +# Load profile for +def doHost(lustreNode, hosts, cleanFlag): + for h in hosts: + node = getByName(lustreNode, 'node', h) + if node: + break + reflist = node.getElementsByTagName('profile_ref') for r in reflist: if cleanFlag: @@ -717,7 +726,7 @@ def parse_cmdline(argv): short_opts = "hdv" long_opts = ["ldap", "reformat", "lustre=", "portals=", "makeldiff", "cleanup", "iam=", - "help", "debug"] + "help", "debug", "host="] opts = [] args = [] global options @@ -743,6 +752,8 @@ def parse_cmdline(argv): options['lustre'] = a if o == "--reformat": options['reformat'] = 1 + if o == "--host": + options['hostname'] = [a] return args # @@ -763,10 +774,13 @@ def main(): if not options.has_key('hostname'): ret, host = run('hostname') if ret: - panic("unable to determine hostname") - options['hostname'] = host + print "unable to determine hostname" + else: + options['hostname'] = [host] + options['hostname'].append('localhost') doHost(dom.childNodes[0], options['hostname'], options.has_key('cleanup') ) if __name__ == "__main__": main() + diff --git a/lustre/utils/lustre.dtd b/lustre/utils/lustre.dtd index 37cc3c5..014a3c0 100644 --- a/lustre/utils/lustre.dtd +++ b/lustre/utils/lustre.dtd @@ -36,7 +36,7 @@ - + -- 1.8.3.1