1
0
Fork 0
Commit graph

60 commits

Author SHA1 Message Date
Jaroslav Škarvada
bd6697f8f4
profiles: fix loading multiple profiles if there are repeating profiles
The original idea behind this patch is credited to
Jiří Mencák <jmencak@redhat.com>.

Resolves: rhbz#1825882

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2021-06-09 11:00:18 +02:00
Jaroslav Škarvada
78df85affe
Merge branch 'master' into project-rename 2021-06-03 17:20:55 +02:00
Jaroslav Škarvada
871e68bea1
tests: added rlRun python detect description to beaker test
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2021-06-03 16:08:55 +02:00
Jaroslav Škarvada
4f1901991e
ci: fixed RHEL-8
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2021-06-03 01:22:41 +02:00
Jaroslav Škarvada
49b74a8b56
ci: beakerlib tests fixes
Switch from the deprecated execution method.
Fix for the bz1798183-RFE-support-post-loaded-profile beakerlib test.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2021-05-20 14:54:45 +02:00
Jaroslav Škarvada
16d4acbaca
Project renamed to TuneD
The 'D' is now capital to clarify pronunciation.

DBus service name is kept as '/Tuned' not to break
backward compatibility.

This will also need update of downstream tests
which rely on the specific output strings containing
the name.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2021-05-17 22:09:02 +02:00
Jaroslav Škarvada
89e670c80a
Fixed building on RHEL-7/CentOS 7
Also fixed building with python-2.7.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2020-06-19 11:15:12 +02:00
Ondřej Lysoněk
4f5f35830a Add support for a post-loaded profile
This is a minimal viable implementation of a post-loaded profile
feature. It was implemented to satisfy the needs of the
kernel_settings Ansible role.
https://github.com/linux-system-roles/kernel_settings

This feature allows us to apply a profile in a way that is
somewhat separate from the way profiles from the active_profile file
are applied. Namely, the post-loaded profile is always applied after
all the profiles from the active_profile (or more precisely, the
post-loaded profile is always put to the tail of the profile chain
when merging). Also, the post-loaded profile setting is not affected
by running 'tuned-adm profile <some profile>' - the post-loaded
profile remains applied.

The name of the post-loaded profile is stored in
/etc/tuned/post_loaded_profile.

The lack of support for multiple post-loaded profiles was more or less
an arbitrary decision. There are no problems with it, as far as I can
see. However, there is currently no use case for multiple post-loaded
profiles, so I decided to make things easier for our future selves -
it's one less thing to worry about if we need to make changes to the
profile loading logic. We can add support for multiple post-loaded
profiles anytime.

A number of other design decisions went into the
implementation. They are listed here:
https://github.com/redhat-performance/tuned/pull/272

Resolves: rhbz#1798183

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2020-06-01 19:11:29 +02:00
Miro Hrončok
2399aa3b2d Remove usage of unittest2, use unittest from the standard library
Fixes https://github.com/redhat-performance/tuned/issues/241

Fedora is removing the unittest2 package: https://bugzilla.redhat.com/show_bug.cgi?id=1794222

tuned is not targeting Python 2.6: https://github.com/redhat-performance/tuned/issues/241#issuecomment-588320175

One thing not present in Python 2.7 is assertItemsEqual() -- renamed to assertCountEqual().

Related, mock was also listed as a requirement in the spec file,
but all the imports are from unittest.mock, hence removed.
2020-02-25 20:04:51 +01:00
Tomas Korbar
925e7d1764 Stop using Travis
We replaced travis with packit.
Also remove Dockerfile because we do not need it anymore.

Signed-off-by: Tomas Korbar <tkorbar@redhat.com>
2019-12-02 12:20:33 +01:00
Tomas Korbar
140d982354 Replace python flexmock module with builtin mock
Also replace dependency in specfile and alter dockerfile

Signed-off-by: Tomas Korbar <tkorbar@redhat.com>
2019-11-28 07:54:15 +01:00
Petr Šplíchal
e82271a6bb Remove obsolete rhts imports from beakerlib tests 2019-11-20 13:15:58 +01:00
Jaroslav Škarvada
2bafe790be
beakerlib: fixed beakerlib path used in beakerlib test
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2019-11-20 11:56:25 +01:00
Petr Šplíchal
2ca4f84792 Remove extra fmf root, move test under beakerlib 2019-11-20 10:50:16 +01:00
Jaroslav Škarvada
cc974087a0
Merge pull request #212 from pvalena/fix-tmt
Fix packit / TMT tests.
2019-11-19 22:34:18 +01:00
Pavel Valena
2100a53b44 Fix packit / TMT tests. 2019-11-19 18:32:09 -02:00
Jaroslav Škarvada
7623044b58
packit: minor updates
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2019-11-19 19:58:43 +01:00
Jaroslav Škarvada
9841c1250f
beakerlib: added Robin's name and fixed description
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2019-11-18 16:38:01 +01:00
Jaroslav Škarvada
cff78c537c tests: moved tests under directory 'tests'
Also renamed directories to be more consistent.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2019-11-18 16:34:11 +01:00
Ondřej Lysoněk
a9f2b27d30 Rework device handling to avoid races caused by hotplug
This patch fixes (at least) the following race conditions:
1. If a device is attached while iterating assigned devices, the
   MonitorObserver thread can attempt to insert the newly attached
   device to the assigned_devices set while the set is being iterated,
   which results in the following exception:
   RuntimeError: Set changed size during iteration
2. Some devices can be missed when applying a tuning - devices are enumerated
   (i.e., Plugin._init_devices() gets called) before udev device monitoring is
   started (hotplug.Plugin._hardware_events_init() gets called), so devices
   that appear between these two actions are not tuned.
