mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-07-03 11:25:33 +00:00
fix #1083, ubuntu, diskless, enable the diskless installation log can be forwarded to the MN
This commit is contained in:
@ -1431,16 +1431,17 @@ sub mknetboot
|
||||
}
|
||||
|
||||
|
||||
if($::XCATSITEVALS{xcatdebugmode} eq "1"){
|
||||
if (($::XCATSITEVALS{xcatdebugmode} eq "1") or ($::XCATSITEVALS{xcatdebugmode} eq "2")) {
|
||||
|
||||
my ($host, $ipaddr) = xCAT::NetworkUtils->gethostnameandip($xcatmaster);
|
||||
if($ipaddr){
|
||||
$kcmdline .=" LOGSERVER=$ipaddr ";
|
||||
}else{
|
||||
$kcmdline .=" LOGSERVER=$xcatmaster ";
|
||||
}
|
||||
my ($host, $ipaddr) = xCAT::NetworkUtils->gethostnameandip($xcatmaster);
|
||||
if ($ipaddr) {
|
||||
$kcmdline .=" LOGSERVER=$ipaddr ";
|
||||
}
|
||||
else {
|
||||
$kcmdline .=" LOGSERVER=$xcatmaster ";
|
||||
}
|
||||
|
||||
$kcmdline .= " xcatdebugmode=1 ";
|
||||
$kcmdline .= " xcatdebugmode=$::XCATSITEVALS{xcatdebugmode} ";
|
||||
}
|
||||
|
||||
|
||||
|
@ -998,15 +998,15 @@ NORMAL=\$RESET
|
||||
# over the root directory.
|
||||
# This function is stolen from redhat
|
||||
shell() {
|
||||
echo ''
|
||||
echo -e "\$YELLOW Entering rescue/debug init shell."
|
||||
echo -e " Exit shell to continue booting.\$RESET"
|
||||
\$SHELL
|
||||
echo ''
|
||||
echo -e "\$YELLOW Entering rescue/debug init shell."
|
||||
echo -e " Exit shell to continue booting.\$RESET"
|
||||
\$SHELL
|
||||
}
|
||||
|
||||
fancydisplay () {
|
||||
clear
|
||||
echo -e "\$CYAN"
|
||||
clear
|
||||
echo -e "\$CYAN"
|
||||
echo '
|
||||
.. :iiii,
|
||||
:tLL; .,:...,.
|
||||
@ -1032,8 +1032,8 @@ echo '
|
||||
;fGGGf, ,;;;;,: tf;jL,
|
||||
;.:::, Powered by xCAT ,j.:;
|
||||
'
|
||||
echo -e "\$RESET"
|
||||
echo -e "\$YELLOW"
|
||||
echo -e "\$RESET"
|
||||
echo -e "\$YELLOW"
|
||||
echo '
|
||||
_________ ________________
|
||||
___ __\\_ ___ \\ / _ \\__ ___/
|
||||
@ -1042,7 +1042,7 @@ echo '
|
||||
/__/\\_ \\\\______ /\\____|__ /____|
|
||||
\\/ \\/ \\/
|
||||
'
|
||||
echo -e "\$RESET"
|
||||
echo -e "\$RESET"
|
||||
}
|
||||
|
||||
EOS1
|
||||
@ -1145,13 +1145,15 @@ for i in `cat /proc/cmdline`; do
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
# format: XCAT=xcatmaster:3001
|
||||
XCATIPORT=\$VALUE
|
||||
elif [ "\$KEY" = 'xcatdebugmode' ]; then
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
xcatdebugmode=\$VALUE
|
||||
fi
|
||||
|
||||
#if "nonodestatus" specified,do not update the nodestatus
|
||||
if [ \$i == 'nonodestatus' ]; then
|
||||
if [ "\$i" = 'nonodestatus' ]; then
|
||||
NODESTATUS='n'
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ -z "\$IFACE" ]; then
|
||||
@ -1183,64 +1185,73 @@ ifconfig lo up
|
||||
|
||||
XCATMASTER=`echo \$XCATSERVER|awk -F: '{print \$1}'`
|
||||
|
||||
if [ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]; then
|
||||
PORT="514"
|
||||
syslogd -R \$XCATMASTER:\$PORT
|
||||
fi
|
||||
|
||||
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "running init script..."
|
||||
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "MASTER=\$XCATMASTER XCATIPORT=\$XCATIPORT"
|
||||
|
||||
#update nodelist.nodestatus to "netbooting"
|
||||
if [ \$NODESTATUS != 'n' ]; then
|
||||
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "nodestatus: netbooting,reporting..."
|
||||
/tmp/updateflag \$XCATMASTER \$XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
cd /
|
||||
for i in `cat /proc/cmdline`; do
|
||||
KEY=`echo \$i |awk -F= '{print \$1}'`
|
||||
if [ "\$KEY" == 'imgurl' ]; then
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
if [ "http" == "`echo \$VALUE|awk -F: '{print \$1}'`" ]; then
|
||||
#NOTE needs FT retry code to scale
|
||||
#NOTE: should prob have max count
|
||||
FILENAME=`echo \$VALUE|awk -F/ '{print \$NF}'`
|
||||
|
||||
MAXTRIES=5
|
||||
ITER=0
|
||||
while [ ! -r "\$FILENAME" ]; do
|
||||
echo Getting \$VALUE...
|
||||
if ! /usr/bin/wget \$VALUE; then
|
||||
ST=`expr \$RANDOM % 5`
|
||||
sleep \$ST
|
||||
rm -f \$FILENAME
|
||||
ITER=\$(expr \$ITER + 1 )
|
||||
if [ "\$ITER" == "\$MAXTRIES" ]; then
|
||||
/bin/busybox telnetd -l /bin/sh
|
||||
shell
|
||||
KEY=`echo \$i |awk -F= '{print \$1}'`
|
||||
if [ "\$KEY" = 'imgurl' ]; then
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
if [ "http" = "`echo \$VALUE|awk -F: '{print \$1}'`" ]; then
|
||||
#NOTE needs FT retry code to scale
|
||||
#NOTE: should prob have max count
|
||||
FILENAME=`echo \$VALUE|awk -F/ '{print \$NF}'`
|
||||
|
||||
MAXTRIES=5
|
||||
ITER=0
|
||||
while [ ! -r "\$FILENAME" ]; do
|
||||
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "downloading \$VALUE..."
|
||||
echo Getting \$VALUE...
|
||||
if ! /usr/bin/wget \$VALUE; then
|
||||
([ "\$xcatdebugmode" = "1" ] || [ "\$xcatdebugmode" = "2" ]) && logger -t xcat -p debug "downloading \$VALUE failed,retrying..."
|
||||
ST=`expr \$RANDOM % 5`
|
||||
sleep \$ST
|
||||
rm -f \$FILENAME
|
||||
ITER=\$(expr \$ITER + 1 )
|
||||
if [ "\$ITER" = "\$MAXTRIES" ]; then
|
||||
/bin/busybox telnetd -l /bin/sh
|
||||
shell
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ "nfs" = "`echo \$VALUE|awk -F: '{print \$1}'`" ]; then
|
||||
NFS=1
|
||||
SERVER=`echo \$VALUE|awk -F/ '{print \$3}'`
|
||||
ROOTDIR=`echo \$VALUE|awk -F/ '{for(i=4;i<=NF;i++) printf "/%s",\$i}'`
|
||||
fi
|
||||
# for NFS root
|
||||
elif [ "\$KEY" = 'NFSROOT' ]; then
|
||||
NFSROOT=1
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
SERVER=`echo \$VALUE|awk -F: '{print \$1}'`
|
||||
ROOTDIR=`echo \$VALUE|awk -F/ '{for(i=2;i<=NF;i++) printf "/%s",\$i}'`
|
||||
elif [ "\$KEY" = 'STATEMNT' ]; then
|
||||
STATELITE=1
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
# the VALUE may be null
|
||||
if [ ! -z "\$VALUE" ]; then
|
||||
SNAPSHOTSERVER=`echo \$VALUE|awk -F: '{print \$1}'`
|
||||
SNAPSHOTROOT=`echo \$VALUE|awk -F/ '{for(i=2;i<=NF;i++) printf "/%s",\$i}'`
|
||||
# may be that there is not server and just a directory.
|
||||
if [ -z "\$SNAPSHOTROOT" ]; then
|
||||
SNAPSHOTROOT=\$SNAPSHOTSERVER
|
||||
SNAPSHOTSERVER=
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ "nfs" == "`echo \$VALUE|awk -F: '{print \$1}'`" ]; then
|
||||
NFS=1
|
||||
SERVER=`echo \$VALUE|awk -F/ '{print \$3}'`
|
||||
ROOTDIR=`echo \$VALUE|awk -F/ '{for(i=4;i<=NF;i++) printf "/%s",\$i}'`
|
||||
fi
|
||||
# for NFS root
|
||||
elif [ "\$KEY" == 'NFSROOT' ]; then
|
||||
NFSROOT=1
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
SERVER=`echo \$VALUE|awk -F: '{print \$1}'`
|
||||
ROOTDIR=`echo \$VALUE|awk -F/ '{for(i=2;i<=NF;i++) printf "/%s",\$i}'`
|
||||
elif [ "\$KEY" == 'STATEMNT' ]; then
|
||||
STATELITE=1
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
# the VALUE may be null
|
||||
if [ ! -z \$VALUE ]; then
|
||||
SNAPSHOTSERVER=`echo \$VALUE|awk -F: '{print \$1}'`
|
||||
SNAPSHOTROOT=`echo \$VALUE|awk -F/ '{for(i=2;i<=NF;i++) printf "/%s",\$i}'`
|
||||
# may be that there is not server and just a directory.
|
||||
if [ -z \$SNAPSHOTROOT ]
|
||||
then
|
||||
SNAPSHOTROOT=\$SNAPSHOTSERVER
|
||||
SNAPSHOTSERVER=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# show xCAT logo
|
||||
@ -1282,12 +1293,12 @@ if [ "\$STATELITE" = "1" ]; then
|
||||
else
|
||||
# for statelite mode on top of the ramdisk
|
||||
EOMS
|
||||
print $inifile "if [ -r /rootimg-statelite.gz ]; then\n";
|
||||
print $inifile "echo Setting up RAM-root tmpfs.\n";
|
||||
print $inifile " if [ -r /rootimg-statelite.gz ]; then\n";
|
||||
print $inifile " echo Setting up RAM-root tmpfs.\n";
|
||||
if ($rootlimit) {
|
||||
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT \n";
|
||||
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT \n";
|
||||
} else {
|
||||
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
|
||||
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
|
||||
}
|
||||
print $inifile <<EOMS;
|
||||
modprobe nfs
|
||||
@ -1327,7 +1338,7 @@ EOMS
|
||||
mkdir -p \$NEWROOT/\$RWDIR/tmpfs
|
||||
|
||||
# mount the SNAPSHOT directory here for persistent use.
|
||||
if [ ! -z \$SNAPSHOTSERVER ]; then
|
||||
if [ ! -z "\$SNAPSHOTSERVER" ]; then
|
||||
mkdir -p \$NEWROOT/\$RWDIR/persistent
|
||||
MAXTRIES=5
|
||||
ITER=0
|
||||
@ -1395,42 +1406,51 @@ fi
|
||||
# END NFSROOT/Statelite code
|
||||
|
||||
if [ -r /rootimg.sfs ]; then
|
||||
echo Setting up squashfs with ram overlay.
|
||||
mknod /dev/loop0 b 7 0
|
||||
mkdir -p /ro
|
||||
mkdir -p /rw
|
||||
mount -t squashfs /rootimg.sfs /ro
|
||||
mount -t tmpfs rw /rw
|
||||
mount -t aufs -o dirs=/rw:/ro mergedroot \$NEWROOT
|
||||
mkdir -p \$NEWROOT/ro
|
||||
mkdir -p \$NEWROOT/rw
|
||||
mount --move /ro \$NEWROOT/ro
|
||||
mount --move /rw \$NEWROOT/rw
|
||||
echo Setting up squashfs with ram overlay.
|
||||
mknod /dev/loop0 b 7 0
|
||||
mkdir -p /ro
|
||||
mkdir -p /rw
|
||||
mount -t squashfs /rootimg.sfs /ro
|
||||
mount -t tmpfs rw /rw
|
||||
mount -t aufs -o dirs=/rw:/ro mergedroot \$NEWROOT
|
||||
mkdir -p \$NEWROOT/ro
|
||||
mkdir -p \$NEWROOT/rw
|
||||
mount --move /ro \$NEWROOT/ro
|
||||
mount --move /rw \$NEWROOT/rw
|
||||
EOMS
|
||||
print $inifile "elif [ -r /rootimg.gz ]; then\n";
|
||||
print $inifile "echo Setting up RAM-root tmpfs.\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg.gz downloaded,setting up RAM-root tmpfs...\"\n";
|
||||
print $inifile " echo Setting up RAM-root tmpfs.\n";
|
||||
if ($rootlimit) {
|
||||
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT\n";
|
||||
print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT\n";
|
||||
} else {
|
||||
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
|
||||
print $inifile " mount -o mode=755 -t tmpfs rootfs \$NEWROOT\n";
|
||||
}
|
||||
print $inifile " cd \$NEWROOT\n";
|
||||
print $inifile " echo -n \"Extracting root filesystem:\"\n";
|
||||
print $inifile " if [ -x /bin/cpio ]; then\n";
|
||||
print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n";
|
||||
print $inifile " else\n";
|
||||
print $inifile " zcat /rootimg.gz |cpio -idum\n";
|
||||
print $inifile " fi\n";
|
||||
print $inifile " echo Done\n";
|
||||
print $inifile " cd \$NEWROOT\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n";
|
||||
print $inifile " echo -n \"Extracting root filesystem:\"\n";
|
||||
print $inifile " if [ -x /bin/cpio ]; then\n";
|
||||
print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n";
|
||||
print $inifile " else\n";
|
||||
print $inifile " zcat /rootimg.gz |cpio -idum\n";
|
||||
print $inifile " fi\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n";
|
||||
print $inifile " echo Done\n";
|
||||
print $inifile "else\n";
|
||||
print $inifile " echo -n Failed to download image, panicing in 5...\n";
|
||||
print $inifile " for i in 4 3 2 1 0; do\n";
|
||||
print $inifile " /bin/sleep 5\n";
|
||||
print $inifile " echo -n \$i...\n";
|
||||
print $inifile " done\n";
|
||||
print $inifile " echo\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Failed to download image, panicing in 5...\"\n";
|
||||
print $inifile " echo -n Failed to download image, panicing in 5...\n";
|
||||
print $inifile " for i in 4 3 2 1 0; do\n";
|
||||
print $inifile " /bin/sleep 5\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"\$i...\"\n";
|
||||
print $inifile " echo -n \$i...\n";
|
||||
print $inifile " done\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"You're dead. rpower nodename reset to play again.\"\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"* Did you packimage with -m cpio, -m squashfs, or -m nfs?\"\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"* If using -m squashfs did you include aufs.ko with geninitrd? e.g.: -n tg3,squashfs,aufs,loop\"\n";
|
||||
print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"If using -m nfs did you export NFS and sync rootimg? And did you include the aufs and nfs modules in the proper order: e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs\"\n";
|
||||
print $inifile " echo\n";
|
||||
print $inifile <<EOMS;
|
||||
echo "You're dead. rpower nodename reset to play again.
|
||||
echo "You're dead. rpower nodename reset to play again.
|
||||
|
||||
* Did you packimage with -m cpio, -m squashfs, or -m nfs?
|
||||
* If using -m squashfs did you include aufs.ko with geninitrd?
|
||||
@ -1440,13 +1460,15 @@ EOMS
|
||||
e.g.: -n tg3,aufs,loop,sunrpc,lockd,nfs_acl,nfs
|
||||
|
||||
"
|
||||
sleep 5
|
||||
sleep 5
|
||||
EOMS
|
||||
print $inifile " exit\n";
|
||||
print $inifile " exit\n";
|
||||
print $inifile "fi\n";
|
||||
print $inifile "cd /\n";
|
||||
print $inifile "cp /etc/hostname \$NEWROOT/etc/hostname\n";
|
||||
print $inifile "([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"saving \$NEWROOT/etc/resolv.conf\"\n";
|
||||
print $inifile "rm -f \$NEWROOT/etc/resolv.conf; cp /etc/resolv.conf \$NEWROOT/etc/resolv.conf\n";
|
||||
print $inifile "([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"exiting init script...\"\n";
|
||||
print $inifile "mount --move /dev \$NEWROOT/dev \n";
|
||||
print $inifile "mount --move /proc \$NEWROOT/proc \n";
|
||||
print $inifile "mount --move /sys \$NEWROOT/sys \n";
|
||||
|
Reference in New Issue
Block a user