Skip to content
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

Allow dynamic instances of non-hotplug plugins #735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions tuned/daemon/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,6 @@ def instance_create(self, plugin_name, instance_name, options, caller = None):
log.error(rets)
return (False, rets)
plugin = plugins[plugin_name]
if not isinstance(plugin, hotplug.Plugin):
rets = "Plugin '%s' does not support hotplugging or dynamic instances." % plugin.name
log.error(rets)
return (False, rets)
devices = options.pop("devices", None)
devices_udev_regex = options.pop("devices_udev_regex", None)
script_pre = options.pop("script_pre", None)
Expand Down Expand Up @@ -525,10 +521,6 @@ def instance_destroy(self, instance_name, caller = None):
log.error(rets)
return (False, rets)
plugin = instance.plugin
if not isinstance(plugin, hotplug.Plugin):
rets = "Plugin '%s' does not support hotplugging or dynamic instances." % plugin.name
log.error(rets)
return (False, rets)
devices = instance.processed_devices.copy()
try:
plugin._remove_devices_nocheck(instance, devices)
Expand Down
15 changes: 15 additions & 0 deletions tuned/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ def _get_device_objects(self, devices):
return None

def _get_matching_devices(self, instance, devices):
if not self._devices_supported:
return set()

if instance.devices_udev_regex is None:
return set(self._device_matcher.match_list(instance.devices_expression, devices))
else:
Expand All @@ -164,6 +167,18 @@ def _get_matching_devices(self, instance, devices):
udev_devices = self._device_matcher_udev.match_list(instance.devices_udev_regex, udev_devices)
return set([x.sys_name for x in udev_devices])

def _add_device(self, device_name):
pass

def _add_devices_nocheck(self, instance, device_names):
pass

def _remove_device(self, device_name):
pass

def _remove_devices_nocheck(self, instance, device_names):
pass

def assign_free_devices(self, instance):
if not self._devices_supported:
return
Expand Down