2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

Remove trailing spaces in file xCAT-vlan/install/postscripts/deconfigvlan

This commit is contained in:
GONG Jie 2017-12-31 23:59:59 +00:00
parent cb9dbbca13
commit 3ac5e22de8

View File

@ -4,13 +4,13 @@
#
# this script deconfigures the vlan on the node.
# deconfigvlan <vlan_id>
# if vlan_is is not specified, all the vlans defined
# if vlan_is is not specified, all the vlans defined
# for the given node will be deconfigured.
#
#-------------------------------------------------------------------------------------
if [[ -z $VLANMAXINDEX ]] || [[ $VLANMAXINDEX -eq 0 ]]; then
logger -t xcat "deconfigvlan: Nothing to do."
echo "deconfigvlan: Nothing to do."
echo "deconfigvlan: Nothing to do."
exit 0
fi
@ -18,18 +18,18 @@ if [[ $OSTYPE = linux* ]]; then
if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]]; then
nwdir="/etc/sysconfig/network"
isSLES=1
else
else
nwdir="/etc/sysconfig/network-scripts"
fi
fi
else
logger -t xcat "deconfigvlan: Does not support AIX yet."
echo "deconfigvlan: Does not support AIX yet."
echo "deconfigvlan: Does not support AIX yet."
exit 0
fi
if [[ -n "$1" ]]; then
IN_VLAN=$1 #The vlan id to be deconfigured, if not specified, all will be deconfigured on this note.
IN_VLAN=$1 #The vlan id to be deconfigured, if not specified, all will be deconfigured on this note.
fi
index=1
@ -47,7 +47,7 @@ while [ $index -le $VLANMAXINDEX ]; do
eval VLANNIC=\$VLANNIC_$index #VLANNIC could be ethx, primary, primary:ethx or empty
#determine if the current is primary network
PMRY=0
PMRY=0
if [[ -z $VLANNIC ]] || [[ $VLANNIC = primary* ]]; then
PMRY=1
fi
@ -62,7 +62,7 @@ while [ $index -le $VLANMAXINDEX ]; do
eval VLAN_VMNICPOS=\$VLAN_VMNICPOS_$index #VLAN_VMNICPOS identifies the position of the mac address in mac, the mac has the following format: 01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth
PMRY=0
if [[ $index -eq 1 ]]; then
if [[ $index -eq 1 ]]; then
PMRY=1 ##the first one is always primary network
fi
@ -70,11 +70,11 @@ while [ $index -le $VLANMAXINDEX ]; do
nic="eth1"
fi
fi
if [[ -z $nic ]]; then #get the nic
if [[ -n $MACADDRESS ]]; then
if [[ -n $MACADDRESS ]]; then
pos=0
#mac has the following format: 01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1
for x in `echo "$MACADDRESS" | tr "|" "\n"`
@ -116,9 +116,9 @@ while [ $index -le $VLANMAXINDEX ]; do
if [[ -z $mac ]]; then
if [[ -n $VMNODE ]]; then
mac=$mac1
else
if [[ -z "$PRIMARYNIC" ]] || [[ "$PRIMARYNIC" = "mac" ]]; then
mac=$mac1
else
if [[ -z "$PRIMARYNIC" ]] || [[ "$PRIMARYNIC" = "mac" ]]; then
mac=$mac1 #if nothing mathes, take the first mac
else
nic=$PRIMARYNIC #or the primary nic itself is the nic
@ -139,7 +139,7 @@ while [ $index -le $VLANMAXINDEX ]; do
ret=`ifconfig |grep -i $mac | cut -d' ' -f 1 2>&1`;
if [ $? -eq 0 ]; then
for x in $ret
do
do
#ignore bridge because bridge and the nic has the same mac address
if [[ $isSLES -eq 1 ]]; then
ret1=`grep -i "TYPE='Bridge'" $nwdir/ifcfg-$x 2>&1`;
@ -156,7 +156,7 @@ while [ $index -le $VLANMAXINDEX ]; do
fi
else
logger -t xcat "deconfigvlan: The mac address for the network for $NODE is not defined."
echo "deconfigvlan: The mac address for the network for $NODE is not defined."
echo "deconfigvlan: The mac address for the network for $NODE is not defined."
index=$((index+1))
continue
fi
@ -165,7 +165,7 @@ while [ $index -le $VLANMAXINDEX ]; do
eval VLANID=\$VLANID_$index
eval VLANIP=\$VLANIP_$index
eval VLANNETMASK=\$VLANNETMASK_$index
eval VLANNETMASK=\$VLANNETMASK_$index
#write into the network configuration file
if [ -z "$VMNODE" ]; then
@ -187,19 +187,19 @@ while [ $index -le $VLANMAXINDEX ]; do
#remove the network conf file for the vlan
ret=`rm $nwdir/ifcfg-$newnic 2>&1`
else
else
logger -t xcat "deconfigvlan: cannot find the nic that has the vlan."
echo "deconfigvlan: cannot find the nic that has the vlan"
echo "deconfigvlan: cannot find the nic that has the vlan"
fi
#stop the bridge on the vm hosts,
#stop the bridge on the vm hosts,
if [ -f $nwdir/ifcfg-vl$VLANID ]; then
ret=`ifconfig vl$VLANID down 2>&1`
ret=`rm $nwdir/ifcfg-vl$VLANID 2>&1`
ret=`brctl delbr vl$VLANID 2>&1`
fi
if [[ $PMRY -eq 1 ]]; then
if [[ $PMRY -eq 1 ]]; then
logger -t xcat "dconfigvlan: changing the hostname back to $NODE..."
echo "dconfigvlan: changing the hostname back to $NODE..."
#change the hostname