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 1369791

Summary: Tracebacks in realtime-virtual* profiles
Product: Red Hat Enterprise Linux 7 Reporter: Tereza Cerna <tcerna>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Tereza Cerna <tcerna>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: jeder, jskarvad, psklenar
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.8.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1372298 (view as bug list) Environment:
Last Closed: 2017-08-01 12:32:51 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:
Bug Depends On:    
Bug Blocks: 1372298, 1400961    
Attachments:
Description Flags
log of `tuned-adm profile`
none
log of `tuned-adm verify` none

Description Tereza Cerna 2016-08-24 12:14:23 UTC
Description of problem:
  Two tracebacks were appeared during testing of realtime profiles. First was generated in /var/log/tuned/tuned.log by command `tuned-adm verify` on realtime-virtual* profiles. 

  Second traceback was created when some realtime-virtual* profile was active and user decided to select other profile.

  Problem exists for all realtime profiles (realtime, realtime-virtual-host, realtime-virtual-guest)


Version-Release number of selected component (if applicable):
  tuned-2.7.1-2.el7.noarch
  tuned-profiles-nfv-2.7.1-2.el7.noarch
  qemu-kvm-tools-rhev-2.3.0-31.el7_2.21.x86_64


Steps to Reproduce:
  # systemctl status tuned | grep Active
     Active: active (running) since Wed 2016-08-24 07:00:50 CEST; 35min ago
  # tuned-adm profile realtime-virtual-host
  # tuned-adm verify

  >>> see traceback in /var/log/tuned/tuned.log 
2016-08-24 12:07:20,902 ERROR    tuned.plugins.plugin_script: script '/usr/lib/tuned/realtime/script.sh' error: 1, 'Traceback (most recent call last):
  File "/usr/bin/tuna", line 656, in <module>
    main()
  File "/usr/bin/tuna", line 493, in main
    (op, a) = pick_op(a)
  File "/usr/bin/tuna", line 408, in pick_op
    if argument[0] in ('+', '-'):
IndexError: string index out of range'

  # tuned-adm profile balanced

  >>> see traceback in /var/log/tuned/tuned.conf
2016-08-24 12:07:52,299 ERROR    tuned.plugins.plugin_script: script '/usr/lib/tuned/realtime-virtual-host/script.sh' error: 1, 'Traceback (most recent call last):
  File "/usr/bin/tuna", line 656, in <module>
    main()
  File "/usr/bin/tuna", line 494, in main
    op_list = tuna.cpustring_to_list(a)
  File "/usr/lib/python2.7/site-packages/tuna/tuna.py", line 124, in cpustring_to_list
    ends = [ int(a, 0) for a in field.split("-") ]
ValueError: invalid literal for int() with base 0: '}''

 
Actual results:
  two tracebacks was appeared in /var/log/tuned/tuned.conf

Expected results:
  no tracebacks


Additional info for QA:
  sheep-50, pes-guest-87, pes-guest-89 - machines to reproduce 
  (scheduled with tps profile rhel-7-server-nfv)

Comment 1 Tereza Cerna 2016-08-24 12:15:01 UTC
Created attachment 1193617 [details]
log of `tuned-adm profile`

Comment 2 Tereza Cerna 2016-08-24 12:15:23 UTC
Created attachment 1193618 [details]
log of `tuned-adm verify`

Comment 3 Tereza Cerna 2016-08-24 12:29:23 UTC
The same reproducer, but another traceback. 

Traceback was created when some realtime-virtual* profile was active and user decided to select other profile.

Reproducer:
# tuned-adm profile realtime-virtual-guest
# tuned-adm profile balanced
# less /var/log/tuned/tuned.log
...
2016-08-24 08:18:56,088 ERROR    tuned.plugins.plugin_script: script '/usr/lib/tuned/realtime-virtual-host/script.sh' error: 1, 'Traceback (most recent call last):
  File "/usr/libexec/tuned/defirqaffinity.py", line 93, in <module>
    mask = mask | 1 << int(i);
ValueError: invalid literal for int() with base 10: '}''
...

# rpm -q tuned tuned-profiles-nfv qemu-kvm-tools-rhev
tuned-2.7.1-2.el7.noarch
tuned-profiles-nfv-2.7.1-2.el7.noarch
qemu-kvm-tools-rhev-2.3.0-31.el7_2.21.x86_64


