[PATCH v2 00/11] reuse NetworkManager connection profiles to set up kdump network
by Coiby Xu
Currently, kexec-tools parses legacy ifcfg-* configuration files or
NetworkManager .nmconnection connection profiles to build up dracut
command line parameters like ip=. Then dracut parses these parameters and
runs nm-initrd-generator to generate NetworkManager connection profiles.
Taking a bonding network as an example, nm-initrd-generator generates two
connections as follows,
$ /usr/libexec/nm-initrd-generator -s -- bootdev=mybond0 rd.neednet kdumpnic=mybond0 bond=mybond0:kdump-eth0
*** Connection 'mybond0' ***
[connection]
id=mybond0
uuid=ed87d02b-dd44-4f0e-8b11-37db7e89bb48
interface-name=mybond0
[ipv4]
dhcp-timeout=90
...
*** Connection 'kdump-eth0' ***
[connection]
id=kdump-eth0
uuid=ed6a7448-b5f8-4f8a-b718-3e24ea1c924b
type=ethernet
interface-name=kdump-eth0
master=ed87d02b-dd44-4f0e-8b11-37db7e89bb48
slave-type=bond
wait-device-timeout=60000
...
Later in kdump initrd, dracut starts NetworkManager to activate these
profiles to bring up the network connections. This way of setting up
kdump network is tedious, error-prone and unnecessary. A better way is
to directly copy the needed connection profiles to initrd. A potential
benefit of this approach for the users is they can simply edit the
connection profile directly like changing ipv4.dhcp-timeout instead of
being forced to use the hard-coded value enforced by
nm-initrd-generator.
This patch set reuses NetworkManager connection profiles to setup kdump
network. It also reduces the memory consumption of network drivers and
fix other issues at the same time. A machine could have multiple network
drivers and a network driver may manage multiple NICs. It's possible
kdump may only need one NIC. In this case, there is no need to install
unneeded network drivers or bring up unneeded NICs.
There are cases where a NIC may have a different name in the kdump
kernel. Currently, kexec-tools creates udev rules to rename NIC to have
a consistent name. With the new approach, we can simply ask NM to match
the connection profile by MAC address instead.
Here are the bug list that addressed by this patch set,
- Bug 1962421 - [RHEL-9]"eth0: Failed to rename network interface 3 from 'eth0' to 'kdump-eth0': File exists"
- Bug 2064708 - kdump: mkdumprd: failed to make kdump initrd for bridge network on z15 z/vm
- bugs related to OOM caused by network driver
- Bug 1950282 - shutdown those unneeded network interfaces to save memory for kdump
- Bug 1958587 - the kdump initramfs includes unnecessary NIC drivers for SSH/NFS dumping target
- Bug 1890021 - be2net is using too much memory during kdump
- Bug 1662202 - [RHEL-8.1] aarch64: hpe-apache crashkernel OOM when dump to network targe
Note this patch set is available for review on
https://github.com/coiby/kexec-tools/pull/9
v2:
- removes useless cat which also avoids SC2013
- fix code format issue and shellcheck warning
- squash four commits "set up kdump network {bridge,vlan,bridge,team} by directly
copying NM connection profile to initrd" to switch to the new approach
all at once to avoid confusion and causing trouble for git bisection
- fix several issues found by Philipp
- add missing reference
- use an array instead of supress shellchek SC2086 warning
- use $_netifs instead of $_netif_allowlist to intruct NM to only
manage specified NICs
- multiple typos
- use nmcli --get-values to get type first then construct MAC field
name
- get rid of the extra indentation
- s/uniq_name/unique_name/
v1:
- refactor complex kdump_copy_nmconnection_file [Philipp]
- clean up temporary file in a trap [Philipp]
- improve sed [Philipp]
- use long name consistently [Philipp]
- use nmcli -t, --terse option to suppress printing of the header [Philipp]
- don't pass kdumpip to initrd [Kairui]
- address the case where kdump_install_net is called multiple times like
fence kdump
- call kdump_install_nm_netif_allowlist after all kdump_install_net
calls have been finished
- ask NM to match a connection profile to a physical NIC by MAC address
- stop treating vlan specially when its parent interface is a physical NIC
- don't add unused NIC drivers to kdump initrd
- fix the error of "/etc/NetworkManager/system-connections/*.nmconnection" not exist
grep: /etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
- redirect the messages of nmcli to ddebug
- use "grep -s" to get rid of the following warnings
grep: /var/tmp/dracut.6tqUm0/initramfs//etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
grep: /etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
Coiby Xu (11):
add function to copy NetworkManage connection profile to the initramfs
clone NM connection profiles to support legacy ifcfg automatically
ask NM to wait the network device to be available
stop dracut 35network-manager from running nm-initrd-generator
fix error for vlan over team network interface
set up kdump network by directly copying NM connection profile to
initrd
clean up unneeded code after copying .nmconnection to initrd
reduce kdump memory consumption by not letting NetworkManager manage
unneeded network interfaces
reduce kdump memory consumption by only installing needed NIC drivers
address the cases where a NIC has a different name in kdump kernel
simplify setup_znet by copying connection profile to initrd
dracut-kdump.sh | 39 +-
dracut-module-setup.sh | 483 ++++++++----------
dracut-module-setup.sh.fix | 994 +++++++++++++++++++++++++++++++++++++
kdump-lib-initramfs.sh | 14 +
mkdumprd | 2 +-
5 files changed, 1243 insertions(+), 289 deletions(-)
create mode 100755 dracut-module-setup.sh.fix
--
2.37.1
1 year, 1 month
[PATCH v1 00/14] reuse NetworkManager connection profiles to set up kdump network
by Coiby Xu
Currently, kexec-tools parses legacy ifcfg-* configuration files or
NetworkManager .nmconnection connection profiles to build up dracut
command line parameters like ip=. Then dracut parses these parameters and
runs nm-initrd-generator to generate NetworkManager connection profiles.
Taking a bonding network as an example, nm-initrd-generator generates two
connections as follows,
$ /usr/libexec/nm-initrd-generator -s -- bootdev=mybond0 rd.neednet kdumpnic=mybond0 bond=mybond0:kdump-eth0
*** Connection 'mybond0' ***
[connection]
id=mybond0
uuid=ed87d02b-dd44-4f0e-8b11-37db7e89bb48
interface-name=mybond0
[ipv4]
dhcp-timeout=90
...
*** Connection 'kdump-eth0' ***
[connection]
id=kdump-eth0
uuid=ed6a7448-b5f8-4f8a-b718-3e24ea1c924b
type=ethernet
interface-name=kdump-eth0
master=ed87d02b-dd44-4f0e-8b11-37db7e89bb48
slave-type=bond
wait-device-timeout=60000
...
Later in kdump initrd, dracut starts NetworkManager to activate these
profiles to bring up the network connections. This way of setting up
kdump network is tedious, error-prone and unnecessary. A better way is
to directly copy the needed connection profiles to initrd. A potential
benefit of this approach for the users is they can simply edit the
connection profile directly like changing ipv4.dhcp-timeout instead of
being forced to use the hard-coded value enforced by
nm-initrd-generator.
This patch set reuses NetworkManager connection profiles to setup kdump
network. It also reduces the memory consumption of network drivers and
fix other issues at the same time. A machine could have multiple network
drivers and a network driver may manage multiple NICs. It's possible
kdump may only need one NIC. In this case, there is no need to install
unneeded network drivers or bring up unneeded NICs.
Here are the bug list that addressed by this patch set,
- Bug 1962421 - [RHEL-9]"eth0: Failed to rename network interface 3 from 'eth0' to 'kdump-eth0': File exists"
- Bug 2064708 - kdump: mkdumprd: failed to make kdump initrd for bridge network on z15 z/vm
- bugs related to OOM caused by network driver
- Bug 1950282 - shutdown those unneeded network interfaces to save memory for kdump
- Bug 1958587 - the kdump initramfs includes unnecessary NIC drivers for SSH/NFS dumping target
- Bug 1890021 - be2net is using too much memory during kdump
- Bug 1662202 - [RHEL-8.1] aarch64: hpe-apache crashkernel OOM when dump to network targe
v1:
- refactor complex kdump_copy_nmconnection_file [Philipp]
- clean up temporary file in a trap [Philipp]
- improve sed [Philipp]
- use long name consistently [Philipp]
- use nmcli -t, --terse option to suppress printing of the header [Philipp]
- don't pass kdumpip to initrd [Kairui]
- address the case where kdump_install_net is called multiple times like
fence kdump
- call kdump_install_nm_netif_allowlist after all kdump_install_net
calls have been finished
- ask NM to match a connection profile to a physical NIC by MAC address
- stop treating vlan specially when its parent interface is a physical NIC
- don't add unused NIC drivers to kdump initrd
- fix the error of "/etc/NetworkManager/system-connections/*.nmconnection" not exist
grep: /etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
- redirect the messages of nmcli to ddebug
- use "grep -s" to get rid of the following warnings
grep: /var/tmp/dracut.6tqUm0/initramfs//etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
grep: /etc/NetworkManager/system-connections/*.nmconnection: No such file or directory
Coiby Xu (14):
add function to copy NetworkManage connection profile to the initramfs
clone NM connection profiles to support legacy ifcfg automatically
ask NM to wait the network device to be available
stop dracut 35network-manager from running nm-initrd-generator
set up kdump network bridge by directly copying NM connection profile
to initrd
set up kdump bonding network by directly copying NM connection profile
to initrd
fix error for vlan over team network interface
set up kdump vlan network by directly copying NM connection profile to
initrd
set up kdump teaming network by directly copying NM connection profile
to initrd
clean up unneeded code after copying .nmconnection to initrd
reduce kdump memory consumption by not letting NetworkManager manage
unneeded network interfaces
reduce kdump memory consumption by only installing needed NIC drivers
address the cases where a NIC has a different name in kdump kernel
simplify setup_znet by copying connection profile to initrd
dracut-kdump.sh | 25 ++-
dracut-module-setup.sh | 484 ++++++++++++++++++-----------------------
kdump-lib-initramfs.sh | 12 +
mkdumprd | 2 +-
4 files changed, 239 insertions(+), 284 deletions(-)
--
2.35.3
1 year, 1 month
[PATCH] kdumpctl: make the kdump.log root-readable-only
by Lichen Liu
Decrease the risk that of leaking information that could potentially
be used to exploit the crash further (think location of keys).
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
---
kdumpctl | 1 +
1 file changed, 1 insertion(+)
diff --git a/kdumpctl b/kdumpctl
index 126ecb9..0e37d36 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -691,6 +691,7 @@ load_kdump()
# and release it.
exec 12>&2
exec 2>> $KDUMP_LOG_PATH/kdump.log
+ chmod 600 $KDUMP_LOG_PATH/kdump.log
PS4='+ $(date "+%Y-%m-%d %H:%M:%S") ${BASH_SOURCE}@${LINENO}: '
set -x
--
2.31.1
1 year, 3 months
[PATCH 00/24] Enable Github Action
by Coiby Xu
This patch set adds support for a new Github-based workflow so it's
easier to run the tests as early and as often as possible. Hopefully as
a result, the bugs can be prevented or fixed early.
Four kinds of tests are triggered when there is a pull request created
in a Github kexec-tools repo [1],
- format check using shfmt
- static analysis using shellcheck
- ShellSpec unit tests (test cases in spec/)
- integration tests ( tests cases in tests/)
Before enabling Github Action, I've gone through all the test failures
most of which are shellcheck warnings to make all tests have green
status [2]. Because there are so many test warnings from shellcheck, it
makes it difficult to find new test failures. Despite a few false
positives, most warnings are valuable and make the code more robust.
This patch set is also available for review on [1].
Why Github over Gilab?
======================
The biggest reason is Gitlab doesn't doesn't allow merge request from
forked project to use a specific runner i.e. our own testing machine to
run the tests [3] (I have to use a specific runner because Gitlab's
shared runners are very slow. For example, it takes ~3 hours to finish
current integration tests while it can be finished in ~8min using our
own testing machine). A second reason if out of security concern.
Currently for Gitlab specific runner, we need to run the Docker as root
which makes the testing machine quite vulnerable.
[1] https://github.com/coiby/kexec-tools/pull/1
[2] https://github.com/coiby/kexec-tools/runs/7987323055?check_suite_focus=true
[3] https://www.google.com/url?q=https://pagure.io/fedora-infrastructure/issu...
Coiby Xu (24):
format code using shfmt
fix shellcheck warnings for dracut-early-kdump-module-setup.sh
fix shellcheck warnings for dracut-early-kdump.sh
fix shellcheck errors of dracut-fadump-init-fadump.sh
Disable shellcheck rule SC2154 for variables defined by dracut
Eliminate shellcheck SC2129 warnings
Eliminate shellcheck SC2086 warnings
Eliminate shellcheck SC2029 warnings
Eliminate shellcheck SC2034 warnings
Eliminate shellcheck SC2181 warnings
Eliminate shellcheck SC2154 warning
Eliminate shellcheck SC2005 warning
Eliminate shellcheck SC2046 warning
Eliminate shellcheck SC1004 warning
Eliminate shellcheck SC2295 warnings
Eliminate shellcheck SC2295 warnings
Eliminate shellcheck SC2013 warning
Eliminate shellcheck SC2030 and SC2031 warnings
Make kdump-logger.sh fully POSIX-compatible
Eliminate shellcheck warnings in kdump-lib.sh
Eliminate shellcheck warning in spec/kdumpctl_general_spec.sh
tests: use guestmount to mount a qemu image when USE_GUESTMOUNT=1
tests: make QEMU instance timeout configurable
tests: enable Github action
.github/workflows/main.yml | 53 ++++
dracut-early-kdump-module-setup.sh | 4 +-
dracut-early-kdump.sh | 87 ++++---
dracut-fadump-init-fadump.sh | 6 +-
dracut-fadump-module-setup.sh | 2 +
dracut-kdump.sh | 27 +-
dracut-module-setup.sh | 42 ++--
kdump-dep-generator.sh | 6 +-
kdump-lib-initramfs.sh | 8 +-
kdump-lib.sh | 34 +--
kdump-logger.sh | 388 ++++++++++++++++-------------
kdump-migrate-action.sh | 5 +-
kdump-restart.sh | 2 +-
kdumpctl | 66 ++---
mkdumprd | 1 +
mkfadumprd | 2 +
spec/kdumpctl_general_spec.sh | 2 +
tests/scripts/build-image.sh | 6 +
tests/scripts/image-init-lib.sh | 94 +++++--
tests/scripts/test-lib.sh | 10 +-
tools/run-integration-tests.sh | 29 +++
21 files changed, 540 insertions(+), 334 deletions(-)
create mode 100644 .github/workflows/main.yml
create mode 100755 tools/run-integration-tests.sh
--
2.37.1
1 year, 3 months
[PATCH v2] Seperate dracut and dracut-squash compressor for zstd
by Tao Liu
Previously kexec-tools will pass "--compress zstd" to dracut. It
will make dracut to decide whether: a) call mksquashfs to make a
zstd format squash-root.img, b) call cmd zstd to make a initramfs.
Currently dracut has decoupled the compressor for dracut and
dracut-squash, So in this patch, we will pass the compressor seperately.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
v1 -> v2:
1) Add a checker if dracut doesn't have "--squash-compressor"
option.
2) Removed the "Recommends: zstd" in spec file. Since it is optional
and won't break any function if not present.
---
kdump-lib.sh | 7 ++++++-
kexec-tools.spec | 1 -
mkdumprd | 7 +++----
mkfadumprd | 4 +++-
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index d362e84..77a51d6 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -37,6 +37,11 @@ is_zstd_command_available()
[[ -x "$(command -v zstd)" ]]
}
+dracut_have_squash_compressor_option()
+{
+ ! $(dracut --squash-compressor 2>&1 | grep -q "unrecognized option")
+}
+
perror_exit()
{
derror "$@"
@@ -458,7 +463,7 @@ is_wdt_active()
have_compression_in_dracut_args()
{
[[ "$(kdump_get_conf_val dracut_args)" =~ \
- (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$) ]]
+ (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress|squash-compressor)([[:space:]]|$) ]]
}
# If "dracut_args" contains "--mount" information, use it
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 24c616d..7e8fa9c 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -70,7 +70,6 @@ Requires: dracut >= 050
Requires: dracut-network >= 050
Requires: dracut-squash >= 050
Requires: ethtool
-Recommends: zstd
Recommends: grubby
Recommends: hostname
BuildRequires: make
diff --git a/mkdumprd b/mkdumprd
index 3e250e0..ae2e790 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -432,10 +432,9 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
if ! have_compression_in_dracut_args; then
- # Here zstd is set as the default compression method. If squash module
- # is available for dracut, libzstd will be used by mksquashfs. If
- # squash module is unavailable, command zstd will be used instead.
- if is_squash_available || is_zstd_command_available; then
+ if is_squash_available && dracut_have_squash_compressor_option; then
+ add_dracut_arg "--squash-compressor" "zstd"
+ elif is_zstd_command_available; then
add_dracut_arg "--compress" "zstd"
fi
fi
diff --git a/mkfadumprd b/mkfadumprd
index 86dfcee..f3fd282 100644
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -64,7 +64,9 @@ fi
# Same as setting zstd in mkdumprd
if ! have_compression_in_dracut_args; then
- if is_squash_available || is_zstd_command_available; then
+ if is_squash_available && dracut_have_squash_compressor_option; then
+ _dracut_isolate_args+=(--squash-compressor zstd)
+ elif is_zstd_command_available; then
_dracut_isolate_args+=(--compress zstd)
fi
fi
--
2.33.1
1 year, 3 months
[PATCH v5 0/5] Add lvm2 thin provision support for kdump
by Tao Liu
Thin provision is a mechanism that you can allocate a lvm volume which has
a large virtual size for file systems but actually in a small physical
size. The physical size can be autoextended in use if thin pool reached a
threshold specified in /etc/lvm/lvm.conf.
There are 2 works should be handled when enable lvm2 thinp for kdump:
1) Check if the dump target device or directory is thinp device.
2) Monitor the thin pool and autoextend its size when it reached the threshold
during kdump.
According to my testing, the memory consumption procedure for lvm2 thinp is the thin pool
size-autoextend phase. For fedora and rhel9, the default crashkernel value is enough. But
for rhel8, the default crashkernel value 1G-4G:160M is not enough, so it should
be handled particularly.
v1 -> v2:
1) Modified the usage of lvs cmd when check if target is lvm2 thinp
device.
2) Removed the sync flag way of mounting for lvm2 thinp target
during kdump, use "sync -f vmcore" to force sync data, and handle
the error if fails.
v2 -> v3:
1) Removed "sync -f vmcore" patch out of the patch set, for it is
addressing an issue which is not specifically to lvm2 thinp support for
kdump.
v3 -> v4:
1) Removed lvm2-monitor.service, implemented the monitor service with
a loop function within a shell script instead.
2) Add lvm2 thinp support for dump_raw, for it is addressing the similar
issue as dump_fs.
3) Dave suggested me to implement the lvm2 thin support in dracut
modules instead of kexec-tools. If you are OK with the loop-function-shell-script
technical way, I will give a try to migrate it to dracut.
v4 -> v5:
1) A new 80lvmthinpool-monitor module [1] has been integrated in dracut.
Now we simply depend on it.
2) Add lvm2 thin provision selftest.
[1]: https://github.com/dracutdevs/dracut/pull/1842
Tao Liu (5):
Add lvm2 thin provision dump target checker
lvm.conf should be check modified if lvm2 thinp enabled
Add dependency of dracut lvmthinpool-monitor module
selftest: Only iterate the .sh files for test execution
selftest: Add lvm2 thin provision for kdump test
dracut-module-setup.sh | 4 ++
kdump-lib-initramfs.sh | 10 ++++
kdump-lib.sh | 10 ++++
kdumpctl | 1 +
tests/scripts/run-test.sh | 4 +-
.../lvm2-thinp-kdump/0-local-lvm2-thinp.sh | 59 +++++++++++++++++++
.../testcases/lvm2-thinp-kdump/lvm.conf | 5 ++
7 files changed, 91 insertions(+), 2 deletions(-)
create mode 100755 tests/scripts/testcases/lvm2-thinp-kdump/0-local-lvm2-thinp.sh
create mode 100644 tests/scripts/testcases/lvm2-thinp-kdump/lvm.conf
--
2.33.1
1 year, 3 months
[PATCH v2 1/2] virtiofs support for kexec-tools
by Tao Liu
This patch add virtiofs support for kexec-tools by introducing a new option
for /etc/kdump.conf:
virtiofs myfs
Where myfs is a variable tag name specified in qemu cmdline
"-device vhost-user-fs-pci,tag=myfs".
The patch covers the following cases:
1) Dumping VM's vmcore to a virtiofs shared directory;
2) When the VM's rootfs is a virtiofs shared directory and dumping the
VM's vmcore to its subdirectory, such as /var/crash;
3) The combination of case 1 & 2: The VM's rootfs is a virtiofs shared
directory and dumping the VM's vmcore to another virtiofs shared
directory.
Note: This feature reqiures dracut >= 057
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
v1 -> v2:
1) Bump the dracut version to 057
2) Merged get_user_configured_dump_disk() to get_block_dump_target()
since the latter is the only user.
3) Updated kdump.conf with supported fstype
---
dracut-kdump.sh | 2 +-
dracut-module-setup.sh | 2 +-
kdump-lib-initramfs.sh | 24 +++++++++++++++++++++++-
kdump-lib.sh | 32 ++++++++++++++------------------
kdump.conf | 2 ++
kdumpctl | 6 +++---
mkdumprd | 2 +-
7 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index f4456a1..5c980a8 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -519,7 +519,7 @@ read_kdump_confs()
DUMP_INSTRUCTION="dump_fs $config_val"
fi
;;
- ext[234] | xfs | btrfs | minix | nfs)
+ ext[234] | xfs | btrfs | minix | nfs | virtiofs)
config_val=$(get_mntpoint_from_target "$config_val")
DUMP_INSTRUCTION="dump_fs $config_val"
;;
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4c6096a..a790a93 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -673,7 +673,7 @@ kdump_install_conf() {
_pdev=$(persistent_policy="by-id" kdump_get_persistent_dev "$_val")
sed -i -e "s#^${_opt}[[:space:]]\+$_val#$_opt $_pdev#" "${initdir}/tmp/$$-kdump.conf"
;;
- ext[234] | xfs | btrfs | minix)
+ ext[234] | xfs | btrfs | minix | virtiofs)
_pdev=$(kdump_get_persistent_dev "$_val")
sed -i -e "s#^${_opt}[[:space:]]\+$_val#$_opt $_pdev#" "${initdir}/tmp/$$-kdump.conf"
;;
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 84e6bf7..e982b14 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -55,6 +55,11 @@ is_fs_type_nfs()
[ "$1" = "nfs" ] || [ "$1" = "nfs4" ]
}
+is_fs_type_virtiofs()
+{
+ [ "$1" = "virtiofs" ]
+}
+
# If $1 contains dracut_args "--mount", return <filesystem type>
get_dracut_args_fstype()
{
@@ -110,6 +115,23 @@ is_raw_dump_target()
[ -n "$(kdump_get_conf_val raw)" ]
}
+is_virtiofs_dump_target()
+{
+ if [ -n "$(kdump_get_conf_val virtiofs)" ]; then
+ return 0
+ fi
+
+ if is_fs_type_virtiofs "$(get_dracut_args_fstype "$(kdump_get_conf_val dracut_args)")"; then
+ return 0
+ fi
+
+ if is_fs_type_virtiofs "$(get_fs_type_from_target "$(get_target_from_path "$(get_save_path)")")"; then
+ return 0
+ fi
+
+ return 1
+}
+
is_nfs_dump_target()
{
if [ -n "$(kdump_get_conf_val nfs)" ]; then
@@ -129,5 +151,5 @@ is_nfs_dump_target()
is_fs_dump_target()
{
- [ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix")" ]
+ [ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|virtiofs")" ]
}
diff --git a/kdump-lib.sh b/kdump-lib.sh
index f7b659e..f5e3cd8 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -81,35 +81,30 @@ to_dev_name()
is_user_configured_dump_target()
{
- [[ $(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw\|nfs\|ssh") ]] || is_mount_in_dracut_args
-}
-
-get_user_configured_dump_disk()
-{
- local _target
-
- _target=$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw")
- [[ -n $_target ]] && echo "$_target" && return
-
- _target=$(get_dracut_args_target "$(kdump_get_conf_val "dracut_args")")
- [[ -b $_target ]] && echo "$_target"
+ [[ $(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw\|nfs\|ssh\|virtiofs") ]] || is_mount_in_dracut_args
}
get_block_dump_target()
{
- local _target _path
+ local _target
if is_ssh_dump_target || is_nfs_dump_target; then
return
fi
- _target=$(get_user_configured_dump_disk)
+ _target=$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw\|virtiofs")
[[ -n $_target ]] && to_dev_name "$_target" && return
- # Get block device name from local save path
- _path=$(get_save_path)
- _target=$(get_target_from_path "$_path")
- [[ -b $_target ]] && to_dev_name "$_target"
+ _target=$(get_dracut_args_target "$(kdump_get_conf_val "dracut_args")")
+ [[ -b $_target ]] && to_dev_name "$_target" && return
+
+ _fstype=$(get_dracut_args_fstype "$(kdump_get_conf_val "dracut_args")")
+ is_fs_type_virtiofs "$_fstype" && echo "$_target" && return
+
+ _target=$(get_target_from_path "$(get_save_path)")
+ [[ -b $_target ]] && to_dev_name "$_target" && return
+
+ is_fs_type_virtiofs "$(get_fs_type_from_target "$_target")" && echo "$_target" && return
}
is_dump_to_rootfs()
@@ -125,6 +120,7 @@ get_failure_action_target()
# Get rootfs device name
_target=$(get_root_fs_device)
[[ -b $_target ]] && to_dev_name "$_target" && return
+ is_fs_type_virtiofs "$(get_fs_type_from_target "$_target")" && echo "$_target" && return
# Then, must be nfs root
echo "nfs"
fi
diff --git a/kdump.conf b/kdump.conf
index d4fc78b..e598a49 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -43,6 +43,7 @@
# It's recommended to use persistent device names
# such as /dev/vg/<devname>.
# Otherwise it's suggested to use label or uuid.
+# Supported fs types: ext[234], xfs, btrfs, minix, virtiofs
#
# path <path>
# - "path" represents the file system path in which vmcore
@@ -171,6 +172,7 @@
#ext4 /dev/vg/lv_kdump
#ext4 LABEL=/boot
#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
+#virtiofs myfs
#nfs my.server.com:/export/tmp
#nfs [2001:db8::1:2:3:4]:/export/tmp
#ssh user(a)my.server.com
diff --git a/kdumpctl b/kdumpctl
index 126ecb9..5b0e5fd 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -239,7 +239,7 @@ parse_config()
_set_config _fstype "$config_opt" || return 1
config_opt=_target
;;
- ext[234] | minix | btrfs | xfs | nfs | ssh)
+ ext[234] | minix | btrfs | xfs | nfs | ssh | virtiofs)
_set_config _fstype "$config_opt" || return 1
config_opt=_target
;;
@@ -478,8 +478,8 @@ check_fs_modified()
fi
# No need to check in case of raw target.
- # Currently we do not check also if ssh/nfs target is specified
- if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
+ # Currently we do not check also if ssh/nfs/virtiofs target is specified
+ if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_virtiofs_dump_target; then
return 0
fi
diff --git a/mkdumprd b/mkdumprd
index 3e250e0..958698e 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -391,7 +391,7 @@ while read -r config_opt config_val; do
extra_modules)
extra_modules="$extra_modules $config_val"
;;
- ext[234] | xfs | btrfs | minix | nfs)
+ ext[234] | xfs | btrfs | minix | nfs | virtiofs)
check_user_configured_target "$config_val" "$config_opt"
add_mount "$config_val" "$config_opt"
;;
--
2.33.1
1 year, 3 months
[PATCH] Seperate dracut and dracut-squash compressor for zstd
by Tao Liu
Previously kexec-tools will pass "--compress zstd" to dracut. It
will make dracut to decide whether: a) call mksquashfs to make a
zstd format squash-root.img, b) call cmd zstd to make a initramfs.
Currently dracut has decoupled the compressor for dracut and
dracut-squash, So in this patch, we will pass the compressor seperately.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 2 +-
mkdumprd | 7 +++----
mkfadumprd | 4 +++-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index f32b802..c59a25f 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -462,7 +462,7 @@ is_wdt_active()
have_compression_in_dracut_args()
{
[[ "$(kdump_get_conf_val dracut_args)" =~ \
- (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$) ]]
+ (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress|squash-compressor)([[:space:]]|$) ]]
}
# If "dracut_args" contains "--mount" information, use it
diff --git a/mkdumprd b/mkdumprd
index 3e250e0..01eabcb 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -432,10 +432,9 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
if ! have_compression_in_dracut_args; then
- # Here zstd is set as the default compression method. If squash module
- # is available for dracut, libzstd will be used by mksquashfs. If
- # squash module is unavailable, command zstd will be used instead.
- if is_squash_available || is_zstd_command_available; then
+ if is_squash_available; then
+ add_dracut_arg "--squash-compressor" "zstd"
+ elif is_zstd_command_available; then
add_dracut_arg "--compress" "zstd"
fi
fi
diff --git a/mkfadumprd b/mkfadumprd
index 86dfcee..cd76fc8 100644
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -64,7 +64,9 @@ fi
# Same as setting zstd in mkdumprd
if ! have_compression_in_dracut_args; then
- if is_squash_available || is_zstd_command_available; then
+ if is_squash_available; then
+ _dracut_isolate_args+=(--squash-compressor zstd)
+ elif is_zstd_command_available; then
_dracut_isolate_args+=(--compress zstd)
fi
fi
--
2.33.1
1 year, 3 months
[PATCH] virtiofs support for kexec-tools
by Tao Liu
This patch add virtiofs support for kexec-tools by introducing a new option
for /etc/kdump.conf:
virtiofs myfs
Where myfs is a variable tag name specified in qemu cmdline
"-device vhost-user-fs-pci,tag=myfs".
The patch covers the following cases:
1) Dumping VM's vmcore to a virtiofs shared directory;
2) When the VM's rootfs is a virtiofs shared directory and dumping the
VM's vmcore to its subdirectory, such as /var/crash;
3) The combination of case 1 & 2: The VM's rootfs is a virtiofs shared
directory and dumping the VM's vmcore to another virtiofs shared
directory.
Note: This feature reqiures dracut >= 057
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
dracut-kdump.sh | 2 +-
dracut-module-setup.sh | 2 +-
kdump-lib-initramfs.sh | 17 ++++++++++++++++-
kdump-lib.sh | 15 ++++++++++-----
kdump.conf | 1 +
kdumpctl | 6 +++---
mkdumprd | 2 +-
7 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index f4456a1..5c980a8 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -519,7 +519,7 @@ read_kdump_confs()
DUMP_INSTRUCTION="dump_fs $config_val"
fi
;;
- ext[234] | xfs | btrfs | minix | nfs)
+ ext[234] | xfs | btrfs | minix | nfs | virtiofs)
config_val=$(get_mntpoint_from_target "$config_val")
DUMP_INSTRUCTION="dump_fs $config_val"
;;
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4c6096a..a790a93 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -673,7 +673,7 @@ kdump_install_conf() {
_pdev=$(persistent_policy="by-id" kdump_get_persistent_dev "$_val")
sed -i -e "s#^${_opt}[[:space:]]\+$_val#$_opt $_pdev#" "${initdir}/tmp/$$-kdump.conf"
;;
- ext[234] | xfs | btrfs | minix)
+ ext[234] | xfs | btrfs | minix | virtiofs)
_pdev=$(kdump_get_persistent_dev "$_val")
sed -i -e "s#^${_opt}[[:space:]]\+$_val#$_opt $_pdev#" "${initdir}/tmp/$$-kdump.conf"
;;
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 84e6bf7..895544d 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -110,6 +110,21 @@ is_raw_dump_target()
[ -n "$(kdump_get_conf_val raw)" ]
}
+is_virtiofs_dump_target()
+{
+ if [ -n "$(kdump_get_conf_val virtiofs)" ]; then
+ return 0
+ fi
+
+ _path=$(kdump_get_conf_val path)
+ _path=${_path:-$DEFAULT_PATH}
+ if [ "$(df "$_path" --output=fstype | tail -1)" = "virtiofs" ]; then
+ return 0
+ fi
+
+ return 1
+}
+
is_nfs_dump_target()
{
if [ -n "$(kdump_get_conf_val nfs)" ]; then
@@ -129,5 +144,5 @@ is_nfs_dump_target()
is_fs_dump_target()
{
- [ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix")" ]
+ [ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|virtiofs")" ]
}
diff --git a/kdump-lib.sh b/kdump-lib.sh
index f7b659e..0946196 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -81,18 +81,21 @@ to_dev_name()
is_user_configured_dump_target()
{
- [[ $(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw\|nfs\|ssh") ]] || is_mount_in_dracut_args
+ [[ $(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw\|nfs\|ssh\|virtiofs") ]] || is_mount_in_dracut_args
}
get_user_configured_dump_disk()
{
- local _target
+ local _target _fstype
- _target=$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw")
+ _target=$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw\|virtiofs")
[[ -n $_target ]] && echo "$_target" && return
_target=$(get_dracut_args_target "$(kdump_get_conf_val "dracut_args")")
- [[ -b $_target ]] && echo "$_target"
+ [[ -b $_target ]] && echo "$_target" && return
+
+ _fstype=$(get_dracut_args_fstype "$(kdump_get_conf_val "dracut_args")")
+ [[ "$_fstype" == "virtiofs" ]] && echo "$_target"
}
get_block_dump_target()
@@ -109,7 +112,8 @@ get_block_dump_target()
# Get block device name from local save path
_path=$(get_save_path)
_target=$(get_target_from_path "$_path")
- [[ -b $_target ]] && to_dev_name "$_target"
+ [[ -b $_target ]] && to_dev_name "$_target" && return
+ [ "$(findmnt -k -n -r -S "$_target" -o fstype)" = "virtiofs" ] && echo "$_target" && return
}
is_dump_to_rootfs()
@@ -125,6 +129,7 @@ get_failure_action_target()
# Get rootfs device name
_target=$(get_root_fs_device)
[[ -b $_target ]] && to_dev_name "$_target" && return
+ [ "$(findmnt -k -n -r -S "$_target" -o fstype)" = "virtiofs" ] && echo "$_target" && return
# Then, must be nfs root
echo "nfs"
fi
diff --git a/kdump.conf b/kdump.conf
index d4fc78b..fc2ebf1 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -176,6 +176,7 @@
#ssh user(a)my.server.com
#ssh user@2001:db8::1:2:3:4
#sshkey /root/.ssh/kdump_id_rsa
+#virtiofs myfs
auto_reset_crashkernel yes
path /var/crash
core_collector makedumpfile -l --message-level 7 -d 31
diff --git a/kdumpctl b/kdumpctl
index 126ecb9..5b0e5fd 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -239,7 +239,7 @@ parse_config()
_set_config _fstype "$config_opt" || return 1
config_opt=_target
;;
- ext[234] | minix | btrfs | xfs | nfs | ssh)
+ ext[234] | minix | btrfs | xfs | nfs | ssh | virtiofs)
_set_config _fstype "$config_opt" || return 1
config_opt=_target
;;
@@ -478,8 +478,8 @@ check_fs_modified()
fi
# No need to check in case of raw target.
- # Currently we do not check also if ssh/nfs target is specified
- if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
+ # Currently we do not check also if ssh/nfs/virtiofs target is specified
+ if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_virtiofs_dump_target; then
return 0
fi
diff --git a/mkdumprd b/mkdumprd
index 3e250e0..958698e 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -391,7 +391,7 @@ while read -r config_opt config_val; do
extra_modules)
extra_modules="$extra_modules $config_val"
;;
- ext[234] | xfs | btrfs | minix | nfs)
+ ext[234] | xfs | btrfs | minix | nfs | virtiofs)
check_user_configured_target "$config_val" "$config_opt"
add_mount "$config_val" "$config_opt"
;;
--
2.33.1
1 year, 3 months
[PATCH v4] sysconfig: use a simple generator script to maintain
by Kairui Song
From: Kairui Song <kasong(a)tencent.com>
These kdump.sysconfig.* files are almost identical with a bit difference
in several parameters, just use a simple script to generate them upon
packaging. This should make it easier to maintain, updating a comment or
param for a certain arch can be done in one place.
There are only some comment or empty option differences with the generated
version because some arch's sysconfig is not up-to-dated, this actually
fixes the issue, I used the following script to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do
./gen-kdump-sysconfig.sh $arch > kdump.sysconfig.$arch.new
git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null
echo "$arch:"
diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo ""
done; git reset;
Signed-off-by: Kairui Song <kasong(a)tencent.com>
Reviewed-by: Philipp Rudo <prudo(a)redhat.com>
---
Update from V3:
- Rebase to latest code base.
- Simplify commit message.
Update from V2:
- Rebase to latest code base.
- Simplify commit message.
Update from V1:
- Use a here doc to include the template inline the script.
- Print a warning for unknown arch.
Thanks to Philipp for these suggestion.
kdump.sysconfig => gen-kdump-sysconfig.sh | 59 +++++++++++++++++++++++
kdump.sysconfig.aarch64 | 53 --------------------
kdump.sysconfig.i386 | 56 ---------------------
kdump.sysconfig.ppc64 | 58 ----------------------
kdump.sysconfig.ppc64le | 58 ----------------------
kdump.sysconfig.s390x | 59 -----------------------
kdump.sysconfig.x86_64 | 56 ---------------------
kexec-tools.spec | 17 ++-----
8 files changed, 64 insertions(+), 352 deletions(-)
rename kdump.sysconfig => gen-kdump-sysconfig.sh (50%)
mode change 100644 => 100755
delete mode 100644 kdump.sysconfig.aarch64
delete mode 100644 kdump.sysconfig.i386
delete mode 100644 kdump.sysconfig.ppc64
delete mode 100644 kdump.sysconfig.ppc64le
delete mode 100644 kdump.sysconfig.s390x
delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump.sysconfig b/gen-kdump-sysconfig.sh
old mode 100644
new mode 100755
similarity index 50%
rename from kdump.sysconfig
rename to gen-kdump-sysconfig.sh
index c1143f3..d9a500e
--- a/kdump.sysconfig
+++ b/gen-kdump-sysconfig.sh
@@ -1,3 +1,10 @@
+#!/bin/bash
+# $1: target arch
+
+SED_EXP=""
+
+generate() {
+sed "$SED_EXP" <<EOF
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
# If no version is specified, then the init script will try to find a
# kdump kernel with the same version number as the running kernel.
@@ -36,6 +43,9 @@ KEXEC_ARGS=""
#What is the image type used for kdump
KDUMP_IMG="vmlinuz"
+#What is the images extension. Relocatable kernels don't have one
+KDUMP_IMG_EXT=""
+
# Logging is controlled by following variables in the first kernel:
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
@@ -51,3 +61,52 @@ KDUMP_IMG="vmlinuz"
# KDUMP_STDLOGLVL=3
# KDUMP_SYSLOGLVL=0
# KDUMP_KMSGLOGLVL=0
+EOF
+}
+
+update_param()
+{
+ SED_EXP="${SED_EXP}s/^$1=.*$/$1=\"$2\"/;"
+}
+
+case "$1" in
+aarch64)
+ update_param KEXEC_ARGS "-s"
+ update_param KDUMP_COMMANDLINE_APPEND \
+ "irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
+ ;;
+i386)
+ update_param KDUMP_COMMANDLINE_APPEND \
+ "irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
+ ;;
+ppc64)
+ update_param KEXEC_ARGS "--dt-no-old-root"
+ update_param KDUMP_COMMANDLINE_REMOVE \
+ "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma ignition.firstboot"
+ update_param KDUMP_COMMANDLINE_APPEND \
+ "irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
+ ;;
+ppc64le)
+ update_param KEXEC_ARGS "--dt-no-old-root -s"
+ update_param KDUMP_COMMANDLINE_REMOVE \
+ "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma ignition.firstboot"
+ update_param KDUMP_COMMANDLINE_APPEND \
+ "irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
+ ;;
+s390x)
+ update_param KEXEC_ARGS "-s"
+ update_param KDUMP_COMMANDLINE_REMOVE \
+ "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt ignition.firstboot"
+ update_param KDUMP_COMMANDLINE_APPEND \
+ "nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
+ ;;
+x86_64)
+ update_param KEXEC_ARGS "-s"
+ update_param KDUMP_COMMANDLINE_APPEND \
+ "irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
+ ;;
+*)
+ echo "Warning: Unknown architecture '$1', using default sysconfig template."
+esac
+
+generate
diff --git a/kdump.sysconfig.aarch64 b/kdump.sysconfig.aarch64
deleted file mode 100644
index df75f94..0000000
--- a/kdump.sysconfig.aarch64
+++ /dev/null
@@ -1,53 +0,0 @@
-# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
-# If no version is specified, then the init script will try to find a
-# kdump kernel with the same version number as the running kernel.
-KDUMP_KERNELVER=""
-
-# The kdump commandline is the command line that needs to be passed off to
-# the kdump kernel. This will likely match the contents of the grub kernel
-# line. For example:
-# KDUMP_COMMANDLINE="ro root=LABEL=/"
-# Dracut depends on proper root= options, so please make sure that appropriate
-# root= options are copied from /proc/cmdline. In general it is best to append
-# command line options using "KDUMP_COMMANDLINE_APPEND=".
-# If a command line is not specified, the default will be taken from
-# /proc/cmdline
-KDUMP_COMMANDLINE=""
-
-# This variable lets us remove arguments from the current kdump commandline
-# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma ignition.firstboot"
-
-# This variable lets us append arguments to the current kdump commandline
-# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
-
-# Any additional kexec arguments required. In most situations, this should
-# be left empty
-#
-# Example:
-# KEXEC_ARGS="--elf32-core-headers"
-KEXEC_ARGS="-s"
-
-#Where to find the boot image
-#KDUMP_BOOTDIR="/boot"
-
-#What is the image type used for kdump
-KDUMP_IMG="vmlinuz"
-
-# Logging is controlled by following variables in the first kernel:
-# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
-# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
-# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
-#
-# In the second kernel, kdump will use the rd.kdumploglvl option to set the
-# log level in the above KDUMP_COMMANDLINE_APPEND.
-# - @var rd.kdumploglvl - logging level to syslog (by logger command)
-# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
-#
-# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
-#
-# KDUMP_STDLOGLVL=3
-# KDUMP_SYSLOGLVL=0
-# KDUMP_KMSGLOGLVL=0
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386
deleted file mode 100644
index d8bf5f6..0000000
--- a/kdump.sysconfig.i386
+++ /dev/null
@@ -1,56 +0,0 @@
-# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
-# If no version is specified, then the init script will try to find a
-# kdump kernel with the same version number as the running kernel.
-KDUMP_KERNELVER=""
-
-# The kdump commandline is the command line that needs to be passed off to
-# the kdump kernel. This will likely match the contents of the grub kernel
-# line. For example:
-# KDUMP_COMMANDLINE="ro root=LABEL=/"
-# Dracut depends on proper root= options, so please make sure that appropriate
-# root= options are copied from /proc/cmdline. In general it is best to append
-# command line options using "KDUMP_COMMANDLINE_APPEND=".
-# If a command line is not specified, the default will be taken from
-# /proc/cmdline
-KDUMP_COMMANDLINE=""
-
-# This variable lets us remove arguments from the current kdump commandline
-# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma ignition.firstboot"
-
-# This variable lets us append arguments to the current kdump commandline
-# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
-
-# Any additional kexec arguments required. In most situations, this should
-# be left empty
-#
-# Example:
-# KEXEC_ARGS="--elf32-core-headers"
-KEXEC_ARGS=""
-
-#Where to find the boot image
-#KDUMP_BOOTDIR="/boot"
-
-#What is the image type used for kdump
-KDUMP_IMG="vmlinuz"
-
-#What is the images extension. Relocatable kernels don't have one
-KDUMP_IMG_EXT=""
-
-# Logging is controlled by following variables in the first kernel:
-# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
-# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
-# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
-#
-# In the second kernel, kdump will use the rd.kdumploglvl option to set the
-# log level in the above KDUMP_COMMANDLINE_APPEND.
-# - @var rd.kdumploglvl - logging level to syslog (by logger command)
-# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
-#
-# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
-#
-# KDUMP_STDLOGLVL=3
-# KDUMP_SYSLOGLVL=0
-# KDUMP_KMSGLOGLVL=0
diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64
deleted file mode 100644
index 1b0cdc7..0000000
--- a/kdump.sysconfig.ppc64
+++ /dev/null
@@ -1,58 +0,0 @@
-# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
-# If no version is specified, then the init script will try to find a
-# kdump kernel with the same version number as the running kernel.
-KDUMP_KERNELVER=""
-
-# The kdump commandline is the command line that needs to be passed off to
-# the kdump kernel. This will likely match the contents of the grub kernel
-# line. For example:
-# KDUMP_COMMANDLINE="ro root=LABEL=/"
-# Dracut depends on proper root= options, so please make sure that appropriate
-# root= options are copied from /proc/cmdline. In general it is best to append
-# command line options using "KDUMP_COMMANDLINE_APPEND=".
-# If a command line is not specified, the default will be taken from
-# /proc/cmdline
-KDUMP_COMMANDLINE=""
-
-# This variable lets us remove arguments from the current kdump commandline
-# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma ignition.firstboot"
-
-# This variable lets us append arguments to the current kdump commandline
-# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
-
-# Any additional kexec arguments required. In most situations, this should
-# be left empty
-#
-# Example:
-# KEXEC_ARGS="--elf32-core-headers"
-KEXEC_ARGS="--dt-no-old-root"
-
-#Where to find the boot image
-#KDUMP_BOOTDIR="/boot"
-
-#What is the image type used for kdump
-KDUMP_IMG="vmlinuz"
-
-#What is the images extension. Relocatable kernels don't have one
-KDUMP_IMG_EXT=""
-
-#Specify the action after failure
-
-# Logging is controlled by following variables in the first kernel:
-# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
-# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
-# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
-#
-# In the second kernel, kdump will use the rd.kdumploglvl option to set the
-# log level in the above KDUMP_COMMANDLINE_APPEND.
-# - @var rd.kdumploglvl - logging level to syslog (by logger command)
-# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
-#
-# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
-#
-# KDUMP_STDLOGLVL=3
-# KDUMP_SYSLOGLVL=0
-# KDUMP_KMSGLOGLVL=0
diff --git a/kdump.sysconfig.ppc64le b/kdump.sysconfig.ppc64le
deleted file mode 100644
index d951def..0000000
--- a/kdump.sysconfig.ppc64le
+++ /dev/null
@@ -1,58 +0,0 @@
-# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
-# If no version is specified, then the init script will try to find a
-# kdump kernel with the same version number as the running kernel.
-KDUMP_KERNELVER=""
-
-# The kdump commandline is the command line that needs to be passed off to
-# the kdump kernel. This will likely match the contents of the grub kernel
-# line. For example:
-# KDUMP_COMMANDLINE="ro root=LABEL=/"
-# Dracut depends on proper root= options, so please make sure that appropriate
-# root= options are copied from /proc/cmdline. In general it is best to append
-# command line options using "KDUMP_COMMANDLINE_APPEND=".
-# If a command line is not specified, the default will be taken from
-# /proc/cmdline
-KDUMP_COMMANDLINE=""
-
-# This variable lets us remove arguments from the current kdump commandline
-# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma ignition.firstboot"
-
-# This variable lets us append arguments to the current kdump commandline
-# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
-
-# Any additional kexec arguments required. In most situations, this should
-# be left empty
-#
-# Example:
-# KEXEC_ARGS="--elf32-core-headers"
-KEXEC_ARGS="--dt-no-old-root -s"
-
-#Where to find the boot image
-#KDUMP_BOOTDIR="/boot"
-
-#What is the image type used for kdump
-KDUMP_IMG="vmlinuz"
-
-#What is the images extension. Relocatable kernels don't have one
-KDUMP_IMG_EXT=""
-
-#Specify the action after failure
-
-# Logging is controlled by following variables in the first kernel:
-# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
-# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
-# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
-#
-# In the second kernel, kdump will use the rd.kdumploglvl option to set the
-# log level in the above KDUMP_COMMANDLINE_APPEND.
-# - @var rd.kdumploglvl - logging level to syslog (by logger command)
-# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
-#
-# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
-#
-# KDUMP_STDLOGLVL=3
-# KDUMP_SYSLOGLVL=0
-# KDUMP_KMSGLOGLVL=0
diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x
deleted file mode 100644
index 2971ae7..0000000
--- a/kdump.sysconfig.s390x
+++ /dev/null
@@ -1,59 +0,0 @@
-# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
-# If no version is specified, then the init script will try to find a
-# kdump kernel with the same version number as the running kernel.
-KDUMP_KERNELVER=""
-
-# The kdump commandline is the command line that needs to be passed off to
-# the kdump kernel. This will likely match the contents of the grub kernel
-# line. For example:
-# KDUMP_COMMANDLINE="ro root=LABEL=/"
-# Dracut depends on proper root= options, so please make sure that appropriate
-# root= options are copied from /proc/cmdline. In general it is best to append
-# command line options using "KDUMP_COMMANDLINE_APPEND=".
-# If a command line is not specified, the default will be taken from
-# /proc/cmdline
-KDUMP_COMMANDLINE=""
-
-# This variable lets us remove arguments from the current kdump commandline
-# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt ignition.firstboot"
-
-# This variable lets us append arguments to the current kdump commandline
-# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
-
-# Any additional /sbin/mkdumprd arguments required.
-MKDUMPRD_ARGS=""
-
-# Any additional kexec arguments required. In most situations, this should
-# be left empty
-#
-# Example:
-# KEXEC_ARGS="--elf32-core-headers"
-KEXEC_ARGS="-s"
-
-#Where to find the boot image
-#KDUMP_BOOTDIR="/boot"
-
-#What is the image type used for kdump
-KDUMP_IMG="vmlinuz"
-
-#What is the images extension. Relocatable kernels don't have one
-KDUMP_IMG_EXT=""
-
-# Logging is controlled by following variables in the first kernel:
-# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
-# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
-# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
-#
-# In the second kernel, kdump will use the rd.kdumploglvl option to set the
-# log level in the above KDUMP_COMMANDLINE_APPEND.
-# - @var rd.kdumploglvl - logging level to syslog (by logger command)
-# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
-#
-# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
-#
-# KDUMP_STDLOGLVL=3
-# KDUMP_SYSLOGLVL=0
-# KDUMP_KMSGLOGLVL=0
diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64
deleted file mode 100644
index 6a3ba6e..0000000
--- a/kdump.sysconfig.x86_64
+++ /dev/null
@@ -1,56 +0,0 @@
-# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
-# If no version is specified, then the init script will try to find a
-# kdump kernel with the same version number as the running kernel.
-KDUMP_KERNELVER=""
-
-# The kdump commandline is the command line that needs to be passed off to
-# the kdump kernel. This will likely match the contents of the grub kernel
-# line. For example:
-# KDUMP_COMMANDLINE="ro root=LABEL=/"
-# Dracut depends on proper root= options, so please make sure that appropriate
-# root= options are copied from /proc/cmdline. In general it is best to append
-# command line options using "KDUMP_COMMANDLINE_APPEND=".
-# If a command line is not specified, the default will be taken from
-# /proc/cmdline
-KDUMP_COMMANDLINE=""
-
-# This variable lets us remove arguments from the current kdump commandline
-# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
-# NOTE: some arguments such as crashkernel will always be removed
-KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma ignition.firstboot"
-
-# This variable lets us append arguments to the current kdump commandline
-# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
-
-# Any additional kexec arguments required. In most situations, this should
-# be left empty
-#
-# Example:
-# KEXEC_ARGS="--elf32-core-headers"
-KEXEC_ARGS="-s"
-
-#Where to find the boot image
-#KDUMP_BOOTDIR="/boot"
-
-#What is the image type used for kdump
-KDUMP_IMG="vmlinuz"
-
-#What is the images extension. Relocatable kernels don't have one
-KDUMP_IMG_EXT=""
-
-# Logging is controlled by following variables in the first kernel:
-# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
-# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
-# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
-#
-# In the second kernel, kdump will use the rd.kdumploglvl option to set the
-# log level in the above KDUMP_COMMANDLINE_APPEND.
-# - @var rd.kdumploglvl - logging level to syslog (by logger command)
-# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
-#
-# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
-#
-# KDUMP_STDLOGLVL=3
-# KDUMP_SYSLOGLVL=0
-# KDUMP_KMSGLOGLVL=0
diff --git a/kexec-tools.spec b/kexec-tools.spec
index c6e42b2..e6caa48 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -11,10 +11,7 @@ Summary: The kexec/kdump userspace component
Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
Source1: kdumpctl
-Source2: kdump.sysconfig
-Source3: kdump.sysconfig.x86_64
-Source4: kdump.sysconfig.i386
-Source5: kdump.sysconfig.ppc64
+Source3: gen-kdump-sysconfig.sh
Source7: mkdumprd
Source8: kdump.conf
Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedump...
@@ -25,18 +22,15 @@ Source13: 98-kexec.rules
Source14: 98-kexec.rules.ppc64
Source15: kdump.conf.5
Source16: kdump.service
-Source18: kdump.sysconfig.s390x
Source19: https://github.com/lucchouina/eppic/archive/%{eppic_ver}/eppic-%{eppic_sh...
Source20: kdump-lib.sh
Source21: kdump-in-cluster-environment.txt
Source22: kdump-dep-generator.sh
Source23: kdump-lib-initramfs.sh
-Source24: kdump.sysconfig.ppc64le
Source25: kdumpctl.8
Source26: live-image-kdump-howto.txt
Source27: early-kdump-howto.txt
Source28: kdump-udev-throttler
-Source29: kdump.sysconfig.aarch64
Source30: 60-kdump.install
Source31: kdump-logger.sh
Source32: mkfadumprd
@@ -152,6 +146,9 @@ cp %{SOURCE26} .
cp %{SOURCE27} .
cp %{SOURCE34} .
+# Generate sysconfig file
+%{SOURCE3} %{_target_cpu} > kdump.sysconfig
+
make
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
make -C eppic-%{eppic_ver}/libeppic
@@ -183,13 +180,9 @@ install -m 755 build/sbin/vmcore-dmesg $RPM_BUILD_ROOT/usr/sbin/vmcore-dmesg
install -m 644 build/man/man8/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/
install -m 644 build/man/man8/vmcore-dmesg.8 $RPM_BUILD_ROOT%{_mandir}/man8/
-SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu}
-[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_arch}
-[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig
-install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump
-
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
+install -m 644 kdump.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump
install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
--
2.37.1
1 year, 3 months