[Ocfs2-tools-devel] [PATCH 1/2] odump.py: Error message cleanup
jeff.liu
jeff.liu at oracle.com
Wed Aug 19 20:02:03 PDT 2009
sob.
Sunil Mushran 写道:
> Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
> ---
> ADDONS/odump.py | 22 +++++++++++-----------
> 1 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/ADDONS/odump.py b/ADDONS/odump.py
> index 69b1a24..563acaa 100755
> --- a/ADDONS/odump.py
> +++ b/ADDONS/odump.py
> @@ -215,7 +215,7 @@ def getOCFS2Payload(plist, func):
> if len(vlist) > 0:
> pdict[vlist[0].strip()] = vlist[1:]
> except KeyError, ValueError:
> - raise("OOP!!! while parsing payload block")
> + raise("OOPS! while parsing payload block")
>
> if plist[-1].strip().startswith('oldseq'):
> pdict['OVR2'] = plist[-1].strip()
> @@ -607,7 +607,7 @@ def FSResponseMsg(odict, fmtstr=' '):
> def option_parse():
> ''' options parser '''
>
> - usage_str = 'Usage: %prog [-f <filename>] [-o <filename>] [-t <type>] [-Lv] \n' \
> + usage_str = 'Usage: %prog [-f <tcpdump capture file>] [-o <outfile>] [-t <type>] [-Lv] \n' \
> ' or: cat ocfs2_log_file | %prog [-t <type>] [-Lv] >> file \n' \
> 'Parse standard input to FILE, and also to standard output. \n' \
> 'message type present, only the specified kind of o2net message will be parsing.\n\n' \
> @@ -618,32 +618,32 @@ def option_parse():
>
> p.add_option('-f', '--file',
> dest='file',
> - help="ocfs2 packets file captured by wireshark",
> + help="Tcpdump capture file",
> default=None,
> )
>
> p.add_option('-o', '--output',
> dest='output',
> - help="output file, print to standard output by default",
> + help="Output file (defaults to stdout)",
> default=None,
> )
>
> p.add_option('-t', '--type',
> dest='type',
> - help="o2net message type, dumping all kinds of o2net messages by default",
> + help="O2NET message type (defaults to all message types)",
> default="all",
> )
>
> p.add_option('-L', '--print-lvb',
> dest='dumplvb',
> - help="turn on LVB printing, do not print LVB by default",
> + help="Enable LVB printing (disabled by default)",
> default=False,
> action='store_true',
> )
>
> p.add_option('-v', '--verbose',
> dest='verbose',
> - help="Enable printing of status messages to stdout, disabled by default",
> + help="Enable printing of status messages to stdout (disabled by default)",
> default=False,
> action='store_true',
> )
> @@ -659,7 +659,7 @@ def getfh(srcfile, dstfile):
> try:
> sfp = open(srcfile, 'r')
> except IOError:
> - print 'Open ocfs2 log file: %s failed\n' % srcfile
> + print 'Error: Unable to open %s\n' % srcfile
> sys.exit(1)
>
> if dstfile is None:
> @@ -668,7 +668,7 @@ def getfh(srcfile, dstfile):
> try:
> dfp = open(dstfile, 'w')
> except IOError:
> - print 'Open %s for write faild\n' % dstfile
> + print 'Error: Unable to open %s\n' % dstfile
> sys.exit(1)
>
> return sfp, dfp
> @@ -713,7 +713,7 @@ def main(srcfile, dstfile, o2type, dumplvb, verbose):
> try:
> magic, type = ocfs2dict['magic'], ocfs2dict['type']
> except KeyError:
> - raise 'No MAGIC: %s or TYPE: %s FOUND' % (magic, type)
> + raise 'No magic: %s or type: %s found' % (magic, type)
>
> magicABB = NAME_IN_SHORT(MAGIC, magic)
> typeABB = NAME_IN_SHORT(TYPE, type)
> @@ -749,7 +749,7 @@ def main(srcfile, dstfile, o2type, dumplvb, verbose):
> else:
> o2msgstr = globals()[func](ocfs2payload)
> except KeyError: # DLM message do not support encountered
> - sys.stderr.write('can not handle %s Message' % func)
> + sys.stderr.write('Error: Unknown message %s\n' % func)
>
> try:
> o2header = ocfs2dict['o2header']
>
More information about the Ocfs2-tools-devel
mailing list