Skip to content

Commit 20fd4f1

Browse files
committed
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 <andreas.hasenack@canonical.com>
1 parent c082797 commit 20fd4f1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tuned/plugins/plugin_disk.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,20 @@ def _is_hdparm_apm_supported(self, device):
132132
self._hdparm_apm_device_support[device] = True
133133
return True
134134

135+
@staticmethod
136+
def _is_loop_device(device):
137+
dev = device.attributes.get("dev", None)
138+
if dev:
139+
try:
140+
major = int(dev.decode("utf-8").split(":")[0])
141+
except:
142+
major = None
143+
return major == 7
144+
135145
@classmethod
136146
def _device_is_supported(cls, device):
137147
return device.device_type == "disk" and \
148+
not cls._is_loop_device(device) and \
138149
device.attributes.get("removable", None) == b"0" and \
139150
(device.parent is None or \
140151
device.parent.subsystem in ["scsi", "virtio", "xen", "nvme"])

0 commit comments

Comments
 (0)