Whamcloud - gitweb
b=1719
authorwangchao <wangchao>
Wed, 7 Jan 2004 05:07:18 +0000 (05:07 +0000)
committerwangchao <wangchao>
Wed, 7 Jan 2004 05:07:18 +0000 (05:07 +0000)
r=shaver

Add --ptldebug and --subsystem to lmc.

lustre/conf/lustre.dtd
lustre/conf/lustre2ldif.xsl
lustre/tests/cfg/local.sh
lustre/tests/conf-sanity.sh
lustre/tests/test-framework.sh
lustre/utils/lconf
lustre/utils/lmc

index de4d653..96fdc8e 100644 (file)
@@ -15,7 +15,7 @@
 <!ATTLIST lustre version CDATA #REQUIRED>
 
 <!ELEMENT node (network | routetbl | profile_ref | timeout | 
-                lustreUpcall | portalsUpcall)*>
+                lustreUpcall | portalsUpcall | ptldebug | subsystem)*>
 <!ATTLIST node %object.attr;
                router CDATA #IMPLIED>
                
@@ -87,6 +87,8 @@
 <!-- basic elements -->
 <!ELEMENT recoveryUpcall %object.content;>
 <!ELEMENT timeout       %object.content;>
+<!ELEMENT ptldebug      %object.content;>
+<!ELEMENT subsystem     %object.content;>
 <!ELEMENT journalsize   %object.content;>
 <!ELEMENT fstype        %object.content;>
 <!ELEMENT nid           %object.content;>
index 5fc6f9c..3713ec8 100644 (file)
@@ -33,6 +33,12 @@ lustreUpcall: <value-of select="lustreUpcall"/>
 <if test="portalsUpcall">
 portalsUpcall: <value-of select="portalsUpcall"/>
 </if>
+<if test="ptldebug">
+ptldebug: <value-of select="ptldebug"/>
+</if>
+<if test="subsystem">
+subsystem: <value-of select="subsystem"/>
+</if>
 <text>
 </text>
 <for-each select="network">
index a735022..8da53f9 100644 (file)
@@ -16,6 +16,7 @@ MOUNT2=${MOUNT2:-"/mnt/lustre2"}
 DIR=${DIR:-$MOUNT}
 DIR2=${DIR2:-$MOUNT1}
 PTLDEBUG=${PTLDEBUG:-0x3f0400}
+SUBSYSTEM=${SUBSYSTEM:-0}
 PDSH=${PDSH:-no_dsh}
 
 MDSDEV=${MDSDEV:-$ROOT/tmp/mds-`hostname`}
index f71e39e..4eaeacd 100644 (file)
@@ -212,5 +212,48 @@ test_8() {
 }
 run_test 8 "double mount setup"
 
+test_9() {
+        # backup the old values of PTLDEBUG and SUBSYSTEM
+        OLDPTLDEBUG=$PTLDEBUG
+        OLDSUBSYSTEM=$SUBSYSTEM
+        
+        # generate new configuration file with lmc --ptldebug and --subsystem
+        PTLDEBUG="trace"
+        SUBSYSTEM="mdc"
+        gen_config
+
+        # check the result of lmc --ptldebug/subsystem
+        start_ost
+        start_mds
+        mount_client $MOUNT
+        [ "`cat /proc/sys/portals/debug`" = "1" ] && \
+           echo "lmc --debug success" || return 1
+        [ "`cat /proc/sys/portals/subsystem_debug`" = "16777216" ] && \
+           echo "lmc --subsystem success" || return 1
+        check_mount || return 41
+        cleanup
+
+        # the new PTLDEBUG/SUBSYSTEM used for lconf --ptldebug/subsystem
+        PTLDEBUG="inode"
+        SUBSYSTEM="mds"
+
+        # check lconf --ptldebug/subsystem overriding lmc --ptldebug/subsystem
+        start_ost
+        start_mds
+        mount_client $MOUNT
+        [ "`cat /proc/sys/portals/debug`" = "2" ] && \
+           echo "lconf --debug overriding success" || return 1
+        [ "`cat /proc/sys/portals/subsystem_debug`" = "33554432" ] && \
+           echo "lconf --subsystem overriding success" || return 1
+        check_mount || return 41
+        cleanup
+
+        # resume the old configuration
+        PTLDEBUG=$OLDPTLDEBUG
+        SUBSYSTEM=$OLDSUBSYSTEM
+        gen_config
+}
+run_test 9 "test --ptldebug and --subsystem for lmc"
+
 
 equals_msg "Done"
