Bug 1265660

Summary: Traceback during profile selection in inactive tuned
Product: Red Hat Enterprise Linux 7 Reporter: Tereza Cerna <tcerna>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Tereza Cerna <tcerna>
Severity: medium Docs Contact:
Priority: urgent    
Version: 7.3CC: asadawar, fkrska, jeder, jscotka, jskarvad, mkolaja, mnapolis, ovasik, psklenar, rpiddapa, tcerna
Target Milestone: rcKeywords: EasyFix, Patch, Reproducer, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.5.1-7.el7 Doc Type: Bug Fix
Doc Text:
Cause: Previously there was an typo in the tuned-adm code regarding automatic daemon restart. Consequence: If tuned-adm command was run and if it found out that tuned daemon is not running, it tried to restart it, but this attempt failed with the traceback. If tuned daemon was running (the default, expected state), everything worked as expected. Also daemon restarts through systemd worked as expected. Fix: The tuned-adm code was fixed. Result: Now the tuned daemon restart attempt performed by tuned-adm doesn't end with traceback.
Story Points: ---
Clone Of:
: 1305903 (view as bug list) Environment:
Last Closed: 2016-11-04 07:25:25 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: 1305903    

Description Tereza Cerna 2015-09-23 12:38:13 UTC
There is traceback during profile selection if service tuned is inactive.

Reproducer:

# rpm -q tuned
tuned-2.5.1-3.el7.noarch

# systemctl status tuned | grep Active
   Active: active (running) since St 2015-09-23 12:36:15 CEST; 1s ago

# vim /etc/tuned/tuned-main.conf
# cat /etc/tuned/tuned-main.conf
daemon = 0
dynamic_tuning = 0
sleep_interval = 1
update_interval = 10
recommend_command = 1

# systemctl restart tuned

# systemctl status tuned | grep Active
   Active: inactive (dead) since St 2015-09-23 12:28:20 CEST; 5min ago

# tuned-adm profile balanced
Cannot talk to Tuned daemon via DBus. Is Tuned daemon running?
Trying to (re)start tuned...
Traceback (most recent call last):
  File "/usr/sbin/tuned-adm", line 72, in <module>
    result = action(**options)
  File "/usr/lib/python2.7/site-packages/tuned/admin/admin.py", line 80, in profile
    if retcode == 0:
NameError: global name 'retcode' is not defined

Comment 2 Jaroslav Škarvada 2015-09-23 12:43:08 UTC
It's already fixed in upstream commit:
https://git.fedorahosted.org/cgit/tuned.git/commit/?id=7b4596ba21893f12181630d73d6ec99f447104bc

Comment 3 Jaroslav Škarvada 2015-12-04 12:59:55 UTC
*** Bug 1288483 has been marked as a duplicate of this bug. ***

Comment 15 Tereza Cerna 2016-06-30 08:57:10 UTC
Verified in tuned-2.6.0-1.20160621gitb85e9c21.el7.noarch -> PASS

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Command 'systemctl status tuned | grep Active | grep 'active (running)'' (Expected 0, got 0)
:: [   PASS   ] :: Command 'cat /etc/tuned/tuned-main.conf | grep 'daemon = 0'' (Expected 0, got 0)
:: [   LOG    ] :: rlServiceStart: Service tuned started successfully
:: [   PASS   ] :: Command 'systemctl status tuned | grep Active | grep 'inactive (dead)'' (Expected 0, got 0)
:: [   PASS   ] :: Command 'tuned-adm profile balanced' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 1s
:: [   LOG    ] :: Assertions: 4 good, 0 bad
:: [   PASS   ] :: RESULT: Test


Reproduced in tuned-2.5.1-4.el7.noarch -> FAIL

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Command 'systemctl status tuned | grep Active | grep 'active (running)'' (Expected 0, got 0)
:: [   PASS   ] :: Command 'cat /etc/tuned/tuned-main.conf | grep 'daemon = 0'' (Expected 0, got 0)
:: [   LOG    ] :: rlServiceStart: Service tuned started successfully
:: [   PASS   ] :: Command 'systemctl status tuned | grep Active | grep 'inactive (dead)'' (Expected 0, got 0)
:: [   FAIL   ] :: Command 'tuned-adm profile balanced' (Expected 0, got 3)
:: [   LOG    ] :: Duration: 2s
:: [   LOG    ] :: Assertions: 3 good, 1 bad
:: [   FAIL   ] :: RESULT: Test

Comment 17 errata-xmlrpc 2016-11-04 07:25:25 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://rhn.redhat.com/errata/RHBA-2016-2479.html