Bug 622407

Summary: cluster plugin throws exception when asking for lockdump
Product: Red Hat Enterprise Linux 6 Reporter: David Kutálek <dkutalek>
Component: sosAssignee: Adam Stokes <astokes>
Status: CLOSED ERRATA QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: agk, ahecox, bmr, gavin, prc, tcapek
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sos-2.2-3.el6 Doc Type: Bug Fix
Doc Text:
When the non-default lockdump feature was turned on, the cluster plug-in terminated with a traceback while sos was generating a report. This bug has been fixed, lockdump data are now present in reports and the cluster plug-in gives no error messages in the described scenario.
Story Points: ---
Clone Of: 586450 Environment:
Last Closed: 2011-05-19 14:27:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 586450    
Bug Blocks: 580448    

Description David Kutálek 2010-08-09 09:12:53 UTC
+++ This bug was initially created as a clone of Bug #586450 +++

Description of problem:

Cluster plugin still contains a bug, which manifests itself only when explicitly turning lockdump on:

---
# sosreport --batch -o cluster -k cluster.lockdump

sosreport (version 2.2)

This utility will collect some detailed  information about the
hardware and setup of your Red Hat Enterprise Linux system.
The information is collected and an archive is  packaged under
/tmp, which you can send to a support representative.
Red Hat Enterprise Linux will use this information for diagnostic purposes ONLY
and it will be considered confidential information.

This process may take a while to complete.
No changes will be made to your system.


Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 700, in sosreport
    plug.setup()
  File "/usr/lib/python2.6/site-packages/sos/plugins/cluster.py", line 255, in setup
    if self.getOption('lockdump'): self.do_lockdump()
UnboundLocalError: local variable 'regex' referenced before assignment
  Running plugins. Please wait ...

  Completed [1/1] ...      
Creating compressed archive...

Your sosreport has been generated and saved in:
  /tmp/sosreport-timothy-20100809110734-6e06.tar.xz

The md5sum is: 948a51371b987e37ab32008edd656e06

Please send this file to your support representative.

---

Looking into source, it seems RHEL version 6 case is not covered in
do_lockdump(self) in /usr/lib/python2.6/site-packages/sos/plugins/cluster.py:

    def do_lockdump(self):
        status, output, time= self.callExtProg("cman_tool services")
        if status:
            # command somehow failed
            return False

        rhelver = self.policy().rhelVersion()

        if rhelver == "4":
            regex = r'^DLM Lock Space:\s*"([^"]*)".*$'
        elif rhelver == "5Server" or rhelver == "5Client":
            regex = r'^dlm\s+[^\s]+\s+([^\s]+)\s.*$'

        reg=re.compile(regex,re.MULTILINE)
        for lockspace in reg.findall(output):
           ret, out, time = self.callExtProg("echo %s >
/proc/cluster/dlm_locks" % lockspace)
           self.collectOutputNow("cat /proc/cluster/dlm_locks", root_symlink =
"dlm_locks_%s" % lockspace)

---

Version-Release number of selected component (if applicable):

sos-2.2-2.el6

How reproducible:

Always when "cman_tool services" runs successfully.
You can create a simple script in /usr/local/bin/cman_tool to simulate:

#!/bin/bash
true

Steps to Reproduce:
1. install or prepare cman_tool as described above
2. run sosreport --batch -o cluster -k cluster.lockdump

Actual results:

---
# sosreport --batch -o cluster -k cluster.lockdump

sosreport (version 2.2)

This utility will collect some detailed  information about the
hardware and setup of your Red Hat Enterprise Linux system.
The information is collected and an archive is  packaged under
/tmp, which you can send to a support representative.
Red Hat Enterprise Linux will use this information for diagnostic purposes ONLY
and it will be considered confidential information.

This process may take a while to complete.
No changes will be made to your system.


Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 700, in sosreport
    plug.setup()
  File "/usr/lib/python2.6/site-packages/sos/plugins/cluster.py", line 255, in setup
    if self.getOption('lockdump'): self.do_lockdump()
UnboundLocalError: local variable 'regex' referenced before assignment
  Running plugins. Please wait ...

  Completed [1/1] ...      
Creating compressed archive...

Your sosreport has been generated and saved in:
  /tmp/sosreport-timothy-20100809110734-6e06.tar.xz

The md5sum is: 948a51371b987e37ab32008edd656e06

Please send this file to your support representative.
---

Expected results:

There should be no exception like this and lockdump data should be present in report.

Additional info:

See Bug #586450 for history of this bug.

Comment 9 Tomas Capek 2011-05-18 14:51:14 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When the non-default lockdump feature was turned on, the cluster plug-in terminated with a traceback while sos was generating a report. This bug has been fixed, lockdump data are now present in reports and the cluster plug-in gives no error messages in the described scenario.

Comment 10 errata-xmlrpc 2011-05-19 14:27:33 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0773.html