Skip to content

Commit 63a36f4

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 <[email protected]>
1 parent c082797 commit 63a36f4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tuned/plugins/plugin_disk.py

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

135+
def _is_loop_device(device):
136+
dev = device.attributes.get("dev", None)
137+
if dev:
138+
try:
139+
major = int(dev.decode("utf-8").split(":")[0])
140+
except:
141+
major = None
142+
return major == 7
143+
135144
@classmethod
136145
def _device_is_supported(cls, device):
137146
return device.device_type == "disk" and \
147+
not cls._is_loop_device(device) and \
138148
device.attributes.get("removable", None) == b"0" and \
139149
(device.parent is None or \
140150
device.parent.subsystem in ["scsi", "virtio", "xen", "nvme"])

0 commit comments

Comments
 (0)