3. Device monitoring is stopped too late, which can result in some tunings
   not being unapplied after stopping a profile. This can happen for devices
   that get added during profile rollback after unit_manager.stop_tuning()
   gets called, but before unit_manager.destroy_all() gets called.
4. It can happen that tuning is applied twice for a device if it is added
   during profile activation, e.g. after unit_manager.create() is called in
   Daemon._thread_code(), but before unit_manager.start_tuning() is called.
   Apart from unnecessarily applying the tuning twice, it can result in
   overwriting saved original settings for the device and hence our inability
   to properly roll back our changes to the settings.
5. The observer thread can attempt to use load_monitor before it's created
   in Plugin._instance_init(), which can result in AttributeError.

Hopefully it doesn't introduce new race conditions :).

The fix is to:
1. rearrange the sequence of certain actions,
2. separate Instance.devices to two separate sets: processed_devices
   and assigned_devices.

   processed_devices are never iterated when the MonitorObserver thread
   is running (*), so the first problem described above cannot happen.
   The set is used to store devices, which have already been tuned.

   The assigned_devices set is now the set of devices that are going
   to be tuned. The set can only be accessed by the main thread.

   (*) Except when verifying tuning - this is fixed in a follow-up patch

I tried to separate the changes into more digestable patches, but I
couldn't figure out how.

Resolves: rhbz#1592743

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2019-03-06 19:52:07 +01:00
Ondřej Lysoněk
32666498ba tests: Fix import of Mapping
Since python3.3, Mapping has been moved to collections.abc and starting
with python3.8, it will no longer be available as collections.Mapping.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
2019-02-19 16:26:27 +01:00
Tomas Korbar
3722b15192 Add range feature for cpu exclusion
- It is now possible to exclude cpu range by !1-3
- Also edited test for cpulist_unpack method to test this new
feature
- Resolves rhbz#1533908
2018-11-21 15:23:11 +01:00
Tomas Korbar
38ebdbeda2 Fix deprecation warnings when python 3 is used
- we should use pyudev.Device class property 'properties'
for accesing device properties
- but we still need to keep try catch workaround
because of old pyudev package which is present in centos
2018-10-15 13:20:14 +02:00
Tomas Korbar
2fad9568f6 Fix test_pickle_provider
- change of default storage file in CommandsTestCase affects this test
- file has been changed also in this test to ensure stable behaviour
2018-10-15 13:20:14 +02:00
Tomas Korbar
d8e319caef Edit InventoryTestCase 2018-10-15 13:20:14 +02:00
Tomas Korbar
db3647ef65 Edit tests for DeviceMatcherUdev class 2018-10-15 13:20:14 +02:00
Tomas Korbar
2b990ac8ac Add Travis and Docker file
- Dockerfile supports builds for both fedora and centos
- This commit will allow us to run tests after each new commit
2018-10-15 13:20:14 +02:00
Tomas Korbar
3319d53a87 Add tests for GlobalConfig class 2018-10-15 13:20:14 +02:00
Tomas Korbar
b4f4e41adc Fix unit tests for Merger class 2018-10-15 13:20:14 +02:00
Tomas Korbar
ca040870b3 Use unittest2 module for unittesting 2018-10-15 13:20:14 +02:00
Tomas Korbar
a2ed07c1af Fix profiles.Loader class tests 2018-10-15 13:20:14 +02:00
Tomas Korbar
2a22bf03e1 Add Plugin class tests 2018-10-15 13:20:14 +02:00
Tomas Korbar
3049600c35 Add Commands class tests 2018-10-15 13:20:14 +02:00
Tomas Korbar
213eca72d8 Add exports Controller class tests 2018-10-15 13:20:14 +02:00
Tomas Korbar
d1051a7e3e Add device matcher udev tests 2018-10-15 13:20:14 +02:00
Tomas Korbar
0245c53ee1 Add Inventory class tests 2018-10-15 13:20:14 +02:00
Tomas Korbar
b09c8d0d37 Start using unittest2 in test_device_matcher 2018-10-15 13:20:14 +02:00
Jaroslav Škarvada
f563c7d756
An attempt to port Tuned to python3 and keeping it python2 compatible
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2017-12-21 10:20:13 +01:00
Evgeni Golov
7f087627ef move DeviceMatcher to hardware 2017-04-18 12:17:42 +02:00
Evgeni Golov
7aafbccb32 profile units are OrderedDicts, not lists
refs #35
2017-04-18 11:53:53 +02:00
Jaroslav Škarvada
c909f7f15a tests: added basic functionality test
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2014-10-17 00:46:53 +02:00
Jan Vcelak
a614c1b54b implement profiles locator class, used by profiles loader 2012-11-07 11:24:49 +01:00
Jan Vcelak
6d48f2099d move DeviceMatcher from profiles to units submodule 2012-10-26 17:59:30 +02:00
Jan Vcelak
ec9c3a53dd profiles: Factory and Merger depend on Loader 2012-10-26 17:59:30 +02:00
Jan Vcelak
69679eaccd profiles.unit: separate properties for type, enabled and replace 2012-10-26 17:59:30 +02:00
Jan Vcelak
fc87b96744 profiles: use Merger object in Loader 2012-10-26 17:59:30 +02:00
Jan Vcelak
123215eaa5 profiles: add Merger class 2012-10-26 17:59:30 +02:00
Jan Vcelak
fd132cf8d0 profiles tests: add device matcher class 2012-10-26 17:59:30 +02:00
Jan Vcelak
89dcad5a19 profiles.loader tests: multiple profiles loading 2012-10-26 17:59:30 +02:00
Jan Vcelak
04d460349b storage tests: check provider property 2012-10-26 17:59:30 +02:00