-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add dbus commands for dynamic creation of instances #596
add dbus commands for dynamic creation of instances #596
Conversation
9523660
to
9931566
Compare
@yarda @zacikpa to continue the discussion on dynamic creation (and deletion) of plugin instances (originally in #580): I have updated the behavior of
For
Also, I noticed that the code (existing |
9931566
to
584fcf9
Compare
After thinking about it some more, I believe that we do want to automatically move matching devices. So the latest update implements that, acquiring all matching devices from plugin instances with an equal or lower priority (i.e. if the priority value of the new instance is lower of equal to the one of the existing instance). |
0a49980
to
790df99
Compare
After some more testing and fixing, I'm now quite happy with the current implementation. However, I'm seeing some potential inconsistencies in the current behavior of the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update, @adriaan42.
Also, I noticed that the code (existing instance_acquire_devices and also my new instance_create and instance_destroy) call methods only available in Hotplug plugins, but without checking if we're actually dealing with a Hotplug plugin. Is that a bug in the existing instance_acquire_devices? Should I just add an isinstance() check to all three functions?
I think this is indeed a bug. It hasn't caused any issues yet because there aren't many non-hotplug plugins with device support, and for plugins that do not support devices at all, the existing function returns earlier. I would add the type check.
non-active instances are not listed by the get_instances dbus call, so it seems they don't exist, but instance_get_devices can be called successfully -> the view exposed via the dbus interface is not consistent.
The only issue I see here is the name of the API function get_instances
, which probably should have been named get_active_instances
. Nonetheless, it's well-documented that it returns only active instances, so I wouldn't worry about it much.
for non-active instances, instance_apply_tuning (https://github.com/redhat-performance/tuned/blob/master/tuned/plugins/base.py#L250, and related functions) immediately returns, so in particular, the static tuning is not executed -> it is not possible to have static instance-specific tuning that is independent of devices.
Good catch - I also found a related issue, see one of my comments. I think resolving this would require some heavier refactoring where we would decouple the non-device tuning from the device tuning. I don't really think it's a blocker for this PR - I would open a separate issue for that if you're not up for it. @yarda, what do you think?
Functionality-wise, I tested this and it works quite well.
Currently instance priorities are only used at startup to sort the instance classes. To enable dynamic creation of instances, we need to store the priorities, so new instances can be sorted accordingly. Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
This adds a check to instance_acquire_devices to ensure that the plugin actually supports the requested operation. Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
790df99
to
cddcd23
Compare
I've added checks.
If inactive instances are "invisible" then any code using the interface to create a new instance would have to explicitly check (using
Thanks, I appreciate it! :) |
@yarda anything missing/blocking this? |
OK, NP, it makes sense. |
LGTM. I also tested basic functionality and it seems everything works OK, thanks for contribution. |
Commit taken from #580