SHA256
1
0
forked from pool/kdump

Accepting request 251694 from Kernel:kdump

1

OBS-URL: https://build.opensuse.org/request/show/251694
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kdump?expand=0&rev=80
This commit is contained in:
Stephan Kulow 2014-09-24 11:09:20 +00:00 committed by Git OBS Bridge
commit be06e63c52
6 changed files with 803 additions and 0 deletions

View File

@ -0,0 +1,200 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Tue Sep 23 16:12:34 2014 +0200
Subject: Add KDUMP_NETCONFIG modes to support IPv6
References: bnc#885897
Patch-mainline: v0.8.16
Git-commit: 72be4138d5ac03af8c5579099c6a39ab7d272503
KDUMP_NETCONFIG had only two modes: static and dhcp, where dhcp
actually only means DHCP4. New modes are needed to get an IPv6
address on the interface.
Note that automatic configuration (KDUMP_NETCONFIG=auto) still uses
only IPv4, because dracut does not implement multiple alternative
ip configurations, and there's no way to determine in advance
which stack should be used.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
doc/man/kdump.5.txt.in | 35 ++++++++++++++++++++++++++++++-----
init/module-setup.sh | 42 ++++++++++++++++++++++++++++++++++--------
init/setup-kdump.functions | 39 ++++++++++++++++++++++++++++++++++++++-
sysconfig.kdump.in | 4 ++--
4 files changed, 104 insertions(+), 16 deletions(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -513,13 +513,38 @@ KDUMP_NETCONFIG
Network configuration for kdump. Because the dump process runs in initrd, the
network configuration is different from the normal network configuration. Use
-_auto_ to auto-detect the network configuration, this is also the default.
+_auto_ to auto-detect the network configuration (see *auto* mode below). The
+interface with the default route will be used. This is the default.
+
+Auto-detection cannot be used to set up dual-stack (IPv4 and IPv6) hosts
+because of limitations in the implementation of the _ip=_ initrd command line
+option.
Use a _netdevice:mode_ string to force a specific network device to be used. A
-_netdevice_ is for example "eth0". The _mode_ can be either "dhcp" or "static".
-If you use "static", you have to set the IP address with _ip=ipspec_. _ipspec_
-is <client>:<server>:<gateway>:<netmask>:<hostname>:<device>:<proto>. See
-*mkinitrd*(8) for details.
+_netdevice_ is for example "eth0". The _mode_ can be:
+
+*static*::
+ Always re-use the current configuration of _netdevice_ (both IPv4 and IPv6).
+ Note that only permanent global IPv6 addresses are stored, because temporary
+ addresses are likely to expire before the system crashes, and link-local
+ addresses are set up automatically.
+
+*auto6*::
+ Use IPv6 autoconfiguration to get an address on the interface.
+
+*dhcp*::
+*dhcp4*::
+ Use DHCP to configure an IPv4 address on the interface.
+
+*dhcp6*::
+ Use DHCP6 to configure an IPv6 address on the interface.
+
+*auto*::
+ Select the mode depending on the current state of the interface:
+
+ * use DHCP4 if it has an IPv4 address (IPv6 not set up),
+ * use DHCP6 if it has a permanent IPv6 address (IPv4 not set up),
+ * use IPv6 auto-configuration if it has neither (IPv4 not set up).
You can set KDUMP_NETCONFIG to "" if you want no network in initrd, i.e. you use
disk dumping.
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -65,24 +65,50 @@ kdump_cmdline_ip() {
[ "$kdump_neednet" = y ] || return 0
echo -n "rd.neednet=1"
+
+ local _if _mode
if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
- echo -n " ip=any"
+ _if=default
+ _mode=auto
else
set -- ${KDUMP_NETCONFIG//:/ }
local _if=$1
local _mode=$2
+ fi
- if [ "$_if" = "default" ] ; then
- _if=$(kdump_default_netdev)
- fi
- printf " %s" $(kdump_ifname_config "$_if")
+ [ "$_if" = "default" ] && _if=$(kdump_default_netdev)
- if [ "$_mode" = "static" ] ; then
- printf " %s" $(kdump_ip_config "$_if")
+ printf " %s" $(kdump_ifname_config "$_if")
+
+ if [ "$_mode" = "auto" ] ; then
+ if [ -n $(kdump_ip_config) ] ; then
+ _mode=dhcp4
+ elif [ -n $(kdump_ip6_config) ] ; then
+ _mode=dhcp6
else
- echo -n " ip=${_if}:dhcp"
+ _mode=auto6
fi
fi
+
+ case "$_mode" in
+ static)
+ printf " %s" \
+ $(kdump_ip_config "$_if") \
+ $(kdump_ip6_config "$_if")
+ ;;
+ dhcp|dhcp4)
+ echo " ip=${_if}:dhcp"
+ ;;
+ dhcp6)
+ echo " ip=${_if}:dhcp6"
+ ;;
+ auto6)
+ echo " ip=${_if}:auto6"
+ ;;
+ *)
+ derror "Wrong KDUMP_NETCONFIG mode: $_mode"
+ ;;
+ esac
}
cmdline() {
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -230,7 +230,7 @@ kdump_prefix2netmask() { # {{{
} # }}}
#
-# Get the ip= parameter for a given device
+# Get the IPv4 ip= parameter for a given device
#
# Parameters:
# 1) device device name
@@ -267,6 +267,43 @@ function kdump_ip_config() # {{{
} # }}}
#
+# Get the IPv6 ip= parameter for a given device
+#
+# Parameters:
+# 1) device device name
+# Output:
+# ip configuration string that can be used for the ip= initrd parameter
+function kdump_ip6_config() # {{{
+{
+ local iface="$1"
+ local ipaddr peeraddr gwaddr hostname
+ local family cidr rest prefix
+
+ hostname=$(hostname)
+ gwaddr=$(ip -6 route show ::/0 | sed -n 's/.* via \([^ ]*\).*/[\1]/p')
+
+ while read family cidr rest
+ do
+ [ "$family" = "inet6" ] || continue
+
+ ipaddr="${cidr%/*}"
+ prefix="${cidr:${#ipaddr}}"
+ ipaddr="[$ipaddr]$prefix"
+ set -- $rest
+
+ if [ "$1" == "peer" ] ; then
+ peeraddr="${2%/*}"
+ prefix="${2:${#peeraddr}}"
+ peeraddr="[$peeraddr]"
+ else
+ peeraddr=
+ fi
+
+ echo "ip=$ipaddr:$peeraddr:$gwaddr::$hostname:$iface:none"
+ done < <(ip -6 address show dev "$iface" permanent scope global)
+} # }}}
+
+#
# Get the save directory and protocol.
#
# Output variables:
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -279,8 +279,8 @@ KDUMPTOOL_FLAGS=""
## ServiceRestart: kdump
#
# Network configuration. Use "auto" for auto-detection in initrd, or a string
-# that contains the network device and the mode (dhcp,static), separated by
-# a colon. Example: "eth0:static" or "eth1:dhcp".
+# that contains the network device and the mode (static, dhcp, dhcp6, auto6),
+# separated by a colon. Example: "eth0:static" or "eth1:dhcp".
#
# For static configuration, you have to add the configuration to
# KDUMP_COMMANDLINE_APPEND.