Additional info for QA:
  dell-pe-fm120-2c and 1minutetip machines (qemu-kvm-tools-rhel and nfv were installed manually from brew)

Comment 5 Tereza Cerna 2016-08-25 05:37:14 UTC
My fault. There is mistake in Desctiption #0.

Problem exists only for realtime-virtual-* profiles:
  - realtime-virtual-host
  - realtime-virtual-guest

Comment 6 Jaroslav Škarvada 2016-08-26 11:36:27 UTC
I will take a look, but it's probably minor problem. You need to setup "isolated_cores" in: "/etc/tuned/realtime-virtual-host-variables.conf" and "/etc/tuned/realtime-virtual-guest-variables.conf" to sane values and your machine needs to be multicore with enough cores to satisfy your request. One backtrace is even from the Tuna tool, so you could also open bug against Tuna to cleanly exit instead of traceback if invalid cpustring is provided (e.g. '}'). Nevertheless, the Tuned profile should be fixed not to traceback.

Also from the log you provided:
2016-08-24 12:07:51,484 ERROR    tuned.utils.polkit: error querying polkit: Unable to guess signature from an empty dict
2016-08-24 12:07:51,487 WARNING  tuned.exports.dbus_exporter: polkit error, but action 'com.redhat.tuned.switch_profile' requested by caller ':1.104' was successfully authorized by fallback method

This is unrelated to this bug, but bad. It means polkit is not working. Are you using the latest selinux policy, i.e. newer than selinux-policy-3.13.1-81.el7?

Comment 7 Tereza Cerna 2016-09-01 08:48:46 UTC
Also I found another tracebacks in profile realtime-virtual-guest.

Reproducer:

# tuned-adm active
Current active profile: balanced
# tuned-adm profile realtime-virtual-guest

>>> See in /var/log/tuned/tuned.log
2016-09-01 04:45:30,259 ERROR    tuned.plugins.plugin_script: script '/usr/lib/tuned/realtime-virtual-guest/script.sh' error: 1, 'Traceback (most recent call last):
  File "/usr/libexec/tuned/defirqaffinity.py", line 108, in <module>
    interruptdirs = [ f for f in os.listdir(irqpath) if os.path.isdir(join(irqpath,f)) ]
NameError: name 'join' is not defined'

# tuned-adm verify
Verification failed, current system settings differ from the preset profile.
You can mostly fix this by Tuned restart, e.g.:
  service tuned restart
Sometimes (if some plugins like bootloader are used) also reboot is required.
See tuned log file ('/var/log/tuned/tuned.log') for details.

>>> See in /var/log/tuned/tuned.log
2016-09-01 04:46:56,957 ERROR    tuned.plugins.plugin_script: script '/usr/lib/tuned/realtime-virtual-guest/script.sh' error: 1, 'Traceback (most recent call last):
  File "/usr/libexec/tuned/defirqaffinity.py", line 98, in <module>
    verify(mask)
  File "/usr/libexec/tuned/defirqaffinity.py", line 62, in verify
    interruptdirs = [ f for f in os.listdir(irqpath) if os.path.isdir(join(irqpath,f)) ]
NameError: global name 'join' is not defined'
2016-09-01 04:46:56,957 ERROR    tuned.plugins.plugin_script: verify: failed: '['/usr/lib/tuned/realtime/script.sh', u'/usr/lib/tuned/realtime-virtual-guest/script.sh']'

