mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-23 11:40:25 +00:00
Fix confignetwork issue and modify test case accordingly (#3814)
* Fix confignetwork issue and modify test case accordingly * polished * enhance test cases * polished * enhance test case
This commit is contained in:
@@ -490,7 +490,7 @@ cmd:mkdef -t network -o 60_0_0_0-255_0_0_0 net=60.0.0.0 mask=255.0.0.0 mgtifname
|
||||
check:rc==0
|
||||
cmd:mkdef -t network -o 70_0_0_0-255_0_0_0 net=70.0.0.0 mask=255.0.0.0 mgtifname=$$SECONDNIC
|
||||
check:rc==0
|
||||
cmd:chdef $$CN nicnetworks.$$SECONDNIC.6="60_0 _0_0-255_0_0_0" nicnetworks.$$SECONDNIC.7="70_0 _0_0-255_0_0_0" nictypes.$$SECONDNIC.6=vlan nictypes.$$SECONDNIC.7=vlan nicips.$$SECONDNIC.6=60.5.106.9 nicips.$$SECONDNIC.7=70.5.106.9 nicdevices.$$SECONDNIC.6=$$SECONDNIC nicdevices.$$SECONDNIC.7=$$SECONDNIC
|
||||
cmd:chdef $$CN nicnetworks.$$SECONDNIC.6="60_0 _0_0-255_0_0_0" nicnetworks.$$SECONDNIC.7="70_0 _0_0-255_0_0_0" nictypes.$$SECONDNIC.6=vlan nictypes.$$SECONDNIC.7=vlan nicips.$$SECONDNIC.6=60.5.106.9 nicips.$$SECONDNIC.7=70.5.106.9 nicdevices.$$SECONDNIC.6=$$SECONDNIC nicdevices.$$SECONDNIC.7=$$SECONDNIC nictypes.$$SECONDNIC=ethernet
|
||||
check:rc==0
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
check:rc==0
|
||||
@@ -507,6 +507,7 @@ cmd:xdsh $$CN "ip addr del 60.5.106.9/8 dev $$SECONDNIC.6"
|
||||
cmd:xdsh $$CN "ip addr del 70.5.106.9/8 dev $$SECONDNIC.7"
|
||||
cmd:xdsh $$CN "ip link del dev $$SECONDNIC.6"
|
||||
cmd:xdsh $$CN "ip link del dev $$SECONDNIC.7"
|
||||
cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC"
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC.6 /etc/sysconfig/network/ifcfg-$$SECONDNIC.7"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC.6 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC.7"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC.6 /etc/network/interfaces.d/$$SECONDNIC.7";else echo "Sorry,this is not supported os"; fi
|
||||
check:rc==0
|
||||
cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi
|
||||
@@ -550,7 +551,7 @@ check:rc!=0
|
||||
cmd:rmdef -t network -o 11_1_0_0-255_255_0_0
|
||||
cmd:rmdef -t network -o 60_0_0_0-255_0_0_0
|
||||
cmd:rmdef -t network -o 70_0_0_0-255_0_0_0
|
||||
cmd:xdsh $$CN "ip addr del 11.1.0.100/8 dev $$SECONDNIC"
|
||||
cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC"
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi
|
||||
check:rc==0
|
||||
cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi
|
||||
@@ -646,6 +647,8 @@ cmd:chdef $$CN nicnetworks.bond0=30_5_0_0-255_255_0_0 nictypes.$$SECONDNIC=ether
|
||||
check:rc==0
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
check:rc!=0
|
||||
cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC"
|
||||
cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$THIRDNIC"
|
||||
cmd:rmdef -t network -o 11_1_0_0-255_255_0_0
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi
|
||||
check:rc==0
|
||||
@@ -708,6 +711,8 @@ cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifc
|
||||
check:rc==0
|
||||
cmd:rmdef -t network -o 30_5_0_0-255_255_0_0
|
||||
cmd:rmdef -t network -o 40_5_0_0-255_255_0_0
|
||||
cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC"
|
||||
cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$THIRDNIC"
|
||||
cmd:xdsh $$CN "ip addr del 30.5.106.9/16 dev bond0.2"
|
||||
cmd:xdsh $$CN "ip addr del 40.5.106.9/16 dev bond0.3"
|
||||
cmd:xdsh $$CN "ip link del dev bond0"
|
||||
@@ -766,6 +771,8 @@ cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifc
|
||||
check:rc==0
|
||||
cmd:rmdef -t network -o 30_5_0_0-255_255_0_0
|
||||
cmd:xdsh $$CN "ip addr del 30.5.106.9/16 dev br0"
|
||||
cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC"
|
||||
cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$THIRDNIC"
|
||||
cmd:xdsh $$CN "ip link del dev br0"
|
||||
cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters"
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-br0"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-br0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/br0";else echo "Sorry,this is not supported os"; fi
|
||||
@@ -831,6 +838,8 @@ cmd:xdsh $$CN "ip link del dev br33"
|
||||
cmd:xdsh $$CN "ip link del dev bond0.2"
|
||||
cmd:xdsh $$CN "ip link del dev bond0.3"
|
||||
cmd:xdsh $$CN "ip link del dev bond0"
|
||||
cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC"
|
||||
cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$THIRDNIC"
|
||||
cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters"
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3 /etc/sysconfig/network/ifcfg-br22 /etc/sysconfig/network/ifcfg-br33"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-bond0 /etc/sysconfig/network-scripts/ifcfg-bond0.2 /etc/sysconfig/network-scripts/ifcfg-bond0.3 /etc/sysconfig/network-scripts/ifcfg-br22 /etc/sysconfig/network-scripts/ifcfg-br33"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/network/interfaces.d/bond0.2 /etc/network/interfaces.d/bond0.3 /etc/network/interfaces.d/br22 /etc/network/interfaces.d/br33";else echo "Sorry,this is not supported os"; fi
|
||||
check:rc==0
|
||||
@@ -857,7 +866,7 @@ cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtif
|
||||
check:rc==0
|
||||
cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0
|
||||
check:rc==0
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
check:rc==0
|
||||
cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC=
|
||||
check:rc==0
|
||||
@@ -899,7 +908,8 @@ cmd:xdsh $$CN "ip link del dev br33"
|
||||
cmd:xdsh $$CN "ip link del dev bond0.2"
|
||||
cmd:xdsh $$CN "ip link del dev bond0.3"
|
||||
cmd:xdsh $$CN "ip link del dev bond0"
|
||||
cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters"
|
||||
cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC"
|
||||
cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$THIRDNIC"
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3 /etc/sysconfig/network/ifcfg-br22 /etc/sysconfig/network/ifcfg-br33"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-bond0 /etc/sysconfig/network-scripts/ifcfg-bond0.2 /etc/sysconfig/network-scripts/ifcfg-bond0.3 /etc/sysconfig/network-scripts/ifcfg-br22 /etc/sysconfig/network-scripts/ifcfg-br33"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/network/interfaces.d/bond0.2 /etc/network/interfaces.d/bond0.3 /etc/network/interfaces.d/br22 /etc/network/interfaces.d/br33";else echo "Sorry,this is not supported os"; fi
|
||||
check:rc==0
|
||||
cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi
|
||||
@@ -917,43 +927,23 @@ cmd:xdsh $$CN "mkdir -p /tmp/backupnet/"
|
||||
check:rc==0
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi
|
||||
cmd:if grep "Red Hat" /etc/*release;then xdsh $$CN "yum -y install bridge-utils";fi
|
||||
cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC
|
||||
check:rc==0
|
||||
cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0
|
||||
check:rc==0
|
||||
cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC
|
||||
check:rc==0
|
||||
cmd:chdef $$CN nicips.$$THIRDNIC=12.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=12_1_0_0-255_255_0_0
|
||||
check:rc==0
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
check:rc==0
|
||||
cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= nicips.$$THIRDNIC= nictypes.$$THIRDNIC= nicnetworks.$$THIRDNIC=
|
||||
check:rc==0
|
||||
cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0
|
||||
check:rc==0
|
||||
cmd:mkdef -t network -o 40_5_0_0-255_255_0_0 net=40.5.0.0 mask=255.255.0.0
|
||||
check:rc==0
|
||||
cmd:chdef $$CN nicdevices.br22= nicdevices.br33= nictypes.br22=bridge nictypes.br33=bridge nicnetworks.br22=30_5_0_0-255_255_0_0 nicnetworks.br33=40_5_0_0-255_255_0_0 nicips.br22=30.5.106.8 nicips.br33=40.5.106.8 nicdevices.bond0.2=bond0 nicdevices.bond0.3=bond0 nictypes.bond0.2=vlan nictypes.bond0.3=vlan nictypes.bond0=bond nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet nicdevices.bond0="$$SECONDNIC|$$THIRDNIC"
|
||||
cmd:chdef $$CN nicdevices.br22= nicdevices.br33= nictypes.br22=bridge nictypes.br33=bridge nicnetworks.br22=30_5_0_0-255_255_0_0 nicnetworks.br33=40_5_0_0-255_255_0_0 nicips.br22=30.5.106.8 nicips.br33=40.5.106.8 nicdevices.bond0.2=bond0 nicdevices.bond0.3=bond0 nictypes.bond0.2=vlan nictypes.bond0.3=vlan nictypes.bond0=bond nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet
|
||||
check:rc==0
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
cmd:updatenode $$CN -P "confignetwork -s"
|
||||
check:rc!=0
|
||||
cmd:chdef $$CN nicdevices.br22=bond0.2 nicdevices.br33=bond0.3 nictypes.br22=bridge nictypes.br33=bridge nicnetworks.br22= nicnetworks.br33= nicips.br22=30.5.106.8 nicips.br33=40.5.106.8 nicdevices.bond0.2=bond0 nicdevices.bond0.3=bond0 nictypes.bond0.2=vlan nictypes.bond0.3=vlan nictypes.bond0=bond nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet nicdevices.bond0="$$SECONDNIC|$$THIRDNIC"
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
check:rc!=0
|
||||
cmd:chdef $$CN nicdevices.br22=bond0.2 nicdevices.br33=bond0.3 nictypes.br22= nictypes.br33= nicnetworks.br22=30_5_0_0-255_255_0_0 nicnetworks.br33=40_5_0_0-255_255_0_0 nicips.br22=30.5.106.8 nicips.br33=40.5.106.8 nicdevices.bond0.2=bond0 nicdevices.bond0.3=bond0 nictypes.bond0.2=vlan nictypes.bond0.3=vlan nictypes.bond0=bond nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet nicdevices.bond0="$$SECONDNIC|$$THIRDNIC"
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
check:rc!=0
|
||||
cmd:chdef $$CN nicdevices.br22=bond0.2 nicdevices.br33=bond0.3 nictypes.br22=bridge nictypes.br33=bridge nicnetworks.br22=30_5_0_0-255_255_0_0 nicnetworks.br33=40_5_0_0-255_255_0_0 nicips.br22= nicips.br33= nicdevices.bond0.2=bond0 nicdevices.bond0.3=bond0 nictypes.bond0.2=vlan nictypes.bond0.3=vlan nictypes.bond0=bond nictypes.$$SECONDNIC=ethernet nictypes.$$THIRDNIC=ethernet nicdevices.bond0="$$SECONDNIC|$$THIRDNIC"
|
||||
cmd:updatenode $$CN -P confignetwork
|
||||
check:rc!=0
|
||||
cmd:rmdef -t network -o 11_1_0_0-255_255_0_0
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi
|
||||
check:rc==0
|
||||
cmd:rmdef -t network -o 12_1_0_0-255_255_0_0
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi
|
||||
check:rc==0
|
||||
cmd:rmdef -t network -o 30_5_0_0-255_255_0_0
|
||||
cmd:rmdef -t network -o 40_5_0_0-255_255_0_0
|
||||
cmd:xdsh $$CN "ip addr del 30.5.106.8/16 dev br22"
|
||||
cmd:xdsh $$CN "ip link del dev br22"
|
||||
cmd:xdsh $$CN "ip addr del 40.5.106.8/16 dev br33"
|
||||
cmd:xdsh $$CN "ip link del dev br33"
|
||||
cmd:xdsh $$CN "ip link del dev bond0.2"
|
||||
cmd:xdsh $$CN "ip link del dev bond0.3"
|
||||
cmd:xdsh $$CN "ip link del dev bond0"
|
||||
cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi
|
||||
check:rc==0
|
||||
cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi
|
||||
|
@@ -328,13 +328,17 @@ function sort_nics_device_order {
|
||||
else
|
||||
ib_slots=$ib_slots,$alonenic
|
||||
fi
|
||||
elif [ x"$alonenictype" = "xvlan" ] || [ x"$alonenictype" = "xbond" ]; then
|
||||
echo "Error: should configure nicdevices for $alonenic."
|
||||
errorcode=1
|
||||
|
||||
else
|
||||
echo $alonenic
|
||||
fi
|
||||
else
|
||||
errorcode=1
|
||||
echo "Error: nicips,nictypes and nicnetworks should be configured in nics table for $alonenic."
|
||||
((num1+=1))
|
||||
((num1+=1))
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
@@ -530,8 +534,12 @@ function configure_nicdevice {
|
||||
#linux bridge type is bridge
|
||||
#openvswitch bridge type is bridge_ovs
|
||||
elif [ x"$nic_dev_type" = "xbridge_ovs" -o x"$nic_dev_type" = "xbridge" ]; then
|
||||
create_bridge_interface ifname=$nic_dev _brtype=$nic_dev_type _port=$base_nic_dev _pretype=$base_nic_type
|
||||
|
||||
check_brctl $nic_dev_type
|
||||
if [ $? -ne 0 ]; then
|
||||
errorcode=1
|
||||
else
|
||||
create_bridge_interface ifname=$nic_dev _brtype=$nic_dev_type _port=$base_nic_dev _pretype=$base_nic_type
|
||||
fi
|
||||
#configure vlan
|
||||
elif [ x"$nic_dev_type" = "xvlan" ]; then
|
||||
if echo "$nic_dev" | grep -sq ".*\.[0-9]\+"; then
|
||||
|
@@ -511,7 +511,6 @@ function create_persistent_ifcfg {
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
query_extra_params $ifname
|
||||
|
||||
local attrs=""
|
||||
@@ -697,11 +696,9 @@ function add_br() {
|
||||
BRIDGE=$2
|
||||
|
||||
if [[ $BRIDGE == "bridge_ovs" ]]; then
|
||||
type brctl >/dev/null 2>/dev/null || (echo "There is no ovs-vsctl" >&2 && exit 1)
|
||||
log_info "ovs-vsctl add-br $BNAME"
|
||||
ovs-vsctl add-br $BNAME
|
||||
elif [[ $BRIDGE == "bridge" ]]; then
|
||||
type brctl >/dev/null 2>/dev/null || (echo "There is no brctl" >&2 && exit 1)
|
||||
log_info "brctl addbr $BNAME"
|
||||
brctl addbr $BNAME
|
||||
log_info "brctl stp $BNAME on"
|
||||
@@ -709,6 +706,29 @@ function add_br() {
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# check brctl
|
||||
#
|
||||
##############################################################################
|
||||
function check_brctl() {
|
||||
BRIDGE=$1
|
||||
if [[ $BRIDGE == "bridge_ovs" ]]; then
|
||||
type brctl >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "There is no brctl"
|
||||
return 1
|
||||
fi
|
||||
elif [[ $BRIDGE == "bridge" ]]; then
|
||||
type brctl >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error "There is no brctl"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# create add port for bridge
|
||||
@@ -1168,17 +1188,17 @@ function create_vlan_interface {
|
||||
ifname=$ifname.$vlanid \
|
||||
xcatnet=$xcatnet \
|
||||
inattrs="$cfg"
|
||||
|
||||
# bring up interface formally
|
||||
lines=`$ifdown $ifname.$vlanid; $ifup $ifname.$vlanid`
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
log_warn "ifup $ifname.$vlanid failed with return code equals to $rc"
|
||||
echo "$lines" \
|
||||
| $sed -e 's/^/>> /g' \
|
||||
| log_lines info
|
||||
if [ x$xcatnet != x ]; then
|
||||
# bring up interface formally
|
||||
lines=`$ifdown $ifname.$vlanid; $ifup $ifname.$vlanid`
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
log_warn "ifup $ifname.$vlanid failed with return code equals to $rc"
|
||||
echo "$lines" \
|
||||
| $sed -e 's/^/>> /g' \
|
||||
| log_lines info
|
||||
fi
|
||||
fi
|
||||
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -1272,7 +1292,6 @@ function create_bond_interface {
|
||||
log_error "No valid slave_ports defined. Abort!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# let's query "nicnetworks" table about its target "xcatnet"
|
||||
if [ -n "$ifname" -a -z "$xcatnet" -a -z "$_ipaddr" ]; then
|
||||
xcatnet=`query_nicnetworks_net $ifname`
|
||||
@@ -1421,7 +1440,6 @@ function create_bond_interface {
|
||||
# 3.1) Check bond interface status
|
||||
wait_for_ifstate $ifname UP 200 1
|
||||
rc=$?
|
||||
|
||||
# log for debug
|
||||
$ip link show $ifname | $sed -e 's/^/[ip.link] >> /g' | log_lines info
|
||||
|
||||
@@ -1461,15 +1479,16 @@ function create_bond_interface {
|
||||
ifname=$ifname \
|
||||
xcatnet=$xcatnet \
|
||||
inattrs="$cfg"
|
||||
lines=`$ifdown $ifname; $ifup $ifname 2>&1`
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
log_warn "ifup $ifname failed with return code equals to $rc"
|
||||
echo "$lines" \
|
||||
| $sed -e 's/^/'$ifname' ifup out >> /g' \
|
||||
| log_lines info
|
||||
if [ x$xcatnet != x ]; then
|
||||
lines=`$ifdown $ifname; $ifup $ifname 2>&1`
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
log_warn "ifup $ifname failed with return code equals to $rc"
|
||||
echo "$lines" \
|
||||
| $sed -e 's/^/'$ifname' ifup out >> /g' \
|
||||
| log_lines info
|
||||
fi
|
||||
fi
|
||||
|
||||
wait_for_ifstate $ifname UP 200 1
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
|
Reference in New Issue
Block a user