Whamcloud - gitweb
update with current HEAD
authorshaocheng <shaocheng>
Tue, 24 Feb 2004 23:39:18 +0000 (23:39 +0000)
committershaocheng <shaocheng>
Tue, 24 Feb 2004 23:39:18 +0000 (23:39 +0000)
lustre/utils/lmc

index f8dabf4..f4deff5 100755 (executable)
@@ -27,7 +27,15 @@ lmc - lustre configuration data manager
 
 import sys, os, getopt, string, exceptions, re
 import xml.dom.minidom
-from xml.dom.ext import PrettyPrint
+
+def printDoc(doc, stream=sys.stdout):
+    try:
+        from xml.dom.ext import PrettyPrint
+        PrettyPrint(doc, stream)
+    except ImportError:
+        stream.write(doc.toxml())
+        stream.write("\n")
+    
 
 PYMOD_DIR = "/usr/lib/lustre/python"
 
@@ -359,7 +367,7 @@ class GenConfig:
         return ldlm
 
     def osd(self, name, uuid, fs, osdtype, devname, format, ost_uuid,
-            node_uuid, dev_size=0, journal_size=0, inode_size=0, nspath=""):
+            node_uuid, dev_size=0, journal_size=0, inode_size=0, nspath="", mkfsoptions=""):
         osd = self.newService("osd", name, uuid)
         osd.setAttribute('osdtype', osdtype)
         osd.appendChild(self.ref("target", ost_uuid))
@@ -375,6 +383,8 @@ class GenConfig:
                 self.addElement(osd, "journalsize", "%s" % (journal_size))
             if inode_size:
                 self.addElement(osd, "inodesize", "%s" % (inode_size))
+            if mkfsoptions:
+                self.addElement(osd, "mkfsoptions", mkfsoptions)
         if nspath:
             self.addElement(osd, "nspath", nspath)
         return osd
@@ -748,12 +758,14 @@ def add_ost(gen, lustre, options):
         fstype = ''
         journal_size = ''
         inode_size = ''
+        mkfsoptions = ''
     else:
         devname = get_option(options, 'dev') # can be unset for bluearcs
         size = get_option(options, 'size')
         fstype = get_option(options, 'fstype')
         journal_size = get_option(options, 'journal_size')
         inode_size = get_option(options, 'inode_size')
+        mkfsoptions = get_option(options, 'mkfsoptions')
         
     nspath = get_option(options, 'nspath')
 
@@ -789,7 +801,7 @@ def add_ost(gen, lustre, options):
 
     osd = gen.osd(osdname, osd_uuid, fstype, osdtype, devname,
                   get_format_flag(options), ost_uuid, node_uuid, size,
-                  journal_size, inode_size, nspath)
+                  journal_size, inode_size, nspath, mkfsoptions)
 
     node = findByName(lustre, node_name, "node")
 
@@ -1043,11 +1055,11 @@ def cmdlinesplit(cmdline):
             if arg is None: arg = match.group(1)
             else:           arg = arg + match.group(1)
                                                                                                                                                
-        elif c.isspace():
+        elif c in string.whitespace:
             if arg != None:
                 arg_list.append(str(arg))
             arg = None
-            while i < len(cmdline) and cmdline[i].isspace():
+            while i < len(cmdline) and cmdline[i] in string.whitespace:
                 i = i + 1
         else:
             match = outside.match(cmdline, i)
@@ -1156,9 +1168,9 @@ def main():
             panic("lmc", e)
 
     if outFile == '-':
-        PrettyPrint(doc)
+        printDoc(doc)
     else:
-        PrettyPrint(doc, open(outFile,"w"))
+        printDoc(doc, open(outFile,"w"))
 
 if __name__ == "__main__":
     main()