Comment 8 Jaroslav Škarvada 2016-09-01 11:07:53 UTC
(In reply to Tereza Cerna from comment #7)
> Also I found another tracebacks in profile realtime-virtual-guest.
> 
> Reproducer:
> 
> # tuned-adm active
> Current active profile: balanced
> # tuned-adm profile realtime-virtual-guest
> 
> >>> See in /var/log/tuned/tuned.log
> 2016-09-01 04:45:30,259 ERROR    tuned.plugins.plugin_script: script
> '/usr/lib/tuned/realtime-virtual-guest/script.sh' error: 1, 'Traceback (most
> recent call last):
>   File "/usr/libexec/tuned/defirqaffinity.py", line 108, in <module>
>     interruptdirs = [ f for f in os.listdir(irqpath) if
> os.path.isdir(join(irqpath,f)) ]
> NameError: name 'join' is not defined'
> 
> # tuned-adm verify
> Verification failed, current system settings differ from the preset profile.
> You can mostly fix this by Tuned restart, e.g.:
>   service tuned restart
> Sometimes (if some plugins like bootloader are used) also reboot is required.
> See tuned log file ('/var/log/tuned/tuned.log') for details.
> 
> >>> See in /var/log/tuned/tuned.log
> 2016-09-01 04:46:56,957 ERROR    tuned.plugins.plugin_script: script
> '/usr/lib/tuned/realtime-virtual-guest/script.sh' error: 1, 'Traceback (most
> recent call last):
>   File "/usr/libexec/tuned/defirqaffinity.py", line 98, in <module>
>     verify(mask)
>   File "/usr/libexec/tuned/defirqaffinity.py", line 62, in verify
>     interruptdirs = [ f for f in os.listdir(irqpath) if
> os.path.isdir(join(irqpath,f)) ]
> NameError: global name 'join' is not defined'
> 2016-09-01 04:46:56,957 ERROR    tuned.plugins.plugin_script: verify:
> failed: '['/usr/lib/tuned/realtime/script.sh',
> u'/usr/lib/tuned/realtime-virtual-guest/script.sh']'

Upstream fix:
https://git.fedorahosted.org/cgit/tuned.git/commit/?id=f8653592e1e7109a6599e8afd08903398968acfe

Comment 9 Jaroslav Škarvada 2016-09-01 11:20:22 UTC
(In reply to Jaroslav Škarvada from comment #8)
> (In reply to Tereza Cerna from comment #7)
> > Also I found another tracebacks in profile realtime-virtual-guest.
> > 
> > Reproducer:
> > 
> > # tuned-adm active
> > Current active profile: balanced
> > # tuned-adm profile realtime-virtual-guest
> > 
> > >>> See in /var/log/tuned/tuned.log
> > 2016-09-01 04:45:30,259 ERROR    tuned.plugins.plugin_script: script
> > '/usr/lib/tuned/realtime-virtual-guest/script.sh' error: 1, 'Traceback (most
> > recent call last):
> >   File "/usr/libexec/tuned/defirqaffinity.py", line 108, in <module>
> >     interruptdirs = [ f for f in os.listdir(irqpath) if
> > os.path.isdir(join(irqpath,f)) ]
> > NameError: name 'join' is not defined'
> > 
> > # tuned-adm verify
> > Verification failed, current system settings differ from the preset profile.
> > You can mostly fix this by Tuned restart, e.g.:
> >   service tuned restart
> > Sometimes (if some plugins like bootloader are used) also reboot is required.
> > See tuned log file ('/var/log/tuned/tuned.log') for details.
> > 
> > >>> See in /var/log/tuned/tuned.log
> > 2016-09-01 04:46:56,957 ERROR    tuned.plugins.plugin_script: script
> > '/usr/lib/tuned/realtime-virtual-guest/script.sh' error: 1, 'Traceback (most
> > recent call last):
> >   File "/usr/libexec/tuned/defirqaffinity.py", line 98, in <module>
> >     verify(mask)
> >   File "/usr/libexec/tuned/defirqaffinity.py", line 62, in verify
> >     interruptdirs = [ f for f in os.listdir(irqpath) if
> > os.path.isdir(join(irqpath,f)) ]
> > NameError: global name 'join' is not defined'
> > 2016-09-01 04:46:56,957 ERROR    tuned.plugins.plugin_script: verify:
> > failed: '['/usr/lib/tuned/realtime/script.sh',
> > u'/usr/lib/tuned/realtime-virtual-guest/script.sh']'
> 
> Upstream fix:
> https://git.fedorahosted.org/cgit/tuned.git/commit/
> ?id=f8653592e1e7109a6599e8afd08903398968acfe

There is new bugzilla regarding this specific traceback, bug 1372298.

Comment 11 Jaroslav Škarvada 2017-03-30 14:51:18 UTC
It should be all fixed in upstream.

Comment 13 Tereza Cerna 2017-05-30 13:04:03 UTC
Tested in:
    tuned-2.8.0-3.el7
    tuned-profiles-realtime-2.8.0-3.el7
    tuned-profiles-nfv-host-2.8.0-3.el7
    tuned-profiles-nfv-guest-2.8.0-3.el7

No traceback in new version of tuned -> VERIFIED.

Comment 14 errata-xmlrpc 2017-08-01 12:32:51 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:2102