Skip to content

Commit b4c28f6

Browse files
committed
feat: allow dynamic instances of non-hotplug plugins
Signed-off-by: Adriaan Schmidt <[email protected]>
1 parent 7480983 commit b4c28f6

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

tuned/daemon/controller.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,6 @@ def instance_create(self, plugin_name, instance_name, options, caller = None):
467467
log.error(rets)
468468
return (False, rets)
469469
plugin = plugins[plugin_name]
470-
if not isinstance(plugin, hotplug.Plugin):
471-
rets = "Plugin '%s' does not support hotplugging or dynamic instances." % plugin.name
472-
log.error(rets)
473-
return (False, rets)
474470
devices = options.pop("devices", None)
475471
devices_udev_regex = options.pop("devices_udev_regex", None)
476472
script_pre = options.pop("script_pre", None)
@@ -525,10 +521,6 @@ def instance_destroy(self, instance_name, caller = None):
525521
log.error(rets)
526522
return (False, rets)
527523
plugin = instance.plugin
528-
if not isinstance(plugin, hotplug.Plugin):
529-
rets = "Plugin '%s' does not support hotplugging or dynamic instances." % plugin.name
530-
log.error(rets)
531-
return (False, rets)
532524
devices = instance.processed_devices.copy()
533525
try:
534526
plugin._remove_devices_nocheck(instance, devices)

tuned/plugins/base.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ def _get_device_objects(self, devices):
154154
return None
155155

156156
def _get_matching_devices(self, instance, devices):
157+
if not self._devices_supported:
158+
return set()
159+
157160
if instance.devices_udev_regex is None:
158161
return set(self._device_matcher.match_list(instance.devices_expression, devices))
159162
else:
@@ -164,6 +167,18 @@ def _get_matching_devices(self, instance, devices):
164167
udev_devices = self._device_matcher_udev.match_list(instance.devices_udev_regex, udev_devices)
165168
return set([x.sys_name for x in udev_devices])
166169

170+
def _add_device(self, device_name):
171+
pass
172+
173+
def _add_devices_nocheck(self, instance, device_names):
174+
pass
175+
176+
def _remove_device(self, device_name):
177+
pass
178+
179+
def _remove_devices_nocheck(self, instance, device_names):
180+
pass
181+
167182
def assign_free_devices(self, instance):
168183
if not self._devices_supported:
169184
return

0 commit comments

Comments
 (0)