From 313e847b86a2b443a91903fbf4f4dff9334ad6c6 Mon Sep 17 00:00:00 2001 From: rread Date: Wed, 28 Aug 2002 00:37:27 +0000 Subject: [PATCH] - add support for obdecho. When creating the ost with lmc, add --obdtype=obdecho --- lustre/utils/lconf | 22 ++++++++++++++-------- lustre/utils/lmc | 47 +++++++++++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 3b997f1..ee8d558 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -726,7 +726,10 @@ class OBD(Module): # FIXME: check if device is already formatted. def prepare(self): self.info(self.obdtype, self.devname, self.size, self.fstype, self.format) - blkdev = block_dev(self.devname, self.size, self.fstype, self.format) + if not self.obdtype == 'obdecho': + blkdev = block_dev(self.devname, self.size, self.fstype, self.format) + else: + blkdev = '' lctl.newdev(attach="%s %s %s" % (self.obdtype, self.name, self.uuid), setup ="%s %s" %(blkdev, self.fstype)) def cleanup(self): @@ -830,13 +833,16 @@ class Mountpoint(Module): # TODO: Change query funcs to use XPath, which is muc cleaner def getDevice(obd): - dev = obd.getElementsByTagName('device')[0] - dev.normalize(); - try: - size = int(dev.getAttribute('size')) - except ValueError: - size = 0 - return dev.firstChild.data, size + list = obd.getElementsByTagName('device') + if len(list) > 0: + dev = list[0] + dev.normalize(); + try: + size = int(dev.getAttribute('size')) + except ValueError: + size = 0 + return dev.firstChild.data, size + return '', 0 # Get the text content from the first matching child # If there is no content (or it is all whitespace), return diff --git a/lustre/utils/lmc b/lustre/utils/lmc index b103a0e..0f16445 100755 --- a/lustre/utils/lmc +++ b/lustre/utils/lmc @@ -87,6 +87,9 @@ Options: --format Format the partitions if unformated --reformat Reformat partitions (this should be an lconf arg, I think) +--obdtype="obdtype" Specifiy obdtype: valid ones are obdecho and obdfilter. + This is only useful for the --ost command. + The device parameters are ignored for the obdecho type. """ sys.exit(1) @@ -194,14 +197,16 @@ class GenConfig: ldlm = self.newService("ldlm", name, uuid) return ldlm - def obd(self, name, uuid, fs, devname, format, dev_size=0): + def obd(self, name, uuid, fs, obdtype, devname, format, dev_size=0): obd = self.newService("obd", name, uuid) - obd.setAttribute('type', 'obdfilter') - self.addElement(obd, "fstype", fs) - dev = self.addElement(obd, "device", devname) - if (dev_size): - dev.setAttribute("size", "%s" % (dev_size)) - self.addElement(obd, "autoformat", format) + obd.setAttribute('type', obdtype) + if fs: + self.addElement(obd, "fstype", fs) + if devname: + dev = self.addElement(obd, "device", devname) + if (dev_size): + dev.setAttribute("size", "%s" % (dev_size)) + self.addElement(obd, "autoformat", format) return obd def osc(self, name, uuid, obd_uuid, net_uuid): @@ -331,6 +336,12 @@ def node_add_profile(gen, node, ref, uuid): # Create a new obd, osc, and ost. Add them to the DOM. # def add_ost(gen, lustre, options, args): + lovname = '' + obdtype = 'obdfilter' + devname = '' + size = 0 + fstype = 'extN' + if len(args) < 1: usage() @@ -341,15 +352,17 @@ def add_ost(gen, lustre, options, args): if options.has_key('lov'): lovname = options['lov'] - else: - lovname = '' - devname = args[0] - if len(args) > 1: - size = args[1] - else: - size = 0 + if options.has_key('obdtype'): + obdtype = options['obdtype'] + if obdtype == 'obdecho': + fstype = '' + else: + devname = args[0] + if len(args) > 1: + size = args[1] + obdname = new_name('OBD_'+ node_name) oscname = new_name('OSC_'+ node_name) ostname = new_name('OST_'+ node_name) @@ -361,7 +374,7 @@ def add_ost(gen, lustre, options, args): if not net_uuid: error("NODE: ", node_name, "not found") - obd = gen.obd(obdname, obd_uuid, "extN", devname, get_format_flag(options), size) + obd = gen.obd(obdname, obd_uuid, fstype, obdtype, devname, get_format_flag(options), size) ost = gen.ost(ostname, ost_uuid, obd_uuid, net_uuid) osc = gen.osc(oscname, osc_uuid, obd_uuid, ost_uuid) @@ -551,7 +564,7 @@ def parse_cmdline(argv): short_opts = "ho:i:m:" long_opts = ["ost", "mtpt", "lov=", "node=", "mds=", "net", "mdc", "merge=", "format", "reformat", "output=", - "in=", "help"] + "obdtype=", "in=", "help"] opts = [] args = [] options = {} @@ -582,6 +595,8 @@ def parse_cmdline(argv): options['lov'] = a if o in ("-m", "--merge"): options['merge'] = a + if o == "--obdtype": + options['obdtype'] = a if o == "--format": options['format'] = 1 if o == "--reformat": -- 1.8.3.1