Bug 1251507 - restore_elevator function from /usr/lib/tuned/functions doesn't work correctly
restore_elevator function from /usr/lib/tuned/functions doesn't work correctly
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tuned (Show other bugs)
7.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Jaroslav Škarvada
Tereza Cerna
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-07 10:33 EDT by Cameron Ortiz
Modified: 2016-11-04 03:23 EDT (History)
4 users (show)

See Also:
Fixed In Version: tuned-2.7.0-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-04 03:23:56 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
sample tuned profile (tuned.conf and script.sh) (323 bytes, application/x-gzip)
2015-08-07 10:33 EDT, Cameron Ortiz
no flags Details

  None (edit)
Description Cameron Ortiz 2015-08-07 10:33:14 EDT
Created attachment 1060380 [details]
sample tuned profile (tuned.conf and script.sh)

Description of problem:

When trying to use the set_elevator and restore_elevator functions in script for a custom tuned policy, the restore_elevator function is unable to correctly reset the elevator.


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

tuned-2.4.1-1.el7.noarch

How reproducible: Easily


Steps to Reproduce:
1. Make sure the ioscheduler on a given device is set to deadline or noop:
# echo deadline > /sys/block/xvda/queue/scheduler
2. Move the test profile (attached as testprofile.tgz) into /etc/tuned.  This should contain 2 files:
/etc/tuned/testprofile/tuned.conf
/etc/tuned/testprofile/script.sh
3. Switch to the testprofile and you will see that the io schedule is changed to cfq:
# tuned-adm profile testprofile
# cat /sys/block/xvda/queue/scheduler
4. Turn off tuned or switch to a different profile and you will see that the ioscheduler has not been changed back:
# tuned-adm off
# cat /sys/block/xvda/queue/scheduler

Actual results:
The io scheduler is not reverted back when the restore_elevator function is used.

Expected results:
The io scheduler should be reverted back to what was previously set.

Additional info:
Looking into this further I can see that the set_elevator function is creating the following file:

# cat /run/tuned/elevator_xvda.save
noop [deadline] cfq

This is then being echoed into /sys/block/xvda/queue/scheduler which is failing:

write error: Invalid argument
Comment 2 Jaroslav Škarvada 2015-08-21 10:37:52 EDT
Thanks for report.

It is fixed by the following upstream commit:
https://git.fedorahosted.org/cgit/tuned.git/commit/?id=04c5222abcb46fef9ba337f279396cd13d711faa

You can also use tuned.conf functionality for this task (recommended). In fact the "functions" library is there for backward compatibility. E.g. tuned.conf content:

[disk_xvda]
type=disk
devices=xvda
elevator=cfq
Comment 4 Tereza Cerna 2016-08-22 02:22:09 EDT
============================
Verified in:
    tuned-2.7.1-2.el7.noarch
PASS
============================

# echo deadline > /sys/block/sda/queue/scheduler
# cat /sys/block/sda/queue/scheduler 
noop [deadline] cfq 
# tuned-adm profile testprofile
# cat /sys/block/sda/queue/scheduler 
noop deadline [cfq] 
# tuned-adm off
# cat /sys/block/sda/queue/scheduler 
noop [deadline] cfq 

============================
Reproduced in:
    tuned-2.4.1-1.el7.noarch
FAIL
============================

# echo deadline > /sys/block/sda/queue/scheduler
# cat /sys/block/sda/queue/scheduler 
noop [deadline] cfq 
# tuned-adm profile testprofile
# cat /sys/block/sda/queue/scheduler 
noop deadline [cfq] 
# tuned-adm off
# cat /sys/block/sda/queue/scheduler 
noop deadline [cfq]
Comment 6 errata-xmlrpc 2016-11-04 03:23:56 EDT
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

Note You need to log in before you can comment on or make changes to this bug.