View File

@ -0,0 +1,163 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Mon Sep 22 17:23:49 2014 +0200
Subject: Get required multipath wwids from sysfs
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: 4aa46801a53070dc0b0c27f4247cdc8e2b678694
The dracut code path must use for_each_host_dev_and_slaves_all to
find multipath devices that are "hidden" beneath e.g. an LVM volume.
That will iterate over all devices in the chain down to each physical
device. Note that /lib/udev/scsi_id sends a low-level SCSI command to
the device to find out the WWID. If it sends it to an unreachable
device in an active-passive multipath setup, it may hang indefinitely.
But the WWID is already available as the name of the multipath device,
so we can get it from the kernel via sysfs.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/module-setup.sh | 18 +++++++++++++++++-
init/setup-kdump.functions | 41 +++++++++++++++++++++++++++--------------
init/setup-kdump.sh | 16 +++++++++++++++-
3 files changed, 59 insertions(+), 16 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -11,12 +11,28 @@ depends() {
echo drm
}
+kdump_add_mpath_dev() {
+ local _major=${1%:*}
+ local _minor=${1#*:}
+ local _wwid
+
+ eval _wwid=\$kdump_mpath_wwid_${_major}_${_minor}
+ if [ -n "$_wwid" ] ; then
+ kdump_mpath_wwids+=$(printf "%q " "wwid $_wwid")
+ fi
+}
+
install() {
# Get configuration
kdump_get_config || return 1
kdump_import_targets
- kdump_setup_files "$initdir" "${!host_fs_types[*]}"
+ # Get a list of required multipath devices
+ local kdump_mpath_wwids
+ kdump_map_mpath_wwid
+ for_each_host_dev_and_slaves_all kdump_add_mpath_dev
+
+ kdump_setup_files "$initdir" "$kdump_mpath_wwids"
if dracut_module_included "systemd" ; then
rm -f "${initdir}/$systemdutildir"/system-generators/dracut-rootfs-generator
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -542,24 +542,36 @@ function kdump_modify_config() #
} # }}}
#
+# Build a mapping between multipath devices and their wwid
+# This map would be best stored in an associative array, but
+# then bash 4.0+ would be needed (and SLES11 has bash 3.2).
+#
+# Output variables:
+# kdump_mpath_wwid_$major_$minor wwid of the given major/minor device
+function kdump_map_mpath_wwid() # {{{
+{
+ local f _dir _uuid _wwid _dev
+ for f in /sys/block/*/dm/uuid ; do
+ eval "_uuid=$(<$f)" 2>/dev/null
+ [[ "$_uuid" = mpath-* ]] || continue
+ _dir="${f%/dm/uuid}"
+ _wwid=$(<"$_dir"/dm/name)
+ _dev=$(<"$_dir"/dev)
+ eval kdump_mpath_wwid_${_dev/:/_}=\$_wwid
+ done
+} # }}}
+
+#
# Keep only required devices in multipath.conf
#
# Parameters:
-# 1) devices: list of all required block devices
+# 1) devices: list of all required devices (multipath.conf syntax)
# Output:
# filtered multipath.conf
function kdump_modify_multipath() # {{{
{
- local devices="$1"
- local i bd scsi_id
local -a wwids
-
- i=0
- for bd in $devices ; do
- scsi_id=$(/lib/udev/scsi_id --whitelisted --device="$bd")
- [ -z "$scsi_id" ] && continue
- wwids[i++]="wwid "\""$scsi_id"\"
- done
+ eval wwids="($1)"
kdumptool multipath "${wwids[@]}" \
< /etc/multipath.conf
} # }}}
@@ -633,8 +645,9 @@ function kdump_init_dirs() # {{{
#
# Set up or create all necessary files
# Parameters:
-# 1) outdir: initrd temporary root
-# 2) dumpdevs: space-separated list of all block devices required by kdump
+# 1) outdir: initrd temporary root
+# 2) mpathdevs: space-separated list of all multipath devices required
+# by kdump (using multipath.conf syntax)
# Input variables:
# KDUMP_* see kdump_get_config
# kdump_mnt[] mountpoints in kdump environment
@@ -643,7 +656,7 @@ function kdump_init_dirs() # {{{
function kdump_setup_files() # {{{
{
local outdir="${1%/}"
- local dumpdevs="$2"
+ local mpathdevs="$2"
local kdump_over_ssh
#
@@ -673,7 +686,7 @@ function kdump_setup_files() # {
# create modified multipath.conf
#
if [ -e /etc/multipath.conf ] ; then
- kdump_modify_multipath "$dumpdevs" > "${outdir}/etc/multipath.conf"
+ kdump_modify_multipath "$mpathdevs" > "${outdir}/etc/multipath.conf"
fi
return 0
--- a/init/setup-kdump.sh
+++ b/init/setup-kdump.sh
@@ -28,9 +28,23 @@ fi
# /lib/kdump/setup-kdump.functions was sourced from setup-kdumpfs.sh already
#
+# Get a list of required multipath devices
+#
+mpath_wwids=
+kdump_map_mpath_wwid
+for bd in $blockdev ; do
+ update_blockdev $bd
+ [ $blockmajor -ge 0 -a $blockminor -ge 0 ] || continue
+ eval _wwid=\$kdump_mpath_wwid_${blockmajor}_${blockminor}
+ if [ -n "$_wwid" ] ; then
+ mpath_wwids="$mpath_wwids"$(printf "%q " "wwid $_wwid")
+ fi
+done
+
+#
# Copy or create all necessary files for the initrd
#
-kdump_setup_files "$tmp_mnt" "$blockdev"
+kdump_setup_files "$tmp_mnt" "$mpath_wwids"
#
# check if extra modules are needed

View File

@ -0,0 +1,238 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Tue Sep 23 11:02:22 2014 +0200
Subject: Move dracut network command line to module-setup.sh
References: bnc#885897
Patch-mainline: v0.8.16
Git-commit: 16e3640c2bcbb08fb31c7c3da03a8fb726d7686a
This is mostly a cleanup to allow adding more code to module-setup.sh
without too much duplication.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/mkdumprd | 54 -------------------------------
init/module-setup.sh | 76 ++++++++++++++++++++++++++++++++++++++++++---
init/setup-kdump.functions | 19 ++++++++++-
3 files changed, 90 insertions(+), 59 deletions(-)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -120,8 +120,6 @@ function run_mkinitrd()
# Create a new initrd using dracut {{{
function run_dracut()
{
- local modules="kdump"
-
DRACUT_ARGS="--force --hostonly --omit 'plymouth resume usrmount'"
DRACUT_ARGS="$DRACUT_ARGS --compress='xz -0 --check=crc32'"
@@ -136,60 +134,10 @@ function run_dracut()
i=$((i+1))
done
- # Check for additional modules
- neednet=
- for protocol in "${kdump_Protocol[@]}" ; do
- if [ "$protocol" = "nfs" ]; then
- modules="$modules nfs"
- fi
- if [ "$protocol" = "cifs" -o "$protocol" = "smb" ]; then
- modules="$modules cifs"
- fi
- if [ "$protocol" != "file" ]; then
- neednet=y
- fi
- done
-
- # network configuration
- if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
- neednet=y
- fi
- if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
- status_message "Network: auto"
- if [ -n "$neednet" ]; then
- DRACUT_ARGS+=" --kernel-cmdline 'rd.neednet=1 ip=any'"
- modules="$modules network"
- fi
- elif [ -z "$KDUMP_NETCONFIG" ] ; then
- status_message "Network: none"
- else
- interface=$(echo "$KDUMP_NETCONFIG" | cut -d ':' -f 1)
- mode=$(echo "$KDUMP_NETCONFIG" | cut -d ':' -f 2)
-
- if [ "$interface" = "default" ] ; then
- interface=$( kdump_default_netdev )
- status_message "Network interface: $interface (default)"
- else
- status_message "Network interface: $interface"
- fi
-
- if [ "$mode" = "static" ] ; then
- ipcfg="$(kdump_ip_config "$interface")"
- hwaddr=$(cat "/sys/class/net/$interface/address")
- status_message "Network mode: Static IP"
- DRACUT_ARGS+=" --kernel-cmdline 'rd.neednet=1 ip=$ipcfg::$hwaddr'"
- else
- status_message "Network mode: Automatic IP (DHCP)"
- DRACUT_ARGS+=" --kernel-cmdline 'rd.neednet=1 ip=${interface}:dhcp'"
- fi
- modules="$modules network"
- fi
-
# Make resolved variables visible to the dracut module
kdump_export_targets
- DRACUT_ARGS="$DRACUT_ARGS --add '$modules' $INITRD $KERNELVERSION"
- status_message "Calling dracut $DRACUT_ARGS"
+ DRACUT_ARGS="$DRACUT_ARGS --add 'kdump' $INITRD $KERNELVERSION"
echo "Regenerating kdump initrd ..." >&2
eval "bash -$- dracut $DRACUT_ARGS"
} # }}}
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -3,12 +3,51 @@
. /lib/kdump/setup-kdump.functions
+kdump_check_net() {
+ kdump_neednet=
+ for protocol in "${kdump_Protocol[@]}" ; do
+ if [ "$protocol" != "file" ]; then
+ kdump_neednet=y
+ fi
+ done
+
+ # network configuration
+ if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
+ kdump_neednet=y
+ fi
+
+ # network explicitly disabled in configuration?
+ [ -z "$KDUMP_NETCONFIG" ] && kdump_neednet=
+}
+
check() {
+ # Get configuration
+ kdump_import_targets || return 1
+ kdump_get_config || return 1
+ kdump_check_net
+
return 255
}
depends() {
- echo drm
+ local -A _modules
+
+ # drm is needed to get console output, but it is not included
+ # automatically, because kdump does not use plymouth
+ _modules[drm]=
+
+ [ "$kdump_neednet" = y ] && _modules[network]=
+
+ for protocol in "${kdump_Protocol[@]}" ; do
+ if [ "$protocol" = "nfs" ]; then
+ _modules[nfs]=
+ fi
+ if [ "$protocol" = "cifs" -o "$protocol" = "smb" ]; then
+ _modules[cifs]=
+ fi
+ done
+
+ echo ${!_modules[@]}
}
kdump_add_mpath_dev() {
@@ -22,10 +61,39 @@ kdump_add_mpath_dev() {
fi
}
+kdump_cmdline_ip() {
+ [ "$kdump_neednet" = y ] || return 0
+
+ echo -n "rd.neednet=1"
+ if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
+ echo -n " ip=any"
+ else
+ set -- ${KDUMP_NETCONFIG//:/ }
+ local _if=$1
+ local _mode=$2
+
+ if [ "$_if" = "default" ] ; then
+ _if=$(kdump_default_netdev)
+ fi
+ printf " %s" $(kdump_ifname_config "$_if")
+
+ if [ "$_mode" = "static" ] ; then
+ printf " %s" $(kdump_ip_config "$_if")
+ else
+ echo -n " ip=${_if}:dhcp"
+ fi
+ fi
+}
+
+cmdline() {
+ kdump_cmdline_ip
+}
+
install() {
- # Get configuration
- kdump_get_config || return 1
- kdump_import_targets
+ if [[ $hostonly_cmdline == "yes" ]] ; then
+ local _cmdline=$(cmdline)
+ [ -n "$_cmdline" ] && printf "%s\n" "$_cmdline" >> "${initdir}/etc/cmdline.d/99kdump.conf"
+ fi
# Get a list of required multipath devices
local kdump_mpath_wwids
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -193,6 +193,20 @@ function kdump_netdev_mode() # {
} # }}}
#
+# Get the ifname parameter for a given device
+#
+# Parameters:
+# 1) device device name
+# Output:
+# ifname corresponding ifname= initrd parameter (or empty)
+function kdump_ifname_config() # {{{
+{
+ local iface="$1"
+ local hwaddr=$(<"/sys/class/net/$iface/address")
+ [ -n "$hwaddr" ] && echo "ifname=$iface:$hwaddr"
+} # }}}
+
+#
# Convert a CIDR prefix to IPv4 netmask
#
# Parameters:
@@ -219,7 +233,7 @@ kdump_prefix2netmask() { # {{{
# Get the ip= parameter for a given device
#
# Parameters:
-# 1) device device name (use default if empty)
+# 1) device device name
# Output:
# ip configuration string that can be used for the ip= initrd parameter
function kdump_ip_config() # {{{
@@ -249,7 +263,7 @@ function kdump_ip_config() # {{{
gwaddr=$(ip route show 0/0 | sed -n 's/.* via \([^ ]*\).*/\1/p')
hostname=$(hostname)
- echo "$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$iface:none"
+ echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$iface:none"
} # }}}
#
@@ -311,6 +325,7 @@ function kdump_import_targets()
eval "kdump_Host=( $KDUMP_x_Host )"
eval "kdump_Realpath=( $KDUMP_x_Realpath )"
eval "kdump_mnt=( $KDUMP_x_mnt )"
+ test ${#kdump_URL[@]} -gt 0
} # }}}
#

View File

@ -0,0 +1,178 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Tue Sep 23 07:09:44 2014 +0200
Subject: Split kdump_default_netdev()
References: bnc#885897
Patch-mainline: v0.8.16
Git-commit: 4da0601f2edcef642da502db6f4299204365c631
This function did too many things, which are now split thus:
1. determine the default network interface
-> kept in kdump_default_netdev
2. get the underlying physical devices of a bridge
-> kdump_bridge_phys_dev
3. determine network interface operating mode
-> kdump_netdev_mode
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/mkdumprd | 1
init/setup-kdump.functions | 94 +++++++++++++++++++++++++--------------------
2 files changed, 54 insertions(+), 41 deletions(-)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -168,7 +168,6 @@ function run_dracut()
if [ "$interface" = "default" ] ; then
interface=$( kdump_default_netdev )
- interface="${interface% *}"
status_message "Network interface: $interface (default)"
else
status_message "Network interface: $interface"
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -77,12 +77,10 @@ function kdump_wicked_conf() # {
# Determine the default network device.
#
# Output:
-# "$ifname $mode"
-# ifname default network interface name (or empty if none)
-# mode initialization mode ("static" or "dhcp")
+# ifname default network interface name (or empty if none)
function kdump_default_netdev() # {{{
{
- local ifname BOOTPROTO
+ local ifname
local inffile="/etc/install.inf"
# check current default routes
@@ -95,7 +93,6 @@ function kdump_default_netdev()
if [ -z "$ifname" -a -f "$inffile" ] ; then
local dev hwaddr hwaddr2
eval $( sed -ne '
- s/^NetConfig: \(.*\)/BOOTPROTO=\1/p;
s/^Netdevice: \(.*\)/ifname=\1/p;
s/HWAddr: \(.*\)/hwaddr=\1/p' \
"$inffile" )
@@ -108,12 +105,53 @@ function kdump_default_netdev()
done
fi
fi
+ echo "$ifname"
+} # }}}
- # if still not found, there is no network
- if [ -z "$ifname" ] ; then
- return 0
+# Get the underlying physical devices of a bridge.
+#
+# Virtual devices (tap or vif) are ignored.
+#
+# Parameters:
+# 1) ifname bridge interface name
+# Output:
+# ifnames list of underlying physical interfaces;
+function kdump_bridge_phys_dev() # {{{
+{
+ local ifname="$1"
+
+ if [ -d "/sys/class/net/$ifname/bridge" -a \
+ -d "/sys/class/net/$ifname/brif" ] ; then
+
+ local ifname2 count=0
+ local -a res
+ for ifname2 in "/sys/class/net/$ifname/brif"/*; do
+ case "$(readlink -f "$ifname2")" in
+ /sys/devices/virtual/*)
+ continue
+ esac
+ res[count]="${ifname2##*/}"
+ count=$(( count+1 ))
+ done
+ ifname=${res[@]}
fi
+ echo "$ifname"
+} # }}}
+
+#
+# Determine the default network mode of a given device.
+#
+# Parameters:
+# 1) ifname network interface name
+# Output:
+# mode initialization mode ("static" or "dhcp")
+function kdump_netdev_mode() # {{{
+{
+ local ifname="$1"
+ local inffile="/etc/install.inf"
+ local BOOTPROTO
+
# get mode using wicked if possible
if [ -n "$(type -P wicked)" -a \
"$(kdump_wicked_conf "$ifname" name)" = "$ifname" ]
@@ -135,6 +173,12 @@ function kdump_default_netdev()
fi
fi
+ # try install.conf
+ if [ -z "$BOOTPROTO" ] ; then
+ eval $( sed -ne 's/^NetConfig: \(.*\)/BOOTPROTO=\1/p;' \
+ "$inffile" )
+ fi
+
# if not found, look if there is a dhcp daemon for the interface
if [ -z "$BOOTPROTO" ] ; then
if [ -n "$(ps -C dhclient,dhclient6,dhcpcd -o cmd= |
@@ -145,31 +189,7 @@ function kdump_default_netdev()
fi
fi
- # if the interface is a bridge, then try to use the underlying interface
- # if it is the only non-virtual interface (not tap or vif)
- if [ -d "/sys/class/net/$ifname/bridge" -a \
- -d "/sys/class/net/$ifname/brif" ] ; then
-
- local ifname2 res count=0
- for ifname2 in "/sys/class/net/$ifname/brif"/*; do
- case "$(readlink -f "$ifname2")" in
- /sys/devices/virtual/*)
- continue
- esac
- res="${ifname2##*/}"
- count=$(( count+1 ))
- done
-
- if [ "$count" -ne 1 ] ; then
- echo >&2 ">>> WARNING: $ifname is a bridge with more than one"
- echo >&2 ">>> underlying interface. Please specify the device"
- echo >&2 ">>> in KDUMP_NETCONFIG manually."
- else
- ifname="$res"
- fi
- fi
-
- echo "$ifname $BOOTPROTO"
+ echo "$BOOTPROTO"
} # }}}
#
@@ -205,13 +225,7 @@ kdump_prefix2netmask() { # {{{
function kdump_ip_config() # {{{
{
local iface="$1"
- if [ -z "$iface" ] ; then
- iface=$( kdump_default_netdev )
- iface="${iface% *}"
- fi
- [ -z "$iface" ] && return 1
-
- local ipaddr peeraddr gwaddr netmask hostname iface
+ local ipaddr peeraddr gwaddr netmask hostname
local family cidr rest
local prefix
while read family cidr rest

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Sep 23 14:17:01 UTC 2014 - ptesarik@suse.cz
- kdump-split-kdump_default_netdev.patch: Cleanup: Split
kdump_default_netdev (bnc#885897).
- kdump-move-network-setup-to-module-setup.patch: Move dracut
network command line to module-setup.sh (bnc#885897).
- kdump-add-IPv6-KDUMP_NETCONFIG-modes.patch: Add KDUMP_NETCONFIG
modes to support IPv6 (bnc#885897).
------------------------------------------------------------------
Mon Sep 22 15:32:22 UTC 2014 - ptesarik@suse.cz
- kdump-get-multipath-wwid-from-sysfs.patch: Get required multipath
wwids from sysfs (bnc#883883).
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 18 15:33:21 UTC 2014 - ptesarik@suse.cz Thu Sep 18 15:33:21 UTC 2014 - ptesarik@suse.cz

View File

@ -72,6 +72,10 @@ Patch4: %{name}-remove-root-and-resume.patch
Patch5: %{name}-systemd-support.patch Patch5: %{name}-systemd-support.patch
Patch6: %{name}-calibrate-systemd-runtime.patch Patch6: %{name}-calibrate-systemd-runtime.patch
Patch7: %{name}-calibrate-systemd-initramfs.patch Patch7: %{name}-calibrate-systemd-initramfs.patch
Patch8: %{name}-get-multipath-wwid-from-sysfs.patch
Patch9: %{name}-split-kdump_default_netdev.patch
Patch10: %{name}-move-network-setup-to-module-setup.patch
Patch11: %{name}-add-IPv6-KDUMP_NETCONFIG-modes.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2) # rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2)
Provides: kdump-helpers = %{version} Provides: kdump-helpers = %{version}
@ -117,6 +121,10 @@ Authors:
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%build %build
export CFLAGS="%optflags" export CFLAGS="%optflags"