index 4c49e83..1ea2be7 100644 (file)
@@ -62,14 +62,18 @@ start() {
     facet=$1
     shift
     active=`facet_active $facet`
-    do_facet $facet $LCONF --select ${facet}_svc=${active}_facet --node ${active}_facet  --ptldebug $PTLDEBUG $@ $XMLCONFIG
+    do_facet $facet $LCONF --select ${facet}_svc=${active}_facet \
+        --node ${active}_facet  --ptldebug $PTLDEBUG --subsystem $SUBSYSTEM \
+        $@ $XMLCONFIG
 }
 
 stop() {
     facet=$1
     active=`facet_active $facet`
     shift
-    do_facet $facet $LCONF --select ${facet}_svc=${active}_facet --node ${active}_facet  --ptldebug $PTLDEBUG $@ --cleanup $XMLCONFIG
+    do_facet $facet $LCONF --select ${facet}_svc=${active}_facet \
+        --node ${active}_facet  --ptldebug $PTLDEBUG --subsystem $SUBSYSTEM \
+        $@ --cleanup $XMLCONFIG
 }
 
 zconf_mount() {
@@ -274,7 +278,8 @@ add_mds() {
     facet=$1
     shift
     rm -f ${facet}active
-    add_facet $facet  --lustre_upcall $UPCALL
+    add_facet $facet  --lustre_upcall $UPCALL --ptldebug $PTLDEBUG \
+        --subsystem $SUBSYSTEM
     do_lmc --add mds --node ${facet}_facet --mds ${facet}_svc $*
 }
 
index 55720f4..06b2069 100755 (executable)
@@ -2171,6 +2171,8 @@ def doHost(lustreDB, hosts):
     lustre_upcall = node_db.get_val('lustreUpcall', '')
     portals_upcall = node_db.get_val('portalsUpcall', '')
     timeout = node_db.get_val_int('timeout', 0)
+    ptldebug = node_db.get_val('ptldebug', '')
+    subsystem = node_db.get_val('subsystem', '')
     
     find_local_clusters(node_db)
     if not is_router:
@@ -2202,8 +2204,8 @@ def doHost(lustreDB, hosts):
             return
 
         sys_set_timeout(timeout)
-        sys_set_ptldebug()
-        sys_set_subsystem()
+        sys_set_ptldebug(ptldebug)
+        sys_set_subsystem(subsystem)
         sys_set_lustre_upcall(lustre_upcall)
         sys_set_portals_upcall(portals_upcall)
 
@@ -2225,8 +2227,8 @@ def doHost(lustreDB, hosts):
         for_each_profile(node_db, prof_list, doModules)
 
         sys_set_debug_path()
-        sys_set_ptldebug()
-        sys_set_subsystem()
+        sys_set_ptldebug(ptldebug)
+        sys_set_subsystem(subsystem)
         script = config.gdb_script
         run(lctl.lctl, ' modules >', script)
         if config.gdb:
@@ -2335,20 +2337,24 @@ def sys_tweak_socknal ():
 def sys_optimize_elan ():
         run ("echo 0 > /proc/elan/config/eventint_punt_loops")
 
-def sys_set_ptldebug():
-    if config.ptldebug != None:
+def sys_set_ptldebug(ptldebug):
+    if config.ptldebug:
+        ptldebug = config.ptldebug
+    if ptldebug:
         try:
-            val = eval(config.ptldebug, ptldebug_names)
-            val = "0x%x" % (val,)
+            val = eval(ptldebug, ptldebug_names)
+            val = "0x%x" % (val)
             sysctl('portals/debug', val)
         except NameError, e:
             panic(str(e))
 
-def sys_set_subsystem():
-    if config.subsystem != None:
+def sys_set_subsystem(subsystem):
+    if config.subsystem:
+        subsystem = config.subsystem
+    if subsystem:
         try:
-            val = eval(config.subsystem, subsystem_names)
-            val = "0x%x" % (val,)
+            val = eval(subsystem, subsystem_names)
+            val = "0x%x" % (val)
             sysctl('portals/subsystem_debug', val)
         except NameError, e:
             panic(str(e))
index 62afbbc..8e2baf0 100755 (executable)
@@ -55,6 +55,8 @@ Object creation command summary:
   --upcall path
   --lustre_upcall path
   --portals_upcall path
+  --ptldebug debug_level
+  --subsystem subsystem_name
 
 --add net
   --node node_name
@@ -134,6 +136,8 @@ lmc_options = [
     ('upcall', "Set both lustre and portals upcall scripts.", PARAM),
     ('lustre_upcall', "Set location of lustre upcall script.", PARAM),
     ('portals_upcall', "Set location of portals upcall script.", PARAM),
+    ('ptldebug', "Set the portals debug level",  PARAM),
+    ('subsystem', "Specify which Lustre subsystems have debug output recorded in the log",  PARAM),
 
     # network 
     ('nettype', "Specify the network type. This can be tcp/elan/gm/scimac.", PARAM),
@@ -560,6 +564,10 @@ def set_node_options(gen, node, options):
             gen.addElement(node, 'portalsUpcall', options.portals_upcall)
         else:
             gen.addElement(node, 'portalsUpcall', default_upcall)
+    if options.ptldebug:
+        gen.addElement(node, "ptldebug", get_option(options, 'ptldebug'))
+    if options.subsystem:
+        gen.addElement(node, "subsystem", get_option(options, 'subsystem'))
     return node
 
 def do_add_node(gen, lustre,  options, node_name):