mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-31 01:56:39 +00:00
Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
ae85fe3e7f
@ -72,6 +72,7 @@ require Exporter;
|
||||
"1339640148.070971" => "rhelhpc6.3",#x86_64
|
||||
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
|
||||
"1384196516.465862" => "rhelhpc6.5",#x86_64, RHEL ComputeNode
|
||||
"1399449226.140088" => "rhelhpc7.0",#x86_64, RHEL ComputeNode
|
||||
"1194015916.783841" => "fedora8",
|
||||
"1194015385.299901" => "fedora8",
|
||||
"1210112435.291709" => "fedora9",
|
||||
|
@ -62,7 +62,8 @@ else
|
||||
file=$1
|
||||
fi
|
||||
|
||||
ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 |
|
||||
#ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 |
|
||||
ip -4 -oneline addr show 2>/dev/null |grep inet | sed -ne "s/.*inet //p"|awk -F ' ' '{print $1}'|awk -F '/' '{print $1}'|
|
||||
while read my_address ; do
|
||||
##print "checking $my_address"
|
||||
grep -q " ${my_address}$" $file
|
||||
|
@ -1822,7 +1822,7 @@ sub restorexcatdb
|
||||
else
|
||||
{
|
||||
#$xcmd = "service xcatd restart";
|
||||
my $ret=xCAT::Utils->restartservie("xcatd");
|
||||
my $ret=xCAT::Utils->restartservice("xcatd");
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,10 @@ while [ $WAITING -gt 0 ]; do
|
||||
done
|
||||
WAITING=0
|
||||
if [ ! -z "$FORCENICS" ]; then
|
||||
for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep "$FORCENICS"`; do
|
||||
if ! ifconfig $nic|grep "inet addr" > /dev/null; then
|
||||
#for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep "$FORCENICS"`; do
|
||||
for nic in `ip -oneline link show |grep -i ether |awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"|egrep "$FORCENICS"`; do
|
||||
# if ! ifconfig $nic|grep "inet addr" > /dev/null; then
|
||||
if ! ip -4 -oneline addr show $nic|grep -i inet > /dev/null; then
|
||||
WAITING=1
|
||||
fi
|
||||
done
|
||||
|
@ -1590,7 +1590,8 @@ send_monitor_msg() {
|
||||
|
||||
# Get the client mac address.
|
||||
if [ -z "$mac" ]; then
|
||||
mac=`ifconfig $DEVICE 2>/dev/null | sed -ne "s/.*HWaddr //p" | sed "s/ //g" | sed s/:/./g`
|
||||
#mac=`ifconfig $DEVICE 2>/dev/null | sed -ne "s/.*HWaddr //p" | sed "s/ //g" | sed s/:/./g`
|
||||
mac=`ip -4 -oneline link show $DEVICE 2>/dev/null|grep -i ether|sed -ne "s/.*ether //p"|awk -F ' ' '{print $1}'|sed s/:/./g`
|
||||
fi
|
||||
|
||||
# Collect some special info only after proc file system is mounted.
|
||||
|
@ -752,15 +752,19 @@ sub mknetboot
|
||||
my $useifname=0;
|
||||
#for rhels5.x-ppc64, if installnic="mac", BOOTIF=<mac> should be appended
|
||||
my $usemac=0;
|
||||
my $nicname="";
|
||||
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
|
||||
$useifname=1;
|
||||
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
|
||||
#$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
|
||||
$nicname=$reshash->{$node}->[0]->{installnic};
|
||||
} elsif ($nodebootif) {
|
||||
$useifname=1;
|
||||
$kcmdline .= "ifname=$nodebootif:";
|
||||
#$kcmdline .= "ifname=$nodebootif:";
|
||||
$nicname=$nodebootif;
|
||||
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
|
||||
$useifname=1;
|
||||
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
|
||||
#$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
|
||||
$nicname=$reshash->{$node}->[0]->{primarynic};
|
||||
}else{
|
||||
if($arch=~ /ppc/)
|
||||
{
|
||||
@ -790,24 +794,32 @@ sub mknetboot
|
||||
# }
|
||||
}
|
||||
|
||||
if ($useifname && $mac) {
|
||||
$kcmdline .= "$mac ";
|
||||
if( ($nicname ne "") and (not xCAT::NetworkUtils->isValidMAC($nicname) )){
|
||||
if ($useifname && $mac) {
|
||||
$kcmdline .= "ifname=$nicname:$mac ";
|
||||
}
|
||||
$kcmdline .= "netdev=$nicname ";
|
||||
}else {
|
||||
if($mac){
|
||||
$kcmdline .= "BOOTIF=$mac ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# add "netdev=<eth0>" or "BOOTIF=<mac>"
|
||||
# which are used for other scenarios
|
||||
my $netdev = "";
|
||||
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
|
||||
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
|
||||
} elsif ($nodebootif) {
|
||||
$kcmdline .= "netdev=" . $nodebootif . " ";
|
||||
} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
|
||||
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
|
||||
} else {
|
||||
if ( ($usemac || $useifname) && $mac) {
|
||||
$kcmdline .= "BOOTIF=" . $mac . " ";
|
||||
}
|
||||
}
|
||||
#my $netdev = "";
|
||||
#if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
|
||||
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
|
||||
#} elsif ($nodebootif) {
|
||||
# $kcmdline .= "netdev=" . $nodebootif . " ";
|
||||
#} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
|
||||
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
|
||||
#} else {
|
||||
# if ( ($usemac || $useifname) && $mac) {
|
||||
# $kcmdline .= "BOOTIF=" . $mac . " ";
|
||||
# }
|
||||
#}
|
||||
|
||||
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
|
||||
if ( $client_nethash{$node}{mgtifname} =~ /hf/ )
|
||||
|
@ -236,7 +236,8 @@ if [ -z $STATEMNT ]; then
|
||||
MACX=`ip link show $netdev | grep ether | awk '{print $2}'`
|
||||
elif [ ! -z "$BOOTIF" ]; then
|
||||
MACX=$BOOTIF
|
||||
ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'`
|
||||
#ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'`
|
||||
ETHX=` ip -oneline link show |grep -i $BOOTIF|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
fi
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
|
@ -1154,7 +1154,8 @@ for i in `cat /proc/cmdline`; do
|
||||
NETDEV=`echo \$i |awk -F= '{print \$2}'`
|
||||
elif [ "\$KEY" == 'BOOTIF' ]; then
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'|sed -e s/^01-// -e s/-/:/g`
|
||||
BOOTIF=`ifconfig -a|grep -i "hwaddr \$VALUE"|awk '{print \$1}'`
|
||||
#BOOTIF=`ifconfig -a|grep -i "hwaddr \$VALUE"|awk '{print \$1}'`
|
||||
BOOTIF=\`ip -oneline link show |grep -i \$VALUE|awk -F ':' '{print \$2}'|grep -o \"[^ ]\+\( \+[^ ]\+\)*\"\`
|
||||
elif [ "\$KEY" == 'XCAT' ]; then
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
# format: XCAT=xcatmaster:3001
|
||||
|
@ -166,7 +166,8 @@ if [ -z $STATEMNT ]; then
|
||||
MACX=`ip link show $netdev | grep ether | awk '{print $2}'`
|
||||
elif [ ! -z "$BOOTIF" ]; then
|
||||
MACX=$BOOTIF
|
||||
ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'`
|
||||
#ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'`
|
||||
ETHX=` ip -oneline link show |grep -i $BOOTIF|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
fi
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
|
@ -13,7 +13,8 @@ if [ -r /sys/devices/virtual/dmi/id/product_uuid ]; then
|
||||
duid=$duid$octnum
|
||||
done
|
||||
duid=$duid'";'
|
||||
for interface in `ifconfig -a|grep HWaddr|awk '{print $1}'`; do
|
||||
#for interface in `ifconfig -a|grep HWaddr|awk '{print $1}'`; do
|
||||
for interface in `ip -4 -oneline link show|grep -i ether |awk -F ":" '{print $2}'| grep -o "[^ ]\+\( \+[^ ]\+\)*"`; do
|
||||
echo $duid > /var/lib/dhclient/dhclient6-$interface.leases
|
||||
done
|
||||
echo $duid > /var/lib/dhclient/dhclient6.leases
|
||||
|
@ -20,7 +20,8 @@ TIMESTAMP=$(printf "%08X:%08X" $SECONDS $NTPTICKS)
|
||||
|
||||
#next, get a mac address and convert to eui64
|
||||
EUIPAD="FF:FE"
|
||||
MAC=$(/sbin/ifconfig|grep HWaddr|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|awk '{print $NF}')
|
||||
#MAC=$(/sbin/ifconfig|grep HWaddr|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|awk '{print $NF}')
|
||||
MAC=$(ip -oneline link show|grep -v usb|grep -v 00:00:00:00:00:00|head -n 1|sed -ne "s/.*link\/ether //p"|awk -F ' ' '{print $1}')
|
||||
FIRSTBYTE=${MAC%%:*}
|
||||
FIRSTBYTE=$(printf %02X $((0x$FIRSTBYTE|2)))
|
||||
OTHERMANUF=${MAC%%:??:??:??}
|
||||
|
@ -7,13 +7,15 @@ function get_def_interface {
|
||||
#we are, however, presuming ipv4 for the moment
|
||||
retval=$(ping -c 1 `hostname`|head -n 1|cut -d\( -f 2|cut -d\) -f 1)
|
||||
if [ -z "$retval" -o "127.0.0.1" = "$retval" ]; then #ok, that didn't pan out, now we grab the first address that looks sane
|
||||
retval=`ifconfig|grep inet" " |grep -v addr:127.0.0.1|grep -v 'addr:169.254'|head -n 1|cut -d: -f 2|cut -d' ' -f 1`
|
||||
#retval=`ifconfig|grep inet" " |grep -v addr:127.0.0.1|grep -v 'addr:169.254'|head -n 1|cut -d: -f 2|cut -d' ' -f 1`
|
||||
retval=`ip -4 -oneline addr show|grep -v "127.0.0.1"|grep -v '169.254'|head -n 1|awk -F 'inet ' '{print $2}'|awk -F '/' '{print $1}'`
|
||||
fi
|
||||
if [ -z "$retval" ]; then
|
||||
echo "ERROR: Unable to reasonably guess the 'default' interface" >&2
|
||||
exit 1
|
||||
fi
|
||||
iface=`ifconfig|grep -v inet6|egrep '(Link|inet)'|grep -B1 'addr:'$retval |head -n 1|awk '{print $1}'`
|
||||
#iface=`ifconfig|grep -v inet6|egrep '(Link|inet)'|grep -B1 'addr:'$retval |head -n 1|awk '{print $1}'`
|
||||
iface=`ip -4 -oneline addr show|grep -i $retval|awk -F ':' '{print $2}'|awk -F ' ' '{print $1}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
if [ -z "$iface" ]; then
|
||||
echo "ERROR: Unable to reasonably guess the default interface" >&2
|
||||
exit 1
|
||||
@ -118,7 +120,8 @@ elif [ "bridgeprereq" = "$1" ]; then
|
||||
# get the port for installation
|
||||
if [ -n "$INSTALLNIC" ]; then
|
||||
if [[ "$INSTALLNIC" = mac ]] || [[ "$INSTALLNIC" = MAC ]]; then
|
||||
INSPORT=`ifconfig -a|grep -v inet6| grep -i 'HWaddr '$MACADDRESS|head -n 1|awk '{print $1}'`
|
||||
#INSPORT=`ifconfig -a|grep -v inet6| grep -i 'HWaddr '$MACADDRESS|head -n 1|awk '{print $1}'`
|
||||
INSPORT=`ip -oneline link show|grep -i ether|grep -i $MACADDRESS|awk -F ':' '{print $2}'|grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
else
|
||||
INSPORT=$INSTALLNIC
|
||||
fi
|
||||
|
@ -31,7 +31,8 @@ for i in `/bin/cat /proc/cmdline`; do
|
||||
break
|
||||
elif [ "$KEY" = "BOOTIF" ]; then
|
||||
MACX=`/bin/echo $i | /bin/awk -F= '{print $2}'|sed -e s/^01-// -e s/-/:/g`
|
||||
ETHX=`/sbin/ifconfig | /bin/grep -i $MACX | /bin/awk '{print $1}'`
|
||||
#ETHX=`/sbin/ifconfig | /bin/grep -i $MACX | /bin/awk '{print $1}'`
|
||||
ETHX=`/sbin/ip -oneline link show ens33|/bin/grep -i $MACX |/bin/awk -F ":" '{print $2}'|/bin/grep -o "[^ ]\+\( \+[^ ]\+\)*"`
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
@ -81,7 +81,8 @@ for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do
|
||||
if ( pmatch $OSVER "ubuntu*" )
|
||||
then
|
||||
NETWORK=`network_ipv4calc $IPADDR $NETMASK`
|
||||
BROADCAST=`ifconfig $nic | grep Bcast | awk '{print $3}' | awk -F: '{print $2}'`
|
||||
#BROADCAST=`ifconfig $nic | grep Bcast | awk '{print $3}' | awk -F: '{print $2}'`
|
||||
BROADCAST=`ip -4 -oneline addr show $nic|grep brd| awk -F ' ' '{print $6}'`
|
||||
|
||||
if [ ! -z "$defgw" ]; then
|
||||
gateway_line="gateway $defgw"
|
||||
|
@ -1,12 +1,18 @@
|
||||
# esx setup
|
||||
# example on how to set up ESX. We setup ssh and also add a basic
|
||||
# VLAN configuration
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
logger -t xcat -p local4.info setupesx
|
||||
# Enable SSH access to root and exchange keys
|
||||
|
||||
sed -e 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config > /etc/ssh/sshd_config.new
|
||||
mv -f /etc/ssh/sshd_config.new /etc/ssh/sshd_config
|
||||
/etc/init.d/sshd restart
|
||||
#/etc/init.d/sshd restart
|
||||
restartservice ssh
|
||||
|
||||
if [ -r /etc/ssh/sshd_config ]
|
||||
then
|
||||
@ -43,8 +49,11 @@ cat >/tmp/esxcfg.sh <<EOF1
|
||||
# Configure ESX Server. You'll need to put your own IP address
|
||||
# in here. We assume eth0 is your nic. Change if needed.
|
||||
NIC=eth0
|
||||
IPADDR=`ifconfig $NIC |grep "inet addr"|awk '{print $2}' |awk -F: '{print $2}' | head -1`
|
||||
NETMASK=`ifconfig $NIC |grep "inet addr"|awk '{print $4}' |awk -F: '{print $2}'`
|
||||
#IPADDR=`ifconfig $NIC |grep "inet addr"|awk '{print $2}' |awk -F: '{print $2}' | head -1`
|
||||
IPADDR=`ip -4 -oneline addr show $NIC|grep inet|awk -F ' ' '{print $4}'|awk -F '/' '{print $1}'`
|
||||
#NETMASK=`ifconfig $NIC |grep "inet addr"|awk '{print $4}' |awk -F: '{print $2}'`
|
||||
NETMASK=`ip -4 -oneline addr show $NIC|grep inet|awk -F ' ' '{print $4}'|awk -F '/' '{print $2}'`
|
||||
NETMASK=`v4prefix2mask $NETMASK`
|
||||
|
||||
#esxcfg-vswitch -U vmnic0 vSwitch0
|
||||
esxcfg-vswitch -L vmnic0 vSwitch0
|
||||
@ -56,7 +65,8 @@ esxcfg-firewall -o 123,udp,out,ntpServer
|
||||
esxcfg-firewall -o 514,udp,out,syslog
|
||||
esxcfg-firewall -l
|
||||
logger -t xcat -p local4.info "Install: restart syslog"
|
||||
service syslog restart
|
||||
#service syslog restart
|
||||
restartservice syslog
|
||||
|
||||
EOF1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user