mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-11 07:40:11 +00:00
Remove trailing spaces in file xCAT-vlan/install/postscripts/configvlan
This commit is contained in:
@ -1,22 +1,22 @@
|
||||
#!/bin/sh
|
||||
#!/bin/sh
|
||||
|
||||
#-------------------------------------------------------------------------------------
|
||||
#
|
||||
# this script configures the vlan on the node, assuming the vlan is already creaed on the switch.
|
||||
# this script configures the vlan on the node, assuming the vlan is already creaed on the switch.
|
||||
# configvlan <vlan_id>
|
||||
# if vlan_is is not specified, all the vlans defined for the
|
||||
# if vlan_is is not specified, all the vlans defined for the
|
||||
# given node will be configured.
|
||||
#
|
||||
#-------------------------------------------------------------------------------------
|
||||
#if [[ -z "$VLANID" ]] || [[ -z "$VLANHOSTNAME" ]] || [[ -z "$VLANIP" ]]; then
|
||||
# logger -t xcat "configvlan: please make sure that vlan id, vlan hostname and vlan ip are defined for this node.\nPlease use mkvlan or chvlan command."
|
||||
# echo "configvlan: please make sure that vlan id, vlan hostname and vlan ip are defined for this node.\nPlease use mkvlan or chvlan command."
|
||||
# echo "configvlan: please make sure that vlan id, vlan hostname and vlan ip are defined for this node.\nPlease use mkvlan or chvlan command."
|
||||
# exit 0
|
||||
#fi
|
||||
|
||||
if [[ -z $VLANMAXINDEX ]] || [[ $VLANMAXINDEX -eq 0 ]]; then
|
||||
logger -t xcat "configvlan: Nothing to do."
|
||||
echo "configvlan: Nothing to do."
|
||||
echo "configvlan: Nothing to do."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -24,12 +24,12 @@ 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 "configvlan: Does not support AIX yet."
|
||||
echo "configvlan: Does not support AIX yet."
|
||||
echo "configvlan: Does not support AIX yet."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -38,31 +38,31 @@ fi
|
||||
keephostname=0
|
||||
if [ $# -eq 1 ]
|
||||
then
|
||||
if [ "$1" = "--keephostname"]
|
||||
if [ "$1" = "--keephostname"]
|
||||
then
|
||||
keephostname=1
|
||||
else
|
||||
# the original logic
|
||||
if [[ -n "$1" ]]; then
|
||||
IN_VLAN=$1 #The vlan id to be configured, if not specified, all will be configured on this note.
|
||||
IN_VLAN=$1 #The vlan id to be configured, if not specified, all will be configured on this note.
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $# -gt 1 ]
|
||||
then
|
||||
if [ "$1" = "--keephostname" ]
|
||||
if [ "$1" = "--keephostname" ]
|
||||
then
|
||||
logger -t xcat "configvlan: Usage: configvlan <vlanid> <--keephostname>. Correct the arguments order."
|
||||
echo "configvlan: Usage: configvlan <vlanid> <--keephostname>. Correct the arguments order."
|
||||
echo "configvlan: Usage: configvlan <vlanid> <--keephostname>. Correct the arguments order."
|
||||
exit -1
|
||||
fi
|
||||
# the original logic
|
||||
IN_VLAN=$1 #The vlan id to be configured, if not specified, all will be configured on this note.
|
||||
if [ "$2" != "--keephostname" ]
|
||||
IN_VLAN=$1 #The vlan id to be configured, if not specified, all will be configured on this note.
|
||||
if [ "$2" != "--keephostname" ]
|
||||
then
|
||||
logger -t xcat "configvlan: Usage: configvlan <vlanid> <--keephostname>. Correct the arguments order."
|
||||
echo "configvlan: Usage: configvlan <vlanid> <--keephostname>. Correct the arguments order."
|
||||
echo "configvlan: Usage: configvlan <vlanid> <--keephostname>. Correct the arguments order."
|
||||
exit -1
|
||||
fi
|
||||
keephostname=1
|
||||
@ -84,7 +84,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
|
||||
@ -99,7 +99,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
|
||||
|
||||
@ -107,11 +107,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"`
|
||||
@ -153,9 +153,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
|
||||
@ -176,7 +176,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`;
|
||||
@ -193,7 +193,7 @@ while [ $index -le $VLANMAXINDEX ]; do
|
||||
fi
|
||||
else
|
||||
logger -t xcat "configvlan: The mac address for the network for $NODE is not defined."
|
||||
echo "configvlan: The mac address for the network for $NODE is not defined."
|
||||
echo "configvlan: The mac address for the network for $NODE is not defined."
|
||||
index=$((index+1))
|
||||
continue
|
||||
fi
|
||||
@ -202,7 +202,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
|
||||
@ -213,7 +213,7 @@ while [ $index -le $VLANMAXINDEX ]; do
|
||||
logger -t xcat "configvlan: configuring vlan $VLANID on $newnic for $NODE..."
|
||||
echo "configvlan: configuring vlan $VLANID on $newnic for $NODE..."
|
||||
|
||||
|
||||
|
||||
if [[ $isSLES -eq 1 ]]; then
|
||||
cat >$nwdir/ifcfg-$newnic <<EOF
|
||||
DEVICE='$newnic'
|
||||
@ -237,7 +237,7 @@ EOF
|
||||
echo "VLAN=yes" >> $nwdir/ifcfg-$newnic
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#restart the vlan network
|
||||
logger -t xcat "configvlan: starting $newnic ..."
|
||||
echo "configvlan: starting $newnic ..."
|
||||
@ -249,16 +249,16 @@ EOF
|
||||
echo "configvlan: $ret"
|
||||
index=$((index+1))
|
||||
continue;
|
||||
else
|
||||
else
|
||||
logger -t xcat "configvlan: done."
|
||||
echo "configvlan: done."
|
||||
fi
|
||||
|
||||
#change the hostname only for primary vlan
|
||||
if [[ $PMRY -eq 1 && $keephostname -eq 0 ]]; then
|
||||
if [[ $PMRY -eq 1 && $keephostname -eq 0 ]]; then
|
||||
eval VLANHOSTNAME=\$VLANHOSTNAME_$index
|
||||
hostname $VLANHOSTNAME
|
||||
|
||||
|
||||
#change the hostname permanently
|
||||
if [ -f /etc/SuSE-release ]
|
||||
then
|
||||
|
Reference in New Issue
Block a user