Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1444641

Summary: virsh plugin uncaught exception when unable to connect to the hypervisor
Product: Red Hat Enterprise Linux 7 Reporter: Pavel Moravec <pmoravec>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Miroslav HradĂ­lek <mhradile>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: agk, bmr, gavin, mhradile, plambri, sbradley
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
URL: https://github.com/sosreport/sos/pull/997
Whiteboard:
Fixed In Version: sos-3.4-3.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 23:10:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Moravec 2017-04-23 14:22:02 UTC
Description of problem:
When virsh -r <subcommand> fails to connect to the hypervisor, and virsh plugin is enabled in sosreport, then it produces backtrace:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1252, in setup
    plug.setup()
  File "/usr/lib/python2.7/site-packages/sos/plugins/virsh.py", line 59, in setup
    pos = k_lines[0].split().index('Name')
ValueError: 'Name' is not in list

Reason:
 53         for k in ['net', 'nwfilter', 'pool']:
 54             self.add_cmd_output('%s %s-list' % (cmd, k))
 55             k_file = self.get_cmd_output_now('%s %s-list' % (cmd, k))
 56             if k_file:
 57                 k_lines = open(k_file, 'r').read().splitlines()
 58                 # the 'name' column position changes between virsh cmds
 59                 pos = k_lines[0].split().index('Name')

cmd on line 54 calls virsh that returns the failure:

['error: failed to connect to the hypervisor', "error: Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro': No such file or directory", '']

that does not contain 'Name' substring either where.


Version-Release number of selected component (if applicable):
sos-3.4-2.el7.noarch


How reproducible:
100%


Steps to Reproduce:
1. Switch off libvirt hypervisor / in some other means, cause the "virsh -r net-list" command generates the above error.
2. sosreport --batch -o virsh


Actual results:
caught exception in plugin method "virsh.setup()"
writing traceback to sos_logs/virsh-plugin-errors.txt
..
and the virsh-plugin-errors.txt has:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1252, in setup
    plug.setup()
  File "/usr/lib/python2.7/site-packages/sos/plugins/virsh.py", line 59, in setup
    pos = k_lines[0].split().index('Name')
ValueError: 'Name' is not in list


Expected results:
no such error


Additional info:

Comment 2 Pavel Moravec 2017-04-25 15:12:25 UTC
In fact this is a regression: current sos-3.3-5.el7_3.noarch does not generate the traceback / exception, in the same situation.

Comment 6 errata-xmlrpc 2017-08-01 23:10:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2203