Blob Blame History Raw
From b09ed75b09075d86c184b0a63cce9260f2cee4ca Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Mon, 30 Aug 2021 11:27:48 +0200
Subject: [PATCH] [processor] Apply sizelimit to /sys/devices/system/cpu/cpuX

Copy /sys/devices/system/cpu/cpuX with separately applied sizelimit.

This is required for systems with tens/hundreds of CPUs where the
cumulative directory size exceeds 25MB or even 100MB.

Resolves: #2639
Closes: #2665

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
 sos/report/plugins/processor.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sos/report/plugins/processor.py b/sos/report/plugins/processor.py
index 0ddfd126..2df2dc9a 100644
--- a/sos/report/plugins/processor.py
+++ b/sos/report/plugins/processor.py
@@ -7,6 +7,7 @@
 # See the LICENSE file in the source distribution for further information.
 
 from sos.report.plugins import Plugin, IndependentPlugin
+import os
 
 
 class Processor(Plugin, IndependentPlugin):
@@ -34,7 +35,13 @@ class Processor(Plugin, IndependentPlugin):
         self.add_copy_spec([
             "/proc/cpuinfo",
             "/sys/class/cpuid",
-            "/sys/devices/system/cpu"
+        ])
+        # copy /sys/devices/system/cpu/cpuX with separately applied sizelimit
+        # this is required for systems with tens/hundreds of CPUs where the
+        # cumulative directory size exceeds 25MB or even 100MB.
+        cdirs = self.listdir('/sys/devices/system/cpu')
+        self.add_copy_spec([
+            os.path.join('/sys/devices/system/cpu', cdir) for cdir in cdirs
         ])
 
         self.add_cmd_output([
-- 
2.31.1