Skip to content

Commit

Permalink
tools: hv: ignore a NIC if it has been configured
Browse files Browse the repository at this point in the history
Let bondvf.sh ignore this NIC if it has been configured, to prevent
user configuration from being overwritten unexpectly.

Signed-off-by: Simon Xiao <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
simonxiaoss authored and davem330 committed Jul 16, 2017
1 parent 98524e0 commit 1c3a044
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions tools/hv/bondvf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,30 @@ function create_bond {

echo $'\nBond name:' $bondname

if [ $distro == ubuntu ]
then
local mainfn=$cfgdir/interfaces
local s="^[ \t]*(auto|iface|mapping|allow-.*)[ \t]+${bondname}"

grep -E "$s" $mainfn
if [ $? -eq 0 ]
then
echo "WARNING: ${bondname} has been configured already"
return
fi
elif [ $distro == redhat ] || [ $distro == suse ]
then
local fn=$cfgdir/ifcfg-$bondname
if [ -f $fn ]
then
echo "WARNING: ${bondname} has been configured already"
return
fi
else
echo "Unsupported Distro: ${distro}"
return
fi

echo configuring $primary
create_eth_cfg_pri_$distro $primary $bondname

Expand All @@ -219,14 +243,13 @@ function create_bond {

echo creating: $bondname with primary slave: $primary
create_bond_cfg_$distro $bondname $primary $secondary

let bondcnt=bondcnt+1
}

for (( i=0; i < $eth_cnt-1; i++ ))
do
if [ -n "${list_match[$i]}" ]
then
create_bond ${list_eth[$i]} ${list_match[$i]}
let bondcnt=bondcnt+1
fi
done

0 comments on commit 1c3a044

Please sign in to comment.