Hello community, here is the log from the commit of package ServiceReport for openSUSE:Factory checked in at 2020-11-04 18:26:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ServiceReport (Old) and /work/SRC/openSUSE:Factory/.ServiceReport.new.11331 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ServiceReport" Wed Nov 4 18:26:10 2020 rev:2 rq:845710 version:2.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ServiceReport/ServiceReport.changes 2020-09-15 16:28:43.574621838 +0200 +++ /work/SRC/openSUSE:Factory/.ServiceReport.new.11331/ServiceReport.changes 2020-11-04 18:31:21.472285310 +0100 @@ -1,0 +2,13 @@ +Tue Nov 3 11:37:00 UTC 2020 - Michal Suchanek <msucha...@suse.de> + +- Update to upstream git (jsc#SLE-13288). + + 0001-Add-active-dump-check-in-kdump-and-FADump-plugin.patch + + 0002-Introduce-a-new-option-to-mark-plugins-optional.patch + + 0003-HTX-Mark-HTX-plugin-as-optional.patch + + 0004-Add-new-option-to-run-all-applicable-plugins.patch + + 0005-Allow-distro-classes-to-redefine-the-capture-kernel-.patch + + 0006-utils-remove-the-invalid-function-call-to-walk_packa.patch + + 0007-Update-data-files-of-the-project.patch + + 0008-Run-servicereport-using-python3-binary.patch + +------------------------------------------------------------------- New: ---- 0001-Add-active-dump-check-in-kdump-and-FADump-plugin.patch 0002-Introduce-a-new-option-to-mark-plugins-optional.patch 0003-HTX-Mark-HTX-plugin-as-optional.patch 0004-Add-new-option-to-run-all-applicable-plugins.patch 0005-Allow-distro-classes-to-redefine-the-capture-kernel-.patch 0006-utils-remove-the-invalid-function-call-to-walk_packa.patch 0007-Update-data-files-of-the-project.patch 0008-Run-servicereport-using-python3-binary.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ServiceReport.spec ++++++ --- /var/tmp/diff_new_pack.n6fKVn/_old 2020-11-04 18:31:22.104283909 +0100 +++ /var/tmp/diff_new_pack.n6fKVn/_new 2020-11-04 18:31:22.108283900 +0100 @@ -26,6 +26,14 @@ Group: System/Management URL: https://github.com/linux-ras/ServiceReport Source0: https://github.com/linux-ras/%{name}/archive/v%{version}/%{name}-v%{version}.tar.gz +Patch1: 0001-Add-active-dump-check-in-kdump-and-FADump-plugin.patch +Patch2: 0002-Introduce-a-new-option-to-mark-plugins-optional.patch +Patch3: 0003-HTX-Mark-HTX-plugin-as-optional.patch +Patch4: 0004-Add-new-option-to-run-all-applicable-plugins.patch +Patch5: 0005-Allow-distro-classes-to-redefine-the-capture-kernel-.patch +Patch6: 0006-utils-remove-the-invalid-function-call-to-walk_packa.patch +Patch7: 0007-Update-data-files-of-the-project.patch +Patch8: 0008-Run-servicereport-using-python3-binary.patch BuildRequires: %{python} BuildRequires: %{python}-setuptools BuildRequires: systemd-rpm-macros @@ -41,6 +49,7 @@ %prep %setup -q +%autopatch -p1 %build %{python} setup.py build @@ -61,6 +70,7 @@ %service_del_postun servicereport.service %files +%license COPYING %{_mandir}/man8/* %doc %{_datadir}/doc/* %{_bindir}/servicereport ++++++ 0001-Add-active-dump-check-in-kdump-and-FADump-plugin.patch ++++++ >From c9feebe21448e1e2691c4195c15009ef85e9d4e8 Mon Sep 17 00:00:00 2001 From: Sourabh Jain <sourabhj...@linux.ibm.com> Date: Wed, 15 Jul 2020 13:19:19 +0530 Subject: [PATCH 1/8] Add active dump check in kdump and FADump plugin Upstream: accepted - expected 2.2.3 Git-commit: c9feebe21448e1e2691c4195c15009ef85e9d4e8 When the kernel panics it generates /proc/vmcore file that contains physical memory of crashed kernel. If the kdump/FADump is configured, system boots with secondary/capture kernel and detects the /proc/vmcore file to collect the dump. Now for some reason if kdump service failed to collect dump the it remains active in the system until we reboot the system. If system has an active dump then it may create problem during next kernel crash. This patch adds a check in kdump and fadump plugin to ensure that there is no active dump in the system and if found raise flag to reboot the system. Signed-off-by: Sourabh Jain <sourabhj...@linux.ibm.com> --- servicereportpkg/repair/plugins/fadump_repair.py | 6 ++++++ servicereportpkg/repair/plugins/kdump_repair.py | 6 ++++++ servicereportpkg/validate/plugins/kdump.py | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/servicereportpkg/repair/plugins/fadump_repair.py b/servicereportpkg/repair/plugins/fadump_repair.py index 4d7ba70f301d..bb7692b59a1a 100644 --- a/servicereportpkg/repair/plugins/fadump_repair.py +++ b/servicereportpkg/repair/plugins/fadump_repair.py @@ -229,3 +229,9 @@ class FadumpRepair(RepairPlugin): dump_comp_initrd_check) elif dump_comp_initrd_check.get_status() is None: dump_comp_initrd_check.set_note(Notes.FAIL_TO_FIX) + + active_dump = check_dir["Active dump"] + if active_dump.get_status() is False: + active_dump.add_note("Active dump found, needs reboot") + if active_dump.get_status() is None: + active_dump.add_note(Notes.FAIL_TO_FIX) diff --git a/servicereportpkg/repair/plugins/kdump_repair.py b/servicereportpkg/repair/plugins/kdump_repair.py index ad734200cee8..812c2d39e337 100644 --- a/servicereportpkg/repair/plugins/kdump_repair.py +++ b/servicereportpkg/repair/plugins/kdump_repair.py @@ -320,3 +320,9 @@ class KdumpRepair(DumpRepair, RepairPlugin): init_ramdisk_comp) elif init_ramdisk_comp.get_status() is None: init_ramdisk_comp.set_note(Notes.FAIL_TO_FIX) + + active_dump = check_dir["Active dump"] + if active_dump.get_status() is False: + active_dump.add_note("Active dump found, needs reboot") + if active_dump.get_status() is None: + active_dump.add_note(Notes.FAIL_TO_FIX) diff --git a/servicereportpkg/validate/plugins/kdump.py b/servicereportpkg/validate/plugins/kdump.py index 90af3cbbcc41..34ec0b4ef684 100644 --- a/servicereportpkg/validate/plugins/kdump.py +++ b/servicereportpkg/validate/plugins/kdump.py @@ -18,6 +18,7 @@ from servicereportpkg.utils import get_file_content, get_total_ram from servicereportpkg.utils import get_file_size, is_string_in_file from servicereportpkg.check import PackageCheck, ServiceCheck, Check from servicereportpkg.check import SysfsCheck, ConfigurationFileCheck +from servicereportpkg.check import FileCheck from servicereportpkg.utils import get_service_status, execute_command from servicereportpkg.validate.schemes.schemes import FedoraScheme, SuSEScheme from servicereportpkg.validate.schemes.schemes import RHELScheme, UbuntuScheme @@ -32,6 +33,7 @@ class Dump(object): self.initial_ramdisk = "" self.log = get_default_logger() self.kernel_release = platform.release() + self.active_dump = "/proc/vmcore" def check_is_dump_service_active(self): """Service status""" @@ -99,6 +101,13 @@ class Dump(object): return PackageCheck(self.check_kexec_package.__doc__, package, status) + def check_active_dump(self): + """Active dump""" + + status = not os.path.isfile(self.active_dump) + return FileCheck(self.check_active_dump.__doc__, + self.active_dump, status) + class Kdump(Dump): """Kdump configuration check""" -- 2.29.1 ++++++ 0002-Introduce-a-new-option-to-mark-plugins-optional.patch ++++++ >From 59b372c58c8de0034d7d3b0c307208ae1e5ee9e7 Mon Sep 17 00:00:00 2001 From: Sourabh Jain <sourabhj...@linux.ibm.com> Date: Sun, 3 May 2020 15:58:49 +0530 Subject: [PATCH 2/8] Introduce a new option to mark plugins optional Upstream: accepted - expected 2.2.3 Git-commit: 59b372c58c8de0034d7d3b0c307208ae1e5ee9e7 ServiceReport by default runs all the plugins available inside the validate package. The validate package does have some workload specific plugin which may not required to run all the time. For example HTX plugin has limited use case (in testing OpenPOWER systems) and we may not required to test HTX configuration on every machine by default. This patch adds an infrastructure to mark plugins optional which are specific to a particular workload and may not required to run by default. If a plugin is marked optional then it will not get executed by default. The format of listing the applicable plugins using -l (--list) option has changed. A new column (Tag) has been introduced that shows a plugin is optional or mandatory. Listing applicable plugins: $ ./servicereport -l servicereport 2.2.1 The following plugins are applicable: Name Tags Description daemon M Daemon availability checks fadump M FADump configuration check htx M HTX configuration check package M Package availability check Tag Info: M: Mandatory plugin (runs by default) O: Optional plugin (use -o option to enable) Signed-off-by: Sourabh Jain <sourabhj...@linux.ibm.com> --- servicereportpkg/__init__.py | 9 ++ servicereportpkg/validate/__init__.py | 117 +++++++++++++----- servicereportpkg/validate/plugins/__init__.py | 6 + 3 files changed, 100 insertions(+), 32 deletions(-) diff --git a/servicereportpkg/__init__.py b/servicereportpkg/__init__.py index 8f4f72b7a62f..945b6ece56c7 100644 --- a/servicereportpkg/__init__.py +++ b/servicereportpkg/__init__.py @@ -48,6 +48,10 @@ def parse_commandline_args(args): nargs='+', default=None, help="validates the specified plugins only") + parser.add_argument("-o", "--optional", dest="optional", + nargs='+', default=None, + help="run the specified optional plugins") + parser.add_argument("-q", "--quiet", action="store_true", dest="quite", default=False, help="no output on console") @@ -64,6 +68,11 @@ def parse_commandline_args(args): dest="verbose", default=0, help="increase the logging verbosity") + parsed_argument = parser.parse_args(args) + + if parsed_argument.plugins and parsed_argument.optional: + parser.error("-o(--optional) is not allowed with -p(--pluigns)\n" + "\t\t\tList all the plugins against -p option only.") return parser.parse_args(args) diff --git a/servicereportpkg/validate/__init__.py b/servicereportpkg/validate/__init__.py index 0efa92042d45..0d94e7ea392f 100644 --- a/servicereportpkg/validate/__init__.py +++ b/servicereportpkg/validate/__init__.py @@ -27,45 +27,99 @@ class Validate(object): self.plugin_handler = PluginHandler(self.scheme_handler) self.validation_results = OrderedDict() - def get_plugin_dir(self, plugins=None): - """Returns an ordered directory of list of executable plugins""" + def get_applicable_plugins(self): + """Returns a dictionary of applicable plugins""" - plugin_dir_tmp = OrderedDict() + plugins = {} for plugin in self.plugin_handler.get_applicable_plugins(): plugins_obj = plugin() plugin_name = plugins_obj.get_name().lower() - if plugin_name not in plugin_dir_tmp.keys(): - plugin_dir_tmp[plugin_name] = [] - plugin_dir_tmp[plugin_name].append(plugins_obj) - - # By default plugins are executed in sorted order but If plugins - # are specified using -p option then the execution order should be - # same as specified on command line - if plugins: - plugin_dir = OrderedDict() - for plugin in plugins: - plugin = plugin.lower() - if plugin in plugin_dir_tmp.keys(): - if plugin not in plugin_dir.keys(): - plugin_dir[plugin] = plugin_dir_tmp[plugin] - else: - print("%s plugin is not applicable" % plugin) - - return plugin_dir - - return OrderedDict(sorted(plugin_dir_tmp.items(), - key=lambda tmp: tmp[0])) + + if plugin_name not in plugins: + plugins[plugin_name] = [] + + plugins[plugin_name].append(plugins_obj) + + return plugins + + def is_plugin_executable(self, plugin_name, plugin_obj): + """Check whether the give plugin is executable in current system + environment""" + + if self.cmd_opts.plugins: + return plugin_name in self.cmd_opts.plugins + + if plugin_obj.is_optional(): + if self.cmd_opts.optional: + return plugin_name in self.cmd_opts.optional + + return False + + return True + + def arrange_execution_order(self, exe_plugins): + """Decides the plugin execution order""" + + # Obey the order in which plugin are listed against -p or + # --plugins option + if self.cmd_opts.plugins: + od_exe_plugin = OrderedDict() + for plugin in self.cmd_opts.plugins: + if plugin in exe_plugins: + od_exe_plugin[plugin] = exe_plugins[plugin] + + return od_exe_plugin + + return OrderedDict(sorted(exe_plugins.items())) + + def verify_listed_plugins(self, applicable_plugins, plugins): + """Find and print if any invalid plugin is listed by user""" + + for plugin in plugins: + if plugin not in applicable_plugins: + print("Warning: %s plugin is either invalid or not applicable " + "to this system.\n" % plugin) + + def get_executable_plugins(self): + """Return a dictionary of executable plugins""" + + exe_plugins = {} + + applicable_plugins = self.get_applicable_plugins() + + if self.cmd_opts.plugins: + self.verify_listed_plugins(applicable_plugins, + self.cmd_opts.plugins) + + if self.cmd_opts.optional: + self.verify_listed_plugins(applicable_plugins, + self.cmd_opts.optional) + + for plugin in applicable_plugins: + plugin_objs = applicable_plugins[plugin] + if self.is_plugin_executable(plugin, plugin_objs[0]): + exe_plugins[plugin] = plugin_objs + + return self.arrange_execution_order(exe_plugins) def list_applicable_plugins(self): """List all the applicable plugins""" - plugins = self.get_plugin_dir() + plugins = self.get_applicable_plugins() print("The following plugins are applicable:\n") + print(" {0:20}{1:20}{2}\n".format("Name", "Tags", "Description")) for plugin in plugins: - print(" {0:25}{1}".format(plugin, - plugins[plugin][0].get_description())) + if not plugins[plugin][0].is_optional(): + print(" {0:20}{1:20}{2}".format(plugin, "M", + plugins[plugin][0].get_description())) + else: + print(" {0:20}{1:20}{2}".format(plugin, "O", + plugins[plugin][0].get_description())) + print("\n{0}\n{1}\n{2}".format("Tag Info: ", + "M: Mandatory plugin (runs by default)", + "O: Optional plugin (use -o option to enable)")) def do_execute_plugin(self, plugin): """Execute the plugin""" @@ -82,7 +136,7 @@ class Validate(object): handler identifier and execute the plugin""" successful_plugin_obj = [] - plugin_dir = self.get_plugin_dir(self.cmd_opts.plugins) + plugin_dir = self.get_executable_plugins() for plugin in plugin_dir: change_log_identifier(TOOL_NAME + '.' + plugin, self.log) @@ -95,7 +149,6 @@ class Validate(object): self.do_execute_plugin(plugin_obj) successful_plugin_obj.append(plugin_obj) - change_log_identifier(TOOL_NAME, self.log) for plugin_obj in successful_plugin_obj: if plugin_obj.get_name() not in self.validation_results.keys(): @@ -108,11 +161,11 @@ class Validate(object): # Make sure that if -d (--dump) is provided then only # dump plugin should run - if self.cmd_opts.dump and self.cmd_opts.plugins is None: + if self.cmd_opts.dump: if is_string_in_file("fadump=on", "/proc/cmdline"): - self.cmd_opts.plugins = ["FADump"] + self.cmd_opts.plugins = ["fadump"] else: - self.cmd_opts.plugins = ["Kdump"] + self.cmd_opts.plugins = ["kdump"] self.execute_plugins() return self.validation_results diff --git a/servicereportpkg/validate/plugins/__init__.py b/servicereportpkg/validate/plugins/__init__.py index e9db8d9d8af5..c6a9e83dcd04 100644 --- a/servicereportpkg/validate/plugins/__init__.py +++ b/servicereportpkg/validate/plugins/__init__.py @@ -16,6 +16,7 @@ class Plugin(object): def __init__(self): self.name = Plugin.__name__ self.description = Plugin.__doc__ + self.optional = False self.log = get_default_logger() self.checks = [] @@ -31,6 +32,11 @@ class Plugin(object): return self.description + def is_optional(self): + """Return True if plugin is optional else False""" + + return self.optional + def get_plugin_status(self): """Returns the overall status of the plugin. Returns True only if all the checks succeed else False""" -- 2.29.1 ++++++ 0003-HTX-Mark-HTX-plugin-as-optional.patch ++++++ >From f142977319114b5f3f4aa711df8c5c247ed0d312 Mon Sep 17 00:00:00 2001 From: Sourabh Jain <sourabhj...@linux.ibm.com> Date: Sun, 3 May 2020 15:59:28 +0530 Subject: [PATCH 3/8] [HTX] Mark HTX plugin as optional Upstream: accepted - expected 2.2.3 Git-commit: f142977319114b5f3f4aa711df8c5c247ed0d312 HTX plugin has limited use case in testing OpenPower systems and we may not need to run this plugin by default. $ ./servicereport -l servicereport 2.2.1 The following plugins are applicable: Name Tags Description daemon M Daemon availability checks fadump M FADump configuration check htx O HTX configuration check package M Package availability check Tag Info: M: Mandatory plugin (runs by default) O: Optional plugin (use -o option to enable) Signed-off-by: Sourabh Jain <sourabhj...@linux.ibm.com> --- servicereportpkg/validate/plugins/htx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/servicereportpkg/validate/plugins/htx.py b/servicereportpkg/validate/plugins/htx.py index f5f491c7e11b..74497892b9b6 100644 --- a/servicereportpkg/validate/plugins/htx.py +++ b/servicereportpkg/validate/plugins/htx.py @@ -22,6 +22,7 @@ class HTX(Plugin, PowerPCScheme): Plugin.__init__(self) self.name = HTX.__name__ self.description = HTX.__doc__ + self.optional = True self.service_name = "htxd" self.installation_path = "/var/log/htx_install_path" -- 2.29.1 ++++++ 0004-Add-new-option-to-run-all-applicable-plugins.patch ++++++ >From d3e790d21c7dd7043bb405a752fe210bfaf3332b Mon Sep 17 00:00:00 2001 From: Sourabh Jain <sourabhj...@linux.ibm.com> Date: Sun, 3 May 2020 16:25:19 +0530 Subject: [PATCH 4/8] Add new option to run all applicable plugins Upstream: accepted - expected 2.2.3 Git-commit: d3e790d21c7dd7043bb405a752fe210bfaf3332b Introducing a new option -a (--all) that will allow user to run all applicable plugins regardless whether a plugin is optional or not. Signed-off-by: Sourabh Jain <sourabhj...@linux.ibm.com> --- servicereportpkg/__init__.py | 10 ++++++++++ servicereportpkg/validate/__init__.py | 3 +++ 2 files changed, 13 insertions(+) diff --git a/servicereportpkg/__init__.py b/servicereportpkg/__init__.py index 945b6ece56c7..2d44bd1cebd6 100644 --- a/servicereportpkg/__init__.py +++ b/servicereportpkg/__init__.py @@ -32,6 +32,10 @@ def parse_commandline_args(args): parser = ArgumentParser(description="Validation tool to \ verify the system configurations") + parser.add_argument("-a", "--all", action="store_true", + dest="all", default=False, + help="Execute all plugins applicable to the system") + parser.add_argument("-d", "--dump", action="store_true", dest="dump", default=False, help="Trigger a dump") @@ -73,6 +77,12 @@ def parse_commandline_args(args): if parsed_argument.plugins and parsed_argument.optional: parser.error("-o(--optional) is not allowed with -p(--pluigns)\n" "\t\t\tList all the plugins against -p option only.") + + if parsed_argument.all and (parsed_argument.plugins or + parsed_argument.optional): + parser.error("-a(--all) option is not allowd with -p(--plugins)\n" + "\t\t\tor -o(--optional) option.") + return parser.parse_args(args) diff --git a/servicereportpkg/validate/__init__.py b/servicereportpkg/validate/__init__.py index 0d94e7ea392f..6f441fa6e373 100644 --- a/servicereportpkg/validate/__init__.py +++ b/servicereportpkg/validate/__init__.py @@ -47,6 +47,9 @@ class Validate(object): """Check whether the give plugin is executable in current system environment""" + if self.cmd_opts.all: + return True + if self.cmd_opts.plugins: return plugin_name in self.cmd_opts.plugins -- 2.29.1 ++++++ 0005-Allow-distro-classes-to-redefine-the-capture-kernel-.patch ++++++ >From f3b3c1c4e39ba77c41776ecfe5d82bb1b745bcfb Mon Sep 17 00:00:00 2001 From: Sourabh Jain <sourabhj...@linux.ibm.com> Date: Thu, 18 Jun 2020 11:14:53 +0530 Subject: [PATCH 5/8] Allow distro classes to redefine the capture kernel memory reservation Upstream: accepted - expected 2.2.3 Git-commit: f3b3c1c4e39ba77c41776ecfe5d82bb1b745bcfb The amount of memory reservation needed for the capture kernel is dependent on the distro type. But the variable that defines the capture kernel memory reservation is defined inside a function that restricts the distro-specific classes to redefine the capture kernel memory reservations. This patch moves the variable used to define the capture kernel memory reservation table to a class level so that distro classes can redefine it. Signed-off-by: Sourabh Jain <sourabhj...@linux.ibm.com> --- servicereportpkg/validate/plugins/fadump.py | 29 ++++++++++----------- servicereportpkg/validate/plugins/kdump.py | 26 ++++++++++-------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/servicereportpkg/validate/plugins/fadump.py b/servicereportpkg/validate/plugins/fadump.py index e411d4efe8fe..2d9396121a74 100644 --- a/servicereportpkg/validate/plugins/fadump.py +++ b/servicereportpkg/validate/plugins/fadump.py @@ -34,7 +34,20 @@ class FADump(Dump): self.description = FADump.__doc__ self.dump_service_name = "kdump" self.dump_comp_name = "kdump" + # (system mem, mem reservation needed) + # (GB, MB) self.log = get_default_logger() + self.capture_kernel_mem = [(4, 0), + (64, 1024), + (128, 2048), + (1024, 4096), + (2048, 6144), + (4096, 12288), + (8192, 20480), + (16384, 36864), + (32786, 65536), + (65536, 131072), + (sys.maxsize, 184320)] @classmethod def is_applicable(cls): @@ -164,21 +177,7 @@ class FADump(Dump): # change from KB to MB ram = ram / 1024 / 1024 - # (system mem, mem reservation needed) - # (GB, MB) - crashkernel_mem_table = [(4, 0), - (64, 1024), - (128, 2048), - (1024, 4096), - (2048, 6144), - (4096, 12288), - (8192, 20480), - (16384, 36864), - (32786, 65536), - (65536, 131072), - (sys.maxsize, 184320)] - - for (sys_mem, mem_reservation_needed) in crashkernel_mem_table: + for (sys_mem, mem_reservation_needed) in self.capture_kernel_mem: if ram <= sys_mem: return mem_reservation_needed diff --git a/servicereportpkg/validate/plugins/kdump.py b/servicereportpkg/validate/plugins/kdump.py index 34ec0b4ef684..3d47df60b254 100644 --- a/servicereportpkg/validate/plugins/kdump.py +++ b/servicereportpkg/validate/plugins/kdump.py @@ -121,6 +121,15 @@ class Kdump(Dump): self.kdump_etc_conf = "/etc/kdump.conf" self.kdump_conf_file = "/etc/sysconfig/kdump" self.log = get_default_logger() + self.capture_kernel_mem = [(2048, 128), + (4096, 320), + (32768, 512), + (65536, 1024), + (131072, 2048), + (1048576, 8192), + (8388608, 16384), + (16777216, 32768), + (sys.maxsize, 65536)] @classmethod def is_applicable(cls): @@ -143,17 +152,7 @@ class Kdump(Dump): # Change from KB to MB ram = ram / 1024 - capture_kernel_mem = [(2048, 128), - (4096, 320), - (32768, 512), - (65536, 1024), - (131072, 2048), - (1048576, 8192), - (8388608, 16384), - (16777216, 32768), - (sys.maxsize, 65536)] - - for (total_mem, need_reservation_mem) in capture_kernel_mem: + for (total_mem, need_reservation_mem) in self.capture_kernel_mem: if ram <= total_mem: return need_reservation_mem @@ -397,6 +396,11 @@ class KdumpRHEL(Kdump, Plugin, RHELScheme): self.initial_ramdisk = "/boot/initramfs-" \ + self.kernel_release \ + "kdump.img" + self.capture_kernel_mem = [(4096, 384), + (16384, 512), + (65536, 1024), + (131072, 2048), + (sys.maxsize, 4096)] class KdumpSuSE(Kdump, Plugin, SuSEScheme): -- 2.29.1 ++++++ 0006-utils-remove-the-invalid-function-call-to-walk_packa.patch ++++++ >From 32c56462ae6a0488b0b2c017ca2e10cdec42e2b1 Mon Sep 17 00:00:00 2001 From: Sourabh Jain <sourabhj...@linux.ibm.com> Date: Mon, 5 Oct 2020 13:02:24 +0530 Subject: [PATCH 6/8] [utils] remove the invalid function call to walk_packages Upstream: accepted - expected 2.2.3 Git-commit: 32c56462ae6a0488b0b2c017ca2e10cdec42e2b1 Logger class instance in install_package function is calling walk_packages function instead of warning. There is no member name walk_packages in Logger class and on execution it lead to following error: AttributeError: 'Logger' object has no attribute 'walk_packages' This patch updates the function to log the warning message if package manager is not available. Signed-off-by: Sourabh Jain <sourabhj...@linux.ibm.com> --- servicereportpkg/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servicereportpkg/utils.py b/servicereportpkg/utils.py index fcf62e781a6c..279750971d1c 100644 --- a/servicereportpkg/utils.py +++ b/servicereportpkg/utils.py @@ -293,7 +293,7 @@ def install_package(package): log = get_default_logger() if package_manager is None: - log.walk_packages("Unable to locate the package manager") + log.warning("Unable to locate the package manager") return None command = package_manager["installer"]+" "+package_manager["install_option"]+" "+package -- 2.29.1 ++++++ 0007-Update-data-files-of-the-project.patch ++++++ >From ab4a7c6fbc789eeab2462a04679d3d8ac0082ac9 Mon Sep 17 00:00:00 2001 From: Sourabh Jain <sourabhj...@linux.ibm.com> Date: Thu, 2 Jul 2020 11:44:10 +0530 Subject: [PATCH 7/8] Update data files of the project Upstream: accepted - expected 2.2.3 Git-commit: ab4a7c6fbc789eeab2462a04679d3d8ac0082ac9 Let's keep the README.md install directory name similar to the package name to avoid conflicts during package build. Also add license file (COPYING) to data files of the project. Signed-off-by: Sourabh Jain <sourabhj...@linux.ibm.com> --- ServiceReport.spec | 1 + setup.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ServiceReport.spec b/ServiceReport.spec index a57625caa12b..1a817ad73277 100644 --- a/ServiceReport.spec +++ b/ServiceReport.spec @@ -43,6 +43,7 @@ systemctl enable servicereport.service %defattr(-,root,root) %doc /usr/share/man/man8/* %doc /usr/share/doc/* +%doc /usr/share/licenses/* /usr/lib/* /usr/bin/* diff --git a/setup.py b/setup.py index 6217831be088..a716c710804b 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,8 @@ setup(packages=find_packages(), scripts=['servicereport'], version=get_version(), data_files=[('share/man/man8', ['man/servicereport.8']), - ('share/doc/servicereport', ['README.md']), + ('share/doc/ServiceReport', ['README.md']), + ('share/licenses/ServiceReport', ['COPYING']), ('/usr/lib/systemd/system', ['service/servicereport.service'])], classifiers=[ -- 2.29.1 ++++++ 0008-Run-servicereport-using-python3-binary.patch ++++++ >From a1d474d81a516407d4354218abd4f9b24f463711 Mon Sep 17 00:00:00 2001 From: Sourabh Jain <sourabhj...@linux.ibm.com> Date: Thu, 10 Sep 2020 14:10:56 +0530 Subject: [PATCH 8/8] Run servicereport using python3 binary Upstream: accepted - expected 2.2.3 Git-commit: a1d474d81a516407d4354218abd4f9b24f463711 To execute servicereport we either need python binary or python symlink to python2/python3 binary. After python2 sunset most of the distros have made python3 as default python and removed the python symlink that used to point python2/python3 binary. Due to the unavailability of python, servicereport fails to execute. This patch solves the above issue by removing the servicereport dependency on python (binary/symlink) and executes servicereport script using the python3 binary. Additionally, a note is added in the README file about how to run servicereport using python2. Signed-off-by: Sourabh Jain <sourabhj...@linux.ibm.com> --- Makefile | 10 ++++++---- README.md | 4 ++++ servicereport | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 965b61e13bc4..4ded1f197f6a 100644 --- a/Makefile +++ b/Makefile @@ -3,19 +3,21 @@ # (C) Copyright IBM Corp. 2018, 2019 # Author: Sourabh Jain <sourabhj...@linux.ibm.com> +PYTHON:=python3 + # build everything needed to install build: - python setup.py build + $(PYTHON) setup.py build # install everything from build directory install: - python setup.py install + $(PYTHON) setup.py install # build the rpm package build_rpm: - python setup.py bdist_rpm + $(PYTHON) setup.py bdist_rpm # clean up temporary files from 'build' command clean: - python setup.py clean --all + $(PYTHON) setup.py clean --all diff --git a/README.md b/README.md index 13d8b1b7acfb..f66dd24fe84a 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ make install ### Running +NOTE: servicereport by default runs with python3, if you want to run + servicereport with python2 consider chaging the shebang in servicereport + script to python2. + Runs and print the status of all the applicable plugins in current system ``` $ servicereport diff --git a/servicereport b/servicereport index 87e450770c04..40e6a1754745 100755 --- a/servicereport +++ b/servicereport @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # -- 2.29.1