From 63a36f4a76241833e112887e857064a81ecdefe6 Mon Sep 17 00:00:00 2001 From: Andreas Hasenack Date: Wed, 21 Aug 2024 16:51:02 -0300 Subject: [PATCH] disk plugin: ignore loop devices It doesn't make sense to apply tuning parameters to loop devices, since they point at files that live in other block devices, also subject to tuning. Signed-off-by: Andreas Hasenack --- tuned/plugins/plugin_disk.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tuned/plugins/plugin_disk.py b/tuned/plugins/plugin_disk.py index 6fe52a72..32b710cb 100644 --- a/tuned/plugins/plugin_disk.py +++ b/tuned/plugins/plugin_disk.py @@ -132,9 +132,19 @@ def _is_hdparm_apm_supported(self, device): self._hdparm_apm_device_support[device] = True return True + def _is_loop_device(device): + dev = device.attributes.get("dev", None) + if dev: + try: + major = int(dev.decode("utf-8").split(":")[0]) + except: + major = None + return major == 7 + @classmethod def _device_is_supported(cls, device): return device.device_type == "disk" and \ + not cls._is_loop_device(device) and \ device.attributes.get("removable", None) == b"0" and \ (device.parent is None or \ device.parent.subsystem in ["scsi", "virtio", "xen", "nvme"])