Accepting request 113733 from Kernel:kdump

- kdump: Add 'none' format
- kdump: Allow format to be a list
- kdump: Save dmesg during dump
- kdump: Use correct script location in udev rule

(was missing the changes entries (forwarded request 113158 from jeff_mahoney)

OBS-URL: https://build.opensuse.org/request/show/113733
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kdump?expand=0&rev=52
This commit is contained in:
Stephan Kulow 2012-04-17 05:45:32 +00:00 committed by Git OBS Bridge
commit 1e3456d17d
6 changed files with 185 additions and 0 deletions

71
kdump-add-none-format Normal file
View File

@ -0,0 +1,71 @@
From: Jeff Mahoney <jeffm@suse.com>
Subject: kdump: Add 'none' format
Now that we have the ability to dump the dmesg log after a crash, it's
useful for users who don't have any use for a crash dump other than
to generate the dmesg log to avoid saving the dump at all. This avoids
both using the disk space required for a lot as well as the time
involved in waiting for the dump to complete only to later have to
remove it manually.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
kdumptool/savedump.cc | 17 ++++++++++-------
sysconfig.kdump | 5 +++--
2 files changed, 13 insertions(+), 9 deletions(-)
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -277,12 +277,13 @@ void SaveDump::saveDump()
bool useElf = strcasestr(dumpformat.c_str(), "elf") != NULL;
bool useCompressed = strcasestr(dumpformat.c_str(), "compressed") != NULL;
+ bool noDump = strcasestr(dumpformat.c_str(), "none") != NULL;
if (useElf && dumplevel == 0) {
// use file source?
provider = new FileDataProvider(m_dump.c_str());
m_useMakedumpfile = false;
- } else {
+ } else if (!noDump) {
// use makedumpfile
stringstream cmdline;
cmdline << "makedumpfile ";
@@ -316,12 +317,14 @@ void SaveDump::saveDump()
cout << "Saving dump using makedumpfile" << endl;
terminal.printLine();
}
- TerminalProgress progress("Saving dump");
- if (config->getVerbose() & Configuration::VERB_PROGRESS)
- provider->setProgress(&progress);
- else
- cout << "Saving dump ..." << endl;
- m_transfer->perform(provider, "vmcore", &m_usedDirectSave);
+ if (provider) {
+ TerminalProgress progress("Saving dump");
+ if (config->getVerbose() & Configuration::VERB_PROGRESS)
+ provider->setProgress(&progress);
+ else
+ cout << "Saving dump ..." << endl;
+ m_transfer->perform(provider, "vmcore", &m_usedDirectSave);
+ }
m_transfer->perform(logProvider, "dmesg.txt", NULL);
if (m_useMakedumpfile)
terminal.printLine();
--- a/sysconfig.kdump
+++ b/sysconfig.kdump
@@ -154,11 +154,12 @@ KDUMP_VERBOSE=3
#
KDUMP_DUMPLEVEL=0
-## Type: list(,compressed,ELF)
+## Type: list(,compressed,ELF,none)
## Default: "compressed"
## ServiceRestart: kdump
#
-# This variable specifies the dump format.
+# This variable specifies the dump format. Using the 'none' option will
+# skip capturing the dump entirely and only save the log messages.
#
# See also: kdump(5).
KDUMP_DUMPFORMAT="compressed"

27
kdump-format-list Normal file
View File

@ -0,0 +1,27 @@
From: Jeff Mahoney <jeffm@suse.com>
Subject: kdump: Allow format to be a list
/etc/sysconfig/kdump specifies that the KDUMP_FORMAT variable is a comma
separated list of options. The kdumptool itself doesn't treat it as a list
and will ignore all options if more than one is specified.
This patch searches for the option and uses it if it is present.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
kdumptool/savedump.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -275,8 +275,8 @@ void SaveDump::saveDump()
string dumpformat = config->getDumpFormat();
DataProvider *provider;
- bool useElf = strcasecmp(dumpformat.c_str(), "elf") == 0;
- bool useCompressed = strcasecmp(dumpformat.c_str(), "compressed") == 0;
+ bool useElf = strcasestr(dumpformat.c_str(), "elf") != NULL;
+ bool useCompressed = strcasestr(dumpformat.c_str(), "compressed") != NULL;
if (useElf && dumplevel == 0) {
// use file source?

42
kdump-save-log Normal file
View File

@ -0,0 +1,42 @@
From: Jeff Mahoney <jeffm@suse.com>
Subject: kdump: Save dmesg during dump
makedumpfile added a --dump-dmesg option in version 1.4.0. This allows
users to capture just the log messages rather than setting up a full
development environment to generate it.
It will also work on the generated vmcore, but just dumping in in
$DIR/$TIMESTAMP/dmesg.txt and asking users to attach that file to bug
reports is a lot easier for everyone involved.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
kdumptool/savedump.cc | 9 +++++++++
sysconfig.kdump | 5 +++--
2 files changed, 12 insertions(+), 2 deletions(-)
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -302,6 +302,14 @@ void SaveDump::saveDump()
m_useMakedumpfile = true;
}
+ // Save a copy of dmesg
+ DataProvider *logProvider;
+ string logDirectCmdline = "makedumpfile --dump-dmesg " + m_dump;
+ string logPipeCmdline = "makedumpfile --dump-dmesg -F " + m_dump;
+
+ logProvider = new ProcessDataProvider(logPipeCmdline.c_str(),
+ logDirectCmdline.c_str());
+
try {
Terminal terminal;
if (m_useMakedumpfile) {
@@ -314,6 +322,7 @@ void SaveDump::saveDump()
else
cout << "Saving dump ..." << endl;
m_transfer->perform(provider, "vmcore", &m_usedDirectSave);
+ m_transfer->perform(logProvider, "dmesg.txt", NULL);
if (m_useMakedumpfile)
terminal.printLine();
} catch (...) {

28
kdump-udev-rule Normal file
View File

@ -0,0 +1,28 @@
From: Jeff Mahoney <jeffm@suse.com>
Subject: kdump: Use correct script location in udev rule
The kdump init script is located at /etc/init.d/boot.kdump, so point there.
This fixes seeing a bunch of these messages during every boot:
Ä 12.264399Ü udevdÄ916Ü: failed to execute '/etc/init.d/kdump' '/etc/init.d/kdump try-restart': No such file or directory
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
70-kdump.rules | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/70-kdump.rules
+++ b/70-kdump.rules
@@ -5,8 +5,8 @@
# Novell Bug #389658
#
-SUBSYSTEM=="cpu", ACTION=="online", PROGRAM="/etc/init.d/kdump try-restart"
-SUBSYSTEM=="cpu", ACTION=="offline", PROGRAM="/etc/init.d/kdump try-restart"
-SUBSYSTEM=="memory", ACTION=="add", PROGRAM="/etc/init.d/kdump try-restart"
-SUBSYSTEM=="memory", ACTION=="remove", PROGRAM="/etc/init.d/kdump try-restart"
+SUBSYSTEM=="cpu", ACTION=="online", PROGRAM="/etc/init.d/boot.kdump try-restart"
+SUBSYSTEM=="cpu", ACTION=="offline", PROGRAM="/etc/init.d/boot.kdump try-restart"
+SUBSYSTEM=="memory", ACTION=="add", PROGRAM="/etc/init.d/boot.kdump try-restart"
+SUBSYSTEM=="memory", ACTION=="remove", PROGRAM="/etc/init.d/boot.kdump try-restart"

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Apr 11 03:45:19 UTC 2012 - jeffm@suse.com.
- kdump: Add 'none' format
- kdump: Allow format to be a list
- kdump: Save dmesg during dump
- kdump: Use correct script location in udev rule
-------------------------------------------------------------------
Sat Mar 17 15:23:22 UTC 2012 - dimstar@opensuse.org

View File

@ -44,6 +44,11 @@ Source: %{name}-%{version}.tar.bz2
Source2: %{name}-%{version}-rpmlintrc
Patch0: %{name}-fix-gcc46.diff
Patch1: kdump-gcc47.patch
Patch2: kdump-format-list
Patch3: kdump-save-log
Patch4: kdump-add-none-format
Patch5: kdump-udev-rule
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2)
Provides: kdump-helpers = 0.2.4
@ -79,6 +84,10 @@ Authors:
%setup
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
export CFLAGS="%optflags"