mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-18 20:30:56 +00:00
- Undo some changes in doxcat that was causing problems.
- clean up some of the logging messages
This commit is contained in:
@ -8,20 +8,23 @@ log_label="xcat.genesis.doxcat"
|
||||
# Start rsyslogd and log into a local file specified in /etc/rsyslog.conf
|
||||
# Later, once xCAT MN is known, dhclient-script will change
|
||||
# rsyslog.conf file to send log entries to xCAT MN
|
||||
if [ ! -f /var/run/syslogd.pid ]; then
|
||||
#
|
||||
# start rsyslog ONLY if not already started
|
||||
#
|
||||
RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1`
|
||||
if [ $RSYSLOGD_VERSION -ge 8 ]; then
|
||||
/sbin/rsyslogd
|
||||
# Newer vers of rsyslogd (8 and higher) do not support -c flag anymore
|
||||
else
|
||||
/sbin/rsyslogd -c4
|
||||
fi
|
||||
logger -s -t $log_label -p local4.info "Starting syslog..."
|
||||
ls /var/run/
|
||||
RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1`
|
||||
|
||||
# if syslog is running and there's a pid file, kill it before restarting syslogd
|
||||
if [ -f /var/run/syslogd.pid ]; then
|
||||
kill -TERM `cat /var/run/syslogd.pid`
|
||||
fi
|
||||
|
||||
if [ $RSYSLOGD_VERSION -ge 8 ]; then
|
||||
/sbin/rsyslogd
|
||||
# Newer vers of rsyslogd (8 and higher) do not support -c flag anymore
|
||||
else
|
||||
/sbin/rsyslogd -c4
|
||||
fi
|
||||
|
||||
logger -t $log_label -p local4.info "Beginning doxcat process..."
|
||||
logger -s -t $log_label -p local4.info "Beginning doxcat process..."
|
||||
|
||||
modprobe acpi_cpufreq 2>/dev/null # on some machines this fails
|
||||
modprobe cpufreq_ondemand
|
||||
@ -44,7 +47,7 @@ if [ ! -z "$BOOTIF" ]; then
|
||||
gripeiter=$((gripeiter-1))
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Done"
|
||||
if [ -z "$bootnic" ]; then
|
||||
logger -s -t $log_label -p local4.err "BOOTIF missing, can't detect boot nic"
|
||||
fi
|
||||
@ -87,26 +90,24 @@ PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout 2> /dev/null|grep -v "PUBL
|
||||
PUBKEY=`echo $PUBKEY|sed -e 's/ //g'`
|
||||
export PUBKEY
|
||||
|
||||
LLDP_DIR="/var/lib/lldpad"
|
||||
|
||||
logger -t $log_label -p local4.info "Creating ${LLDP_DIR} directory and config files..."
|
||||
mkdir -p ${LLDP_DIR}
|
||||
echo 'lldp :' >> ${LLDP_DIR}/lldpad.conf
|
||||
echo '{' >> ${LLDP_DIR}/lldpad.conf
|
||||
logger -s -t $log_label -p local4.info "Creating /var/lib/lldpad file..."
|
||||
mkdir -p /var/lib/lldpad
|
||||
echo 'lldp :' >> /var/lib/lldpad/lldpad.conf
|
||||
echo '{' >> /var/lib/lldpad/lldpad.conf
|
||||
for iface in `ip link |grep -v '^ '|awk '{print $2}'|sed -e 's/:$//'|grep -v lo`; do
|
||||
echo "$iface :" >> ${LLDP_DIR}/lldpad.conf
|
||||
echo "{" >> ${LLDP_DIR}/lldpad.conf
|
||||
echo "tlvid00000006 :" >> ${LLDP_DIR}/lldpad.conf
|
||||
echo "{" >> ${LLDP_DIR}/lldpad.conf
|
||||
echo info = '"'$PUBKEY'";' >> ${LLDP_DIR}/lldpad.conf
|
||||
echo 'enableTx = true;' >> ${LLDP_DIR}/lldpad.conf
|
||||
echo '};' >> ${LLDP_DIR}/lldpad.conf
|
||||
echo 'adminStatus = 3;' >> ${LLDP_DIR}/lldpad.conf
|
||||
echo '};' >> ${LLDP_DIR}/lldpad.conf
|
||||
echo "$iface :" >> /var/lib/lldpad/lldpad.conf
|
||||
echo "{" >> /var/lib/lldpad/lldpad.conf
|
||||
echo "tlvid00000006 :" >> /var/lib/lldpad/lldpad.conf
|
||||
echo "{" >> /var/lib/lldpad/lldpad.conf
|
||||
echo info = '"'$PUBKEY'";' >> /var/lib/lldpad/lldpad.conf
|
||||
echo 'enableTx = true;' >> /var/lib/lldpad/lldpad.conf
|
||||
echo '};' >> /var/lib/lldpad/lldpad.conf
|
||||
echo 'adminStatus = 3;' >> /var/lib/lldpad/lldpad.conf
|
||||
echo '};' >> /var/lib/lldpad/lldpad.conf
|
||||
done
|
||||
echo '};' >> ${LLDP_DIR}/lldpad.conf
|
||||
echo '};' >> /var/lib/lldpad/lldpad.conf
|
||||
lldpad -d
|
||||
logger -t $log_label -p local4.info "lldpad started."
|
||||
logger -s -t $log_label -p local4.info "lldpad started."
|
||||
|
||||
# Caclulate the broadcast address of a given IP address and mask.
|
||||
bcastcalc(){
|
||||
@ -166,7 +167,7 @@ done
|
||||
export XCATPORT
|
||||
export XCATMASTER
|
||||
|
||||
logger -t $log_label -p local4.info "XCATMASTER is $XCATMASTER, XCATPORT is $XCATPORT"
|
||||
logger -s -t $log_label -p local4.info "XCATMASTER is $XCATMASTER, XCATPORT is $XCATPORT"
|
||||
|
||||
if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then
|
||||
# doing static ip
|
||||
@ -191,12 +192,8 @@ else
|
||||
while [ $tries -lt 100 ]; do
|
||||
ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo | sort -n -r`
|
||||
for tmp1 in $ALLUP_NICS; do
|
||||
if [ ! -f /var/run/dhclient.$tmp1.pid ]; then
|
||||
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 &
|
||||
fi
|
||||
if [ ! -f /var/run/dhclient6.$tmp1.pid $tmp1 ]; then
|
||||
dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases &
|
||||
fi
|
||||
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 &
|
||||
dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases &
|
||||
#bootnic=$tmp1
|
||||
#break
|
||||
done
|
||||
@ -285,7 +282,7 @@ if [ -e "/dev/rtc" ]; then
|
||||
hwclock --systohc
|
||||
fi
|
||||
HOST_ARCH=`uname -m`
|
||||
if [ `echo $HOST_ARCH | grep "ppc64" > /dev/null; echo $?` == 0 ]; then
|
||||
if echo $HOST_ARCH | grep "ppc64"; then
|
||||
modprobe ipmi_powernv
|
||||
else
|
||||
modprobe ipmi_si
|
||||
@ -301,37 +298,32 @@ fi
|
||||
DEVICE=$bootnic
|
||||
export DEVICE
|
||||
|
||||
logger -t $log_label -p local4.info "IPMI SUPPORT=${IPMI_SUPPORT}, DEVICE=$bootnic"
|
||||
|
||||
if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can and should get a cert
|
||||
logger -t $log_label -p local4.info "Run /bin/getcert to xCAT Master ($XCATMASTER:$XCATPORT)..."
|
||||
logger -s -t $log_label -p local4.info "Getting initial certificate --> $XCATMASTER:$XCATPORT"
|
||||
/bin/getcert $XCATMASTER:$XCATPORT
|
||||
fi
|
||||
|
||||
while :; do
|
||||
|
||||
grepconfigraid=`echo $destiny|grep "configraid"`
|
||||
if [ -z "$destiny" -o -n "$grepconfigraid" ]; then
|
||||
logger -t $log_label -p local4.info "Run getdestiny to xCAT Master ($XCATMASTER:$XCATPORT)..."
|
||||
logger -s -t $log_label -p local4.info "Running getdestiny --> $XCATMASTER:$XCATPORT"
|
||||
destiny=`getdestiny $XCATMASTER:$XCATPORT`
|
||||
logger -s -t $log_label -p local4.info "Received destiny=$destiny"
|
||||
fi
|
||||
|
||||
# parse out some values from the destiny
|
||||
destparameter=`echo $destiny|cut -d '=' -f 2-`
|
||||
logger -t $log_label -p local4.info "The destparameter is $destparameter"
|
||||
|
||||
destiny=`echo $destiny|awk -F= '{print $1}'`
|
||||
logger -t $log_label -p local4.info "The destiny is $destiny"
|
||||
|
||||
dest=`echo $destiny|awk '{print $1}'` #could probably use bash but oh well
|
||||
logger -t $log_label -p local4.info "The destiny is $dest"
|
||||
|
||||
logger -s -t $log_label -p local4.info "The destiny=$dest, destiny parameters=$destparameter"
|
||||
|
||||
|
||||
if [ "$dest" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do
|
||||
logger -t $log_label -p local4.info "Run Discovery..."
|
||||
logger -s -t $log_label -p local4.info "Running dodiscovery..."
|
||||
/bin/dodiscovery
|
||||
logger -t $log_label -p local4.info "... Discovery complete."
|
||||
logger -t $log_label -p local4.info "Run /bin/getcert to xCAT Master ($XCATMASTER:$XCATPORT)..."
|
||||
logger -s -t $log_label -p local4.info "dodiscovery - Complete."
|
||||
|
||||
logger -s -t $log_label -p local4.info "Getting certificate --> $XCATMASTER:$XCATPORT"
|
||||
/bin/getcert $XCATMASTER:$XCATPORT
|
||||
destiny=''
|
||||
dest=''
|
||||
@ -340,21 +332,21 @@ while :; do
|
||||
destiny=''
|
||||
dest=''
|
||||
/bin/bash
|
||||
logger -t $log_label -p local4.info "Exiting shell."
|
||||
logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..."
|
||||
logger -s -t $log_label -p local4.info "Exited shell."
|
||||
logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..."
|
||||
/bin/nextdestiny $XCATMASTER:$XCATPORT
|
||||
logger -t $log_label -p local4.info "Nextdestiny done."
|
||||
logger -s -t $log_label -p local4.info "nextdestiny - Complete."
|
||||
elif [ "$dest" = runcmd ]; then
|
||||
logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..."
|
||||
logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..."
|
||||
destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT`
|
||||
dest=`echo $destiny|awk -F= '{print $1}'`
|
||||
$destparameter
|
||||
logger -t $log_label -p local4.info "Nextdestiny done."
|
||||
logger -s -t $log_label -p local4.info "nextdestiny - Complete."
|
||||
elif [ "$dest" = runimage ]; then
|
||||
logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..."
|
||||
logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..."
|
||||
destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT`
|
||||
dest=`echo $destiny|awk -F= '{print $1}'`
|
||||
logger -t $log_label -p local4.info "Nextdestiny done."
|
||||
logger -s -t $log_label -p local4.info "nextdestiny - Complete."
|
||||
mkdir /tmp/`basename $destparameter`
|
||||
cd /tmp/`basename $destparameter`
|
||||
eval destparameter=$destparameter
|
||||
@ -375,9 +367,9 @@ while :; do
|
||||
./runme.sh
|
||||
cd -
|
||||
elif [ "$dest" = "reboot" -o "$dest" = "boot" ]; then
|
||||
logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..."
|
||||
logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..."
|
||||
/bin/nextdestiny $XCATMASTER:$XCATPORT
|
||||
logger -t $log_label -p local4.info "Nextdestiny done."
|
||||
logger -s -t $log_label -p local4.info "nextdestiny - Complete."
|
||||
if [ $IPMI_SUPPORT -ne 0 ]; then
|
||||
ipmitool chassis bootdev pxe
|
||||
fi
|
||||
@ -386,12 +378,12 @@ while :; do
|
||||
if [ $IPMI_SUPPORT -ne 0 ]; then
|
||||
ipmitool chassis bootdev pxe
|
||||
fi
|
||||
logger -t $log_label -p local4.info "Reboot..."
|
||||
logger -s -t $log_label -p local4.info "Reboot..."
|
||||
reboot -f
|
||||
elif [ "$dest" = sysclone ]; then
|
||||
logger -t $log_label -p local4.info "Run dosysclone..."
|
||||
logger -s -t $log_label -p local4.info "Running dosysclone..."
|
||||
/bin/dosysclone
|
||||
logger -t $log_label -p local4.info "Dosysclone done."
|
||||
logger -s -t $log_label -p local4.info "dosysclone - Complete."
|
||||
destiny=''
|
||||
dest=''
|
||||
elif [ "$dest" = standby ]; then
|
||||
@ -399,24 +391,24 @@ while :; do
|
||||
dest=''
|
||||
delay=$((30+$RANDOM%270))
|
||||
while [ $delay -gt 0 ]; do
|
||||
if [ $((delay%10)) == 0 ]; then
|
||||
logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds"
|
||||
if [ $((delay%10)) == 0 ]; then
|
||||
logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds"
|
||||
fi
|
||||
delay=$((delay-1))
|
||||
sleep 1
|
||||
done
|
||||
echo "Retrying ";
|
||||
elif [ "$dest" = shutdown ]; then
|
||||
logger -t $log_label -p local4.info "Poweroff..."
|
||||
logger -s -t $log_label -p local4.info "Poweroff..."
|
||||
poweroff -f
|
||||
else
|
||||
logger -s -t $log_label -p local4.err "Unrecognized directive $dest"
|
||||
logger -s -t $log_label -p local4.err "Unrecognized directive (dest=$dest)"
|
||||
destiny=''
|
||||
dest=''
|
||||
delay=$((30+$RANDOM%270))
|
||||
while [ $delay -gt 0 ]; do
|
||||
if [ $((delay%10)) == 0 ]; then
|
||||
logger -s -t $log_label -p local4.info "Will retry in $delay seconds"
|
||||
if [ $((delay%10)) == 0 ]; then
|
||||
logger -s -t $log_label -p local4.info "... Will retry xCAT in $delay seconds"
|
||||
fi
|
||||
delay=$((delay-1))
|
||||
sleep 1
|
||||
@ -425,5 +417,5 @@ while :; do
|
||||
fi
|
||||
done
|
||||
|
||||
logger -t $log_label -p local4.info "doxcat is done"
|
||||
logger -s -t $log_label -p local4.info "doxcat is complete"
|
||||
set +x
|
||||
|
Reference in New Issue
Block a user