dracut-module-setup: _dev to be a local variable

In kdump_setup_bridge/bond/team(), we use _dev as a global variable.
That causes following issues when network is br0 over bond0:

-> kdump_setup_bridge br0: _dev to be "bond0" as a brif
  -> kdump_setup_bond bond0: _dev is modified to be eth0 as a bond slave
    -> (jump back) kdump_setup_bridge br0: we really need _dev is
       "bond0" not "eth0".

_dev must be a local variable because it has been used multiple places.

Signed-off-by: WANG Chao <chaowang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
WANG Chao 2013-09-16 15:46:58 +08:00 committed by Baoquan He
parent a6f03150e9
commit cbbd4428ac

View File

@ -96,7 +96,7 @@ kdump_get_perm_addr() {
kdump_setup_bridge() {
local _netdev=$1
local _brif=""
local _brif _dev
for _dev in `ls /sys/class/net/$_netdev/brif/`; do
if kdump_is_bond "$_dev"; then
kdump_setup_bond "$_dev"
@ -114,6 +114,7 @@ kdump_setup_bridge() {
kdump_setup_bond() {
local _netdev=$1
local _dev
for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
echo -n " ifname=$_dev:$(kdump_get_perm_addr $_dev)" >> ${initdir}/etc/cmdline.d/42bond.conf
done
@ -126,7 +127,7 @@ kdump_setup_bond() {
kdump_setup_team() {
local _netdev=$1
local slaves=""
local slaves _dev
for _dev in `teamnl $_netdev ports | awk -F':' '{print $2}'`; do
echo -n " ifname=$_dev:$(kdump_get_perm_addr $_dev)" >> ${initdir}/etc/cmdline.d/44team.conf
slaves+="$_dev,"