From 212e4ef603c4296a86a0c249918954147af933b9 Mon Sep 17 00:00:00 2001 From: qyin Date: Thu, 22 May 2014 15:57:44 +0800 Subject: [PATCH 01/27] driver patch code submit --- Version | 1 - xCAT-server/lib/xcat/plugins/00kitnodebase.pm | 15 ++++++++++++++- xCAT-server/lib/xcat/plugins/destiny.pm | 18 +++++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) delete mode 100644 Version diff --git a/Version b/Version deleted file mode 100644 index 2701a226a..000000000 --- a/Version +++ /dev/null @@ -1 +0,0 @@ -2.8.4 diff --git a/xCAT-server/lib/xcat/plugins/00kitnodebase.pm b/xCAT-server/lib/xcat/plugins/00kitnodebase.pm index ea985c236..b118c4720 100644 --- a/xCAT-server/lib/xcat/plugins/00kitnodebase.pm +++ b/xCAT-server/lib/xcat/plugins/00kitnodebase.pm @@ -92,6 +92,7 @@ sub process_request { my @commandslist; my %argslist; + my $noupdate_flag = 0; my %msghash = ( "makehosts" => "Updating hosts entries", "makedns" => "Updating DNS entries", "makedhcp" => "Update DHCP entries", @@ -143,6 +144,10 @@ sub process_request { if($macflag) { if ($chainarray[0]){ + if($chainarray[0] =~ m/^osimage=/) + { + $noupdate_flag = 1; + } push @commandslist, ['nodeset', $chainarray[0]]; } } @@ -161,6 +166,7 @@ sub process_request { my $firstnode = (@$nodelist)[0]; if (exists $profilehash{$firstnode}{"ImageProfile"}){ my $osimage = 'osimage='.$profilehash{$firstnode}{"ImageProfile"}; + $noupdate_flag = 1; push @commandslist, ['nodeset', $osimage]; } } @@ -170,7 +176,14 @@ sub process_request { my $current_cmd = $_->[0]; my $current_args = $_->[1]; setrsp_progress($msghash{$current_cmd}); - my $retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, 0, 2); + if(($current_cmd eq "nodeset") && $noupdate_flag) + { + $retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args, "--noupdateinitrd"]}, $request_command, 0, 2); + } + else + { + $retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, 0, 2); + } log_cmd_return($retref); } diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 983598deb..fed153414 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -571,6 +571,7 @@ sub nextdestiny { } my $node; + my $noupdate_flag = 0; $chaintab = xCAT::Table->new('chain'); my $chainents = $chaintab->getNodesAttribs(\@nodes,[qw(currstate currchain chain)]); foreach $node (@nodes) { @@ -598,13 +599,28 @@ sub nextdestiny { my %requ; $requ{node}=[$node]; $requ{arg}=[$ref->{currstate}]; + if($ref->{currstate} =~ /noupdateinitrd$/) + { + my @items = split /[:]/,$ref->{currstate}; + $requ{arg}= \@items; + $noupdate_flag = 1; + } setdestiny(\%requ, $flag+1); } if ($callnodeset) { + $args; + if($noupdate_flag) + { + $args = ['enact', '--noupdateinitrd']; + } + else + { + $args = ['enact']; + } $subreq->({command=>['nodeset'], node=> \@nodes, - arg=>['enact']}); + arg=>$args}); } } From 9394d1bb667864673043421a3fea1b6010fe0ed6 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 22 May 2014 23:52:26 -0700 Subject: [PATCH 02/27] Add the Version file --- Version | 1 + 1 file changed, 1 insertion(+) create mode 100644 Version diff --git a/Version b/Version new file mode 100644 index 000000000..2701a226a --- /dev/null +++ b/Version @@ -0,0 +1 @@ +2.8.4 From f2f22c029d9a83c82db10112810ab4df3f776201 Mon Sep 17 00:00:00 2001 From: litingt Date: Fri, 23 May 2014 01:16:49 -0700 Subject: [PATCH 03/27] xCAT 2.8.5 version file --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index 2701a226a..766d70806 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.8.4 +2.8.5 From 5fa4bdb407165b63b37d13d057015d2a1afb9b43 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 8 May 2014 10:11:37 -0400 Subject: [PATCH 04/27] code change for rh7 stateless support --- xCAT-server/share/xcat/netboot/rh/genimage | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 37eadfd8f..0acc19ed4 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -583,8 +583,8 @@ if ( (-d "$rootimg_dir/usr/share/dracut") or (-d "$rootimg_dir/usr/lib/dracut") my $dracutver = `rpm --root $rootimg_dir -qi dracut | grep Version | awk -F' ' '{print \$3}'`; chomp($dracutver); if ($dracutver =~ /^\d\d\d$/) { - if (($dracutver >= "009") and ($dracutver < "033")) { - $dracutdir = "dracut_009"; + if ($dracutver >= "033") { + $dracutdir = "dracut_033"; } else { $dracutdir = "dracut"; # The default directory } @@ -924,7 +924,11 @@ sub mkinitrd_dracut { $additional_options= qq{--include /tmp/cmdline /etc/cmdline}; } - system("chroot $rootimg_dir dracut $additional_options -f /tmp/initrd.$$.gz $kernelver"); + # force the dracut run in non-hostonly mode for dracut higher than version 033 + if ($dracutver > "033") { + $additional_options .= " -N"; + } + system("chroot $rootimg_dir dracut -N $additional_options -f /tmp/initrd.$$.gz $kernelver"); print "the initial ramdisk for $mode is generated successfully.\n"; move("$rootimg_dir/tmp/initrd.$$.gz", "$destdir/initrd-$mode.gz"); } @@ -1665,7 +1669,11 @@ sub using_systemd { my $os = shift; if ($os =~ /fedora(\d+)/) { if ($1 >= 15) { - return 1; + return 1; + } + }elsif ($os =~ /rhels(\d+)/) { + if ($1 >= 7) { + return 1; } } From 137e201aba105e6b1cee580b045122f3446298ce Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 8 May 2014 10:14:04 -0400 Subject: [PATCH 05/27] add dracut support scripts for dracut-033. Most of them are copied from dracut --- .../share/xcat/netboot/rh/dracut_033/check | 3 + .../netboot/rh/dracut_033/install.netboot | 9 + .../netboot/rh/dracut_033/install.statelite | 8 + .../xcat/netboot/rh/dracut_033/installkernel | 2 + .../netboot/rh/dracut_033/xcat-cmdline.sh | 4 + .../netboot/rh/dracut_033/xcat-premount.sh | 18 ++ .../netboot/rh/dracut_033/xcat-prepivot.sh | 126 +++++++++ .../netboot/rh/dracut_033/xcat-updateflag | 24 ++ .../share/xcat/netboot/rh/dracut_033/xcatroot | 259 ++++++++++++++++++ 9 files changed, 453 insertions(+) create mode 100755 xCAT-server/share/xcat/netboot/rh/dracut_033/check create mode 100755 xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot create mode 100755 xCAT-server/share/xcat/netboot/rh/dracut_033/install.statelite create mode 100755 xCAT-server/share/xcat/netboot/rh/dracut_033/installkernel create mode 100644 xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-cmdline.sh create mode 100644 xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh create mode 100755 xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh create mode 100755 xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-updateflag create mode 100755 xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/check b/xCAT-server/share/xcat/netboot/rh/dracut_033/check new file mode 100755 index 000000000..d7cc89ce0 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/check @@ -0,0 +1,3 @@ +#!/bin/sh +[ "$1" = "-d" ] && echo network +exit 0 diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot new file mode 100755 index 000000000..b52b6690f --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot @@ -0,0 +1,9 @@ +#!/bin/sh +echo $drivers +dracut_install wget cpio gzip modprobe touch echo cut wc +dracut_install grep ifconfig hostname awk egrep grep dirname expr +dracut_install mount.nfs +dracut_install parted mke2fs bc mkswap swapon chmod +inst "$moddir/xcat-updateflag" "/tmp/updateflag" +inst "$moddir/xcatroot" "/sbin/xcatroot" +inst_hook cmdline 10 "$moddir/xcat-cmdline.sh" diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/install.statelite b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.statelite new file mode 100755 index 000000000..7c7646652 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.statelite @@ -0,0 +1,8 @@ +#!/bin/sh +echo $drivers +dracut_install wget cpio gzip modprobe wc touch echo cut +dracut_install grep ifconfig hostname awk egrep grep dirname expr +dracut_install parted mke2fs bc mkswap swapon chmod +inst "$moddir/xcat-updateflag" "/tmp/updateflag" +inst_hook pre-mount 5 "$moddir/xcat-premount.sh" +inst_hook pre-pivot 5 "$moddir/xcat-prepivot.sh" diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/installkernel b/xCAT-server/share/xcat/netboot/rh/dracut_033/installkernel new file mode 100755 index 000000000..7902ce5f7 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/installkernel @@ -0,0 +1,2 @@ +#!/bin/bash +instmods nfs sunrpc diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-cmdline.sh b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-cmdline.sh new file mode 100644 index 000000000..80d088557 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-cmdline.sh @@ -0,0 +1,4 @@ +root=1 +rootok=1 +netroot=xcat +echo '[ -e $NEWROOT/proc ]' > $hookdir/initqueue/finished/xcatroot.sh diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh new file mode 100644 index 000000000..40c1dbbe5 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh @@ -0,0 +1,18 @@ +#!/bin/sh +#script to update nodelist.nodestatus during provision + +MASTER=`echo $XCAT |awk -F: '{print $1}'` + +getarg nonodestatus +NODESTATUS=$? + +XCATIPORT="$(getarg XCATIPORT=)" +if [ $? -ne 0 ]; then +XCATIPORT="3002" +fi + + + +if [ $NODESTATUS -ne 0 ];then +/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting" +fi diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh new file mode 100755 index 000000000..d6eac21f9 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh @@ -0,0 +1,126 @@ +#!/bin/sh +NEWROOT=/sysroot +SERVER=${SERVER%%/*} +SERVER=${SERVER%:} +RWDIR=.statelite +if [ ! -z $STATEMNT ]; then #btw, uri style might have left future options other than nfs open, will u se // to detect uri in the future I guess + SNAPSHOTSERVER=${STATEMNT%:*} + SNAPSHOTROOT=${STATEMNT#*/} + #echo $SNAPSHOTROOT + #echo $SNAPSHOTSERVER + # may be that there is not server and just a directory. + if [ -z $SNAPSHOTROOT ]; then + SNAPSHOTROOT=$SNAPSHOTSERVER + SNAPSHOTSERVER= + fi +fi + +echo Setting up Statelite +mkdir -p $NEWROOT + +# now we need to mount the rest of the system. This is the read/write portions +# echo Mounting snapshot directories + +MAXTRIES=7 +ITER=0 +if [ ! -e "$NEWROOT/$RWDIR" ]; then + echo "" + echo "This NFS root directory doesn't have a /$RWDIR directory for me to mount a rw filesystem. You'd better create it... " + echo "" + /bin/sh +fi + +if [ ! -e "$NEWROOT/etc/init.d/statelite" ]; then + echo "" + echo "$NEWROOT/etc/init.d/statelite doesn't exist. Perhaps you didn't create this image with th e -m statelite mode" + echo "" + /bin/sh +fi + +mount -t tmpfs rw $NEWROOT/$RWDIR +mkdir -p $NEWROOT/$RWDIR/tmpfs +ME=`hostname` +if [ ! -z $NODE ]; then + ME=$NODE +fi + +# mount the SNAPSHOT directory here for persistent use. +if [ ! -z $SNAPSHOTSERVER ]; then + mkdir -p $NEWROOT/$RWDIR/persistent + MAXTRIES=5 + ITER=0 + if [ -z $MNTOPTS ]; then + MNT_OPTIONS="nolock,rsize=32768,tcp,nfsvers=3,timeo=14" + else + MNT_OPTIONS=$MNTOPTS + fi + while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "Your are dead, rpower $ME boot to play again." + echo "Possible problems: +1. $SNAPSHOTSERVER is not exporting $SNAPSHOTROOT ? +2. Is DNS set up? Maybe that's why I can't mount $SNAPSHOTSERVER." + /bin/sh + exit + fi + RS= $(( $RANDOM % 20 )) + echo "Trying again in $RS seconds..." + sleep $RS + done + + # create directory which is named after my node name + mkdir -p $NEWROOT/$RWDIR/persistent/$ME + ITER=0 + # umount current persistent mount + while ! umount -l $NEWROOT/$RWDIR/persistent; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "Your are dead, rpower $ME boot to play again." + echo "Cannot umount $NEWROOT/$RWDIR/persistent." + /bin/sh + exit + fi + RS= $(( $RANDOM % 20 )) + echo "Trying again in $RS seconds..." + sleep $RS + done + + # mount persistent to server:/rootpath/nodename + ITER=0 + while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "Your are dead, rpower $ME boot to play again." + echo "Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME." + /bin/sh + exit + fi + RS= $(( $RANDOM % 20 )) + echo "Trying again in $RS seconds..." + sleep $RS + done +fi + +# TODO: handle the dhclient/resolv.conf/ntp, etc +echo "Get to enable localdisk" +$NEWROOT/etc/init.d/localdisk +$NEWROOT/etc/init.d/statelite +READONLY=yes +export READONLY +fastboot=yes +export fastboot +keep_old_ip=yes +export keep_old_ip +mount -n --bind /dev $NEWROOT/dev +mount -n --bind /proc $NEWROOT/proc +mount -n --bind /sys $NEWROOT/sys + +if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then + echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux" +fi + +# inject new exit_if_exists +echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/xcat.sh +# force udevsettle to break +> $hookdir/initqueue/work diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-updateflag b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-updateflag new file mode 100755 index 000000000..2f9ac3165 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-updateflag @@ -0,0 +1,24 @@ +#!/bin/awk -f +#script to feedback the node provision status to xcatd +BEGIN { + + xcatdhost = ARGV[1] + xcatiport = ARGV[2] + + + ns = "/inet/tcp/0/" xcatdhost "/" xcatiport + print "xCAT_xcatd" |& ns + + while(1) { + ns |& getline + + if($0 == "ready") + print ARGV[3] |& ns + if($0 == "done") + break + } + + close(ns) + + exit 0 +} diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot new file mode 100755 index 000000000..4cde3f1ca --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -0,0 +1,259 @@ +#!/bin/sh +NEWROOT=$3 +RWDIR=.statelite +XCATMASTER=$XCAT + +. /lib/dracut-lib.sh +rootlimit="$(getarg rootlimit=)" + + +getarg nonodestatus +NODESTATUS=$? + +MASTER=`echo $XCATMASTER |awk -F: '{print $1}'` +XCATIPORT="$(getarg XCATIPORT=)" +if [ $? -ne 0 ]; then +XCATIPORT="3002" +fi + + +if [ $NODESTATUS -ne 0 ];then +/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting" +fi + +if [ ! -z "$imgurl" ]; then + if [ xhttp = x${imgurl%%:*} ]; then + NFS=0 + FILENAME=${imgurl##*/} + while [ ! -r "$FILENAME" ]; do + echo Getting $imgurl... + if ! wget $imgurl; then + rm -f $FILENAME + sleep 27 + fi + done + elif [ xnfs = x${imgurl%%:*} ]; then + NFS=1 + SERVER=${imgurl#nfs:} + SERVER=${SERVER#/} + SERVER=${SERVER#/} + ROOTDIR=$SERVER + SERVER=${SERVER%%/*} + SERVER=${SERVER%:} + ROOTDIR=/${ROOTDIR#*/} + fi +fi +#echo 0 > /proc/sys/vm/zone_reclaim_mode #Avoid kernel bug + +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 +elif [ -r /rootimg.gz ]; then + echo Setting up RAM-root tmpfs. + if [ -z $rootlimit ];then + mount -t tmpfs -o mode=755 rootfs $NEWROOT + else + mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT + fi + + cd $NEWROOT + echo -n "Extracting root filesystem:" + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.gz |/bin/cpio -idum + else + gzip -cd /rootimg.gz |cpio -idum + fi + $NEWROOT/etc/init.d/localdisk + echo Done +elif [ -r /rootimg-statelite.gz ]; then + echo Setting up RAM-root tmpfs for statelite mode. + + if [ -z $rootlimit];then + mount -t tmpfs -o mode=755 rootfs $NEWROOT + else + mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT + fi + + cd $NEWROOT + echo -n "Extracting root filesystem:" + if [ -x /bin/cpio ]; then + gzip -cd /rootimg-statelite.gz |/bin/cpio -idum + else + gzip -cd /rootimg-statelite.gz |cpio -idum + fi + echo Done + # then, the statelite staffs will be processed + echo Setting up Statelite + modprobe nfs + MAXTRIES=7 + ITER=0 + if [ ! -e "$NEWROOT/$RWDIR" ]; then + echo "" + echo "The /$RWDIR directory doesn't exist in the rootimg... " + echo "" + /bin/sh + fi + + if [ ! -e "$NEWROOT/etc/init.d/statelite" ]; then + echo "" + echo "$NEWROOT/etc/init.d/statelite doesn't exist... " + echo "" + /bin/sh + fi + + mount -t tmpfs rw $NEWROOT/$RWDIR + mkdir -p $NEWROOT/$RWDIR/tmpfs + ME=`hostname` + if [ ! -z $NODE ]; then + ME=$NODE + fi + + + # mount the SNAPSHOT directory here for persistent use. + if [ ! -z $STATEMNT ]; then + SNAPSHOTSERVER=${STATEMNT%:*} + SNAPSHOTROOT=${STATEMNT#*/} + if [ -z $SNAPSHOTROOT ]; then + SNAPSHOTROOT=$SNAPSHOTSERVER + SNAPSHOTSERVER= + fi + fi + + if [ ! -z $SNAPSHOTSERVER ]; then + mkdir -p $NEWROOT/$RWDIR/persistent + MAXTRIES=5 + ITER=0 + if [ -z $MNTOPTS ]; then + MNT_OPTIONS="nolock,rsize=32768,tcp,nfsvers=3,timeo=14" + else + MNT_OPTIONS=$MNTOPTS + fi + while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "You are dead, rpower $ME boot to play again." + echo "Possible problems: +1. $SNAPSHOTSERVER is not exporting $SNAPSHOTROOT ? +2. Is DNS set up? Maybe that's why I can't mount $SNAPSHOTSERVER." + /bin/sh + exit + fi + RS=$(( $RANDOM % 20 )) + echo "Trying again in $RS seconds ..." + sleep $RS + done + + # create directory which is named after my node name + mkdir -p $NEWROOT/$RWDIR/persistent/$ME + ITER=0 + # umount current persistent mount + while ! umount -l $NEWROOT/$RWDIR/persistent; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "Your are dead, rpower $ME boot to play again." + echo "Cannot umount $NEWROOT/$RWDIR/persistent." + /bin/sh + exit + fi + RS= $(( $RANDOM % 20 )) + echo "Trying again in $RS seconds..." + sleep $RS + done + + # mount persistent to server:/rootpath/nodename + ITER=0 + while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do + ITER=$(( ITER + 1 )) + if [ "$ITER" == "$MAXTRIES" ]; then + echo "Your are dead, rpower $ME boot to play again." + echo "Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME." + /bin/sh + exit + fi + RS= $(( $RANDOM % 20 )) + echo "Trying again in $RS seconds..." + sleep $RS + done + fi + + $NEWROOT/etc/init.d/localdisk + $NEWROOT/etc/init.d/statelite + fastboot=yes + export fastboot + keep_old_ip=yes + export keep_old_ip + + mount -n --bind /dev $NEWROOT/dev + mount -n --bind /proc $NEWROOT/proc + mount -n --bind /sys $NEWROOT/sys + +else + echo -n Failed to download image, panicing in 5... + for i in 4 3 2 1 0; do + /bin/sleep 1 + echo -n $i... + done + echo + 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? + e.g.: -n tg3,squashfs,aufs,loop +* 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 + +" + /bin/dash + exit +fi +cd / + +if [ -z $STATEMNT ]; then + for lf in /tmp/dhclient.*.lease; do + netif=${lf#*.} + netif=${netif%.*} + cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" + done + + if [ ! -z "$ifname" ]; then + MACX=${ifname#*:} + ETHX=${ifname%:$MACX*} + elif [ ! -z "$netdev" ]; then + ETHX=$netdev + MACX=`ip link show $netdev | grep ether | awk '{print $2}'` + elif [ ! -z "$BOOTIF" ]; then + MACX=$BOOTIF + ETHX=`ifconfig |grep -i $BOOTIF | awk '{print $1}'` + fi + + if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then + if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then + touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + fi + echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + fi +fi + +cp /etc/resolv.conf "$NEWROOT/etc/" + +if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then + echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux" +fi + +# inject new exit_if_exists +echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/xcat.sh +# force udevsettle to break +> $hookdir/initqueue/work From 6a50b11ffca5790972e177d16f693e3e0e7b935d Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 14 May 2014 08:03:35 -0400 Subject: [PATCH 06/27] use ip command to replace ifconfig in xcatroot for diskless on rh3 --- .../share/xcat/netboot/rh/dracut_033/xcatroot | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 4cde3f1ca..feed0dcd3 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -218,6 +218,25 @@ else fi cd / +function getdevfrommac() { + boothwaddr=$1 + ip link show | while read line + do + dev=`echo $line | egrep "^[0-9]+: [0-9A-Za-z]+" | cut -d ' ' -f 2 | cut -d ':' -f 1` + if [ "X$dev" != "X" ]; then + devname=$dev + fi + + if [ "X$devname" != "X" ]; then + hwaddr=`echo $line | egrep "^[ ]*link" | awk '{print $2}'` + if [ "X$hwaddr" = "X$boothwaddr" ]; then + echo $devname + fi + fi + done +} + + if [ -z $STATEMNT ]; then for lf in /tmp/dhclient.*.lease; do netif=${lf#*.} @@ -233,7 +252,7 @@ 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=$(getdevfrommac $BOOTIF) fi if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then From 2000a8c562f6bfc048d377532a82c523ac900a3c Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 15 May 2014 03:54:58 -0400 Subject: [PATCH 07/27] for rh7, the initrd for stateless has to been built first to make the installkernel cfg file added first --- xCAT-server/share/xcat/netboot/rh/genimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 0acc19ed4..7fc298298 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -779,8 +779,8 @@ system("chroot $rootimg_dir depmod $kernelver"); # the other one is for statelite if ($dracutmode) { - mkinitrd_dracut("statelite"); mkinitrd_dracut("stateless"); + mkinitrd_dracut("statelite"); } else { mkinitrd("statelite"); mkinitrd("stateless"); From 641b6c7aa9b0da04a267fdfa7d32e54129ca3293 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 15 May 2014 06:56:19 -0400 Subject: [PATCH 08/27] rh7 diskless support that don't cfg tmp in fstab --- .../share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall | 2 -- 1 file changed, 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall index ad071c87c..246dbdd63 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall @@ -26,8 +26,6 @@ proc /proc proc rw 0 0 sysfs /sys sysfs rw 0 0 devpts /dev/pts devpts rw,gid=5,mode=620 0 0 ${profile}_${arch} / tmpfs rw 0 1 -none /tmp tmpfs defaults,size=10m 0 2 -none /var/tmp tmpfs defaults,size=10m 0 2 END From b8cacc08b59dbd0923a6ce614bdfdd50d7826f27 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 19 May 2014 10:17:51 -0400 Subject: [PATCH 09/27] rh7 statelite support. create /etc/sysconfig/network-scripts/ifcfg-ethx for statelite node --- .../netboot/rh/dracut_033/xcat-prepivot.sh | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh index d6eac21f9..d0e4c97ba 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh @@ -116,6 +116,54 @@ mount -n --bind /dev $NEWROOT/dev mount -n --bind /proc $NEWROOT/proc mount -n --bind /sys $NEWROOT/sys +function getdevfrommac() { + boothwaddr=$1 + ip link show | while read line + do + dev=`echo $line | egrep "^[0-9]+: [0-9A-Za-z]+" | cut -d ' ' -f 2 | cut -d ':' -f 1` + if [ "X$dev" != "X" ]; then + devname=$dev + fi + + if [ "X$devname" != "X" ]; then + hwaddr=`echo $line | egrep "^[ ]*link" | awk '{print $2}'` + if [ "X$hwaddr" = "X$boothwaddr" ]; then + echo $devname + fi + fi + done +} + + +for lf in /tmp/dhclient.*.lease; do + netif=${lf#*.} + netif=${netif%.*} + cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" +done + +if [ ! -z "$ifname" ]; then + MACX=${ifname#*:} + ETHX=${ifname%:$MACX*} +elif [ ! -z "$netdev" ]; then + ETHX=$netdev + MACX=`ip link show $netdev | grep ether | awk '{print $2}'` +elif [ ! -z "$BOOTIF" ]; then + MACX=$BOOTIF + ETHX=$(getdevfrommac $BOOTIF) +fi + +if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then + if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then + touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + fi + echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX + echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX +fi + +cp /etc/resolv.conf "$NEWROOT/etc/" + if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux" fi From 990b282fc7615f51e58b2fe38789dffd04190560 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 19 May 2014 10:20:00 -0400 Subject: [PATCH 10/27] rh7 statelite support. remove the root dir from fstab to avoiding the remount which overwrite the root dir to rw --- .../share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall index 246dbdd63..dc423d20d 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall @@ -25,7 +25,6 @@ cat <$installroot/etc/fstab proc /proc proc rw 0 0 sysfs /sys sysfs rw 0 0 devpts /dev/pts devpts rw,gid=5,mode=620 0 0 -${profile}_${arch} / tmpfs rw 0 1 END From 50322fae7d7911f810f5a1271013e93ceae59c76 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 19 May 2014 10:22:48 -0400 Subject: [PATCH 11/27] rh stateless support. remove the tmp and root dir mount requirement in fstab. They can be handled correctly by dracut and dracut cfg file --- .../share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall | 3 --- 1 file changed, 3 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall index f157e7421..01bc23cb4 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall @@ -25,9 +25,6 @@ cat <$installroot/etc/fstab proc /proc proc rw 0 0 sysfs /sys sysfs rw 0 0 devpts /dev/pts devpts rw,gid=5,mode=620 0 0 -${profile}_${arch} / tmpfs rw 0 1 -none /tmp tmpfs defaults,size=10m 0 2 -none /var/tmp tmpfs defaults,size=10m 0 2 END #-- Uncomment the line contains "cons" in /etc/inittab From c6165321945b46be6a6917b1ec56df7c78ab174f Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 20 May 2014 07:59:01 -0400 Subject: [PATCH 12/27] defect 4133: transfer the xml specific character which starts with & to general format --- xCAT-server/share/xcat/install/scripts/post.debian | 4 ++-- xCAT-server/share/xcat/install/scripts/post.ubuntu | 4 ++-- xCAT-server/share/xcat/install/scripts/post.xcat | 4 ++-- xCAT/postscripts/xcatdsklspost | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.debian b/xCAT-server/share/xcat/install/scripts/post.debian index 08dea2719..9e9038d31 100644 --- a/xCAT-server/share/xcat/install/scripts/post.debian +++ b/xCAT-server/share/xcat/install/scripts/post.debian @@ -59,7 +59,7 @@ do mv $i/postscripts /xcatpost rm -rf $i chmod +x /xcatpost/* - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -72,7 +72,7 @@ do let SLI=$RANDOM%10+10 sleep $SLI - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index eb64b7e4b..34f1f4a5f 100644 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -61,7 +61,7 @@ do mv $i/postscripts /xcatpost rm -rf $i chmod +x /xcatpost/* - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -74,7 +74,7 @@ do let SLI=$RANDOM%10+10 sleep $SLI - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 61dbd8379..054d74daa 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -44,7 +44,7 @@ do if [ ! -x /xcatpost/mypostscript ]; then chmod +x /xcatpost/* - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` @@ -59,7 +59,7 @@ do let SLI=$RANDOM%10+10 sleep $SLI - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 4bed671bf..38b33b28c 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -508,7 +508,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then useflowcontrol=0 fi fi - /$xcatpost/getpostscript.awk | egrep '' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /$xcatpost/mypostscript; + /$xcatpost/getpostscript.awk | egrep '' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /$xcatpost/mypostscript; MYCONT=`grep MASTER /$xcatpost/mypostscript` @@ -539,7 +539,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then useflowcontrol=0 fi fi - /$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /$xcatpost/mypostscript; + /$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /$xcatpost/mypostscript; MYCONT=`grep MASTER /$xcatpost/mypostscript` if [ ! -z "$MYCONT" ]; then break; From 2bd823ec590f88f46f704200c221764c67bfaa92 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 20 May 2014 10:14:22 -0400 Subject: [PATCH 13/27] defect 4134: missing the use of xCAT::SvrUtils in conserver.pm so that when makeconservercf walks into error path to call SverUtils->sendmsg, an code error is displayed --- xCAT-server/lib/xcat/plugins/conserver.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/xcat/plugins/conserver.pm b/xCAT-server/lib/xcat/plugins/conserver.pm index da4aeb285..adb2a0d60 100644 --- a/xCAT-server/lib/xcat/plugins/conserver.pm +++ b/xCAT-server/lib/xcat/plugins/conserver.pm @@ -7,6 +7,7 @@ use xCAT::Utils; use xCAT::TableUtils; use Getopt::Long; use Sys::Hostname; +use xCAT::SvrUtils; use strict; use Data::Dumper; From c3129c1701257b7ee99c0915c3c28a4a6cabcc56 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 21 May 2014 04:37:35 -0400 Subject: [PATCH 14/27] defect 4125:support to have parameters in niccustomscripts attribute --- xCAT/postscripts/confignics | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index bcfbe3cbd..5e2803f5b 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -19,16 +19,19 @@ function splitconfig(){ IFS=$',' array_conf_temp=($1) IFS=$old_ifs - for i in ${array_conf_temp[@]} + + i=0 + while [ $i -lt ${#array_conf_temp[@]} ] do + token="${array_conf_temp[$i]}" D= - if [ `echo $i | grep "!"` ];then + if echo "$token" | grep "!"; then D="!" else D=":" fi - key=`echo $i | cut -d"$D" -f 1` - str_temp_value=`echo $i | cut -d"$D" -f 2` + key=`echo "$token" | cut -d"$D" -f 1` + str_temp_value=`echo "$token" | cut -d"$D" -f 2` str_temp=$(hashget hash_defined_nics $key) if [ -n "$str_temp" ];then @@ -37,7 +40,8 @@ function splitconfig(){ str_temp="$str_temp_value" str_all_nics=$str_all_nics"$key " fi - hashset hash_defined_nics $key $str_temp + hashset hash_defined_nics $key "$str_temp" + i=$((i+1)) done } @@ -198,8 +202,8 @@ if [ -z "$NICIPS" ];then exit 0 fi -splitconfig $NICIPS -splitconfig $NICCUSTOMSCRIPTS +splitconfig "$NICIPS" +splitconfig "$NICCUSTOMSCRIPTS" if [ $boot_myscript -eq 1 ];then . $str_dir_name/$myscript From f56d9b0c1223d1239a99d05854491dcbce84411b Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 23 May 2014 03:03:30 -0400 Subject: [PATCH 15/27] defect: 4133: fix the code to transfer escape character for the output of getpostscript.awk --- xCAT/postscripts/xcatdsklspost | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 38b33b28c..c9ac442bc 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -508,7 +508,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then useflowcontrol=0 fi fi - /$xcatpost/getpostscript.awk | egrep '' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /$xcatpost/mypostscript; + /$xcatpost/getpostscript.awk | egrep '' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript; MYCONT=`grep MASTER /$xcatpost/mypostscript` @@ -539,7 +539,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then useflowcontrol=0 fi fi - /$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /$xcatpost/mypostscript; + /$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript; MYCONT=`grep MASTER /$xcatpost/mypostscript` if [ ! -z "$MYCONT" ]; then break; From 70e64d8b68b1749c6882fd05f5244082848d69f2 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 26 May 2014 01:18:28 -0400 Subject: [PATCH 16/27] defect 4133: continue the fix for the xml escape char conversion when getting mypostscript --- xCAT-server/share/xcat/install/scripts/post.debian | 4 ++-- xCAT-server/share/xcat/install/scripts/post.ubuntu | 4 ++-- xCAT-server/share/xcat/install/scripts/post.xcat | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.debian b/xCAT-server/share/xcat/install/scripts/post.debian index 9e9038d31..5d54bc7d6 100644 --- a/xCAT-server/share/xcat/install/scripts/post.debian +++ b/xCAT-server/share/xcat/install/scripts/post.debian @@ -59,7 +59,7 @@ do mv $i/postscripts /xcatpost rm -rf $i chmod +x /xcatpost/* - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -72,7 +72,7 @@ do let SLI=$RANDOM%10+10 sleep $SLI - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index 34f1f4a5f..618ae1aad 100644 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -61,7 +61,7 @@ do mv $i/postscripts /xcatpost rm -rf $i chmod +x /xcatpost/* - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` MAX_RETRIES=10 RETRY=0 @@ -74,7 +74,7 @@ do let SLI=$RANDOM%10+10 sleep $SLI - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 054d74daa..10d406998 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -44,7 +44,7 @@ do if [ ! -x /xcatpost/mypostscript ]; then chmod +x /xcatpost/* - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` @@ -59,7 +59,7 @@ do let SLI=$RANDOM%10+10 sleep $SLI - /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` done From 43998b11e2b1c06dc29179276f5df66aafbcaae8 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 23 May 2014 02:56:39 -0700 Subject: [PATCH 17/27] correct the getNodeNetworkCfg to get the network gateway --- perl-xCAT/xCAT/NetworkUtils.pm | 96 +++++++++++++++++----------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 1bd6397e0..4926e0be5 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -1992,50 +1992,6 @@ sub isIpaddr } -#------------------------------------------------------------------------------- -=head3 getSubnetGateway - Description: - Get gateway from the networks table of the specified net. - - Arguments: - net: the net, ie. the "net" field of the networks table - Returns: - Return a string, of the gateway - undef - Failed to get the gateway - Globals: - none - Error: - none - Example: - my $gateway = xCAT::NetworkUtils::getSubnetGateway('192.168.1.0'); - Comments: - none - -=cut -#------------------------------------------------------------------------------- -sub getSubnetGateway -{ - my $netname=shift; - if( $netname =~ /xCAT::NetworkUtils/) - { - $netname=shift; - } - - my $gateway=undef; - my $nettab = xCAT::Table->new("networks"); - unless($nettab) { die "No entry defined in networks"; } - my @nets = $nettab->getAllAttribs('net','gateway'); - foreach(@nets) - { - if("$_->{net}" eq "$netname") - { - $gateway = $_->{gateway}; - last; - } - } - - return $gateway; -} #------------------------------------------------------------------------------- @@ -2093,6 +2049,50 @@ sub getNodeNameservers{ return \%nodenameservers; } +#------------------------------------------------------------------------------- +=head3 getNodeGateway + Description: + Get gateway from the networks table of the node. + + Arguments: + ip: the ip address of the node + Returns: + Return a string, of the gateway + undef - Failed to get the gateway + Globals: + none + Error: + none + Example: + my $gateway = xCAT::NetworkUtils::getNodeGateway('192.168.1.0'); + Comments: + none + +=cut +#------------------------------------------------------------------------------- +sub getNodeGateway +{ + my $ip=shift; + if( $ip =~ /xCAT::NetworkUtils/) + { + $ip=shift; + } + my $gateway=undef; + + my $nettab = xCAT::Table->new("networks"); + if ($nettab) { + my @nets = $nettab->getAllAttribs('net','mask','gateway'); + foreach my $net (@nets) { + if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { + $gateway=$net->{'gateway'}; + } + } + } + + + return $gateway; +} + #------------------------------------------------------------------------------- =head3 getNodeNetworkCfg @@ -2122,8 +2122,8 @@ sub getNodeNetworkCfg if( $node =~ /xCAT::NetworkUtils/) { $node =shift; - } - + } + my $nets = xCAT::NetworkUtils::my_nets(); my $ip = xCAT::NetworkUtils->getipaddr($node); my $mask = undef; @@ -2132,12 +2132,14 @@ sub getNodeNetworkCfg { my $netname; ($netname,$mask) = split /\//, $net; - $gateway=xCAT::NetworkUtils::getSubnetGateway($netname); last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1)); } + $gateway=xCAT::NetworkUtils::getNodeGateway($ip); return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0)); } + + #------------------------------------------------------------------------------- =head3 get_hdwr_ip From 0b999b2888d81853a40674d8a4d2b150ae82ab7c Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 26 May 2014 21:13:54 -0700 Subject: [PATCH 18/27] add grub2-xcat as the dependency of xCAT-server --- xCAT-server/xCAT-server.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index 2b6ee0988..3c8a18b62 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -34,7 +34,7 @@ Obsoletes: atftp-xcat %ifos linux %ifnarch s390x # PCM does not use or ship grub2-xcat -#Requires: grub2-xcat +Requires: grub2-xcat %endif %endif %endif From 1039462c4476a5734baa2a3c699386c0f481850d Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 27 May 2014 07:46:47 -0400 Subject: [PATCH 19/27] xcatws.cgi: fix the output when slpnodes resource has no output; fix the output message for nodestat resource --- xCAT-server/xCAT-wsapi/xcatws.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index c63a2b164..bc29399a4 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -124,7 +124,7 @@ my %URIdef = ( GET => { desc => "Get the running status for the node {noderange}.", usage => "||$usagemsg{objreturn}|", - example => "|Get the running status for node node1|GET|/nodes/node1/nodestat|x|", + example => "|Get the running status for node node1|GET|/nodes/node1/nodestat|{\n \"node1\":{\n \"nodestat\":\"noping\"\n }\n}|", cmd => "nodestat", fhandler => \&actionhdl, outhdler => \&actionout, @@ -1401,6 +1401,9 @@ sub defout { $lines = \@alldata; } foreach my $l (@$lines) { + if ($l =~ /No responses/) { # handle the case that no output from lsslp command + return; + } if ($l =~ /^Object name: / || $l =~ /^\S+:$/) { # start new node if ($l =~ /^Object name:\s+(\S+)/) { # handle the output of lsdef -t $nodename = $1; From ceb63707714848fba5238f809340e4ea34342dd9 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 27 May 2014 08:33:55 -0400 Subject: [PATCH 20/27] fix a minor typo in destiny.pm --- xCAT-server/lib/xcat/plugins/destiny.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index fed153414..a0b5ecd6f 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -609,8 +609,8 @@ sub nextdestiny { } if ($callnodeset) { - $args; - if($noupdate_flag) + my $args; + if($noupdate_flag) { $args = ['enact', '--noupdateinitrd']; } From 16ecce4057bc51f64a7e785c1cda4f7f86667ac0 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 27 May 2014 09:44:35 -0400 Subject: [PATCH 21/27] defect 4083: the dash and busybox rpm packages have been removed from rh7 iso and xcat stateless and satelite do not need them any more for rh7, so remove them from the stateless and statelite pkglist --- xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist | 2 -- xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist | 2 -- 2 files changed, 4 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist index 452804038..aee31ff58 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist @@ -5,10 +5,8 @@ dhclient kernel openssh-server openssh-clients -busybox wget rsyslog -dash vim-minimal ntp rsyslog diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist index 18ceb3e33..410cd004c 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist @@ -6,8 +6,6 @@ dhclient kernel openssh-server openssh-clients -busybox -dash iputils bc irqbalance From 76a8941cbc90859a8b0ce5def3b8d3e1830519e8 Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 27 May 2014 16:58:08 -0500 Subject: [PATCH 22/27] fix for bug 4142: add vios as a new device type --- perl-xCAT/xCAT/RemoteShellExp.pm | 4 ++++ xCAT-server/share/xcat/devicetype/vios/config | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 xCAT-server/share/xcat/devicetype/vios/config diff --git a/perl-xCAT/xCAT/RemoteShellExp.pm b/perl-xCAT/xCAT/RemoteShellExp.pm index 90b15ed43..df62c73fa 100755 --- a/perl-xCAT/xCAT/RemoteShellExp.pm +++ b/perl-xCAT/xCAT/RemoteShellExp.pm @@ -810,6 +810,10 @@ sub senddeviceskeys # add to the command $setupcmd .=$key; $setupcmd .="\""; + # Special case for vios + if ($ENV{DEVICETYPE} eq 'vios') { + $setupcmd = "\"echo $key | tee -a ~/.ssh/authorized_keys2\""; + } # For each input device my @nodelist=split(/,/,$nodes); foreach my $node (@nodelist) { diff --git a/xCAT-server/share/xcat/devicetype/vios/config b/xCAT-server/share/xcat/devicetype/vios/config new file mode 100644 index 000000000..da9165090 --- /dev/null +++ b/xCAT-server/share/xcat/devicetype/vios/config @@ -0,0 +1,5 @@ +[main] +ssh-setup-command=echo +[xdsh] +pre-command=NULL +post-command=NULL From ccccc1e74368a3e3ab519d33d649b68a7ccd2246 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 May 2014 09:31:50 -0400 Subject: [PATCH 23/27] defect 4138 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 2861206e3..c39693c92 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1385,6 +1385,13 @@ sub updatenoderunps foreach my $snkey (keys %servernodes) { + if ((!defined($snkey)) or ($snkey eq "")) { # if we could not find the xcatmaster + + my $rsp = {}; + $rsp->{error}->[0] = "Could not find xcatmaster for @{$servernodes{$snkey}}. Will skip this node. "; + $callback->($rsp); + next; + } my $nodestring = join(',', @{$servernodes{$snkey}}); my $args; my $mode; From 15b679b90797ab18d6387757b213847eb7298425 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 May 2014 09:50:30 -0400 Subject: [PATCH 24/27] defect 4076 --- xCAT-server/lib/xcat/plugins/imgport.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/imgport.pm b/xCAT-server/lib/xcat/plugins/imgport.pm index 198fee11c..8156b0a4c 100644 --- a/xCAT-server/lib/xcat/plugins/imgport.pm +++ b/xCAT-server/lib/xcat/plugins/imgport.pm @@ -1802,7 +1802,7 @@ sub make_files { } if ( $hasplugin ) { # Issue xcatd reload to load the new plugins - system("/etc/init.d/xcatd reload"); + system("/etc/init.d/xcatd restart"); $hasplugin=0; } From 4bcc4e2dbcd9ca954809d6fbef934c16e6f30484 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 May 2014 09:52:06 -0400 Subject: [PATCH 25/27] defect 4076 --- xCAT-rmc/xCAT-rmc.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-rmc/xCAT-rmc.spec b/xCAT-rmc/xCAT-rmc.spec index 6262886df..d7c6f6e73 100644 --- a/xCAT-rmc/xCAT-rmc.spec +++ b/xCAT-rmc/xCAT-rmc.spec @@ -106,7 +106,7 @@ fi %ifos linux if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then - /etc/init.d/xcatd reload + /etc/init.d/xcatd restart fi fi %else From bd774c768f32d3bdda3eafd4e6e6959dd7a446df Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 May 2014 10:01:22 -0400 Subject: [PATCH 26/27] defect 4076 + DB2 updates --- xCAT-server/lib/xcat/plugins/kit.pm | 69 +++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 0d6912c54..aec853777 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -1411,7 +1411,7 @@ sub addkit if ( $hasplugin ) { # Issue xcatd reload to load the new plugins - system("/etc/init.d/xcatd reload"); + system("/etc/init.d/xcatd restart"); } } } @@ -1494,6 +1494,7 @@ sub rmkit my %kitnames; my $des = shift @ARGV; my @kits = split ',', $des; + my $DBname = xCAT::Utils->get_DBName; # support for DB2 foreach my $kit (@kits) { # Check if it is a kitname or basename @@ -1508,7 +1509,12 @@ sub rmkit } $kitnames{$kit} = 1; } else { - my @entries = $tabs{kit}->getAllAttribsWhere( "basename = '$kit'", 'kitname', 'isinternal'); + my @entries; + if ($DBname =~ /^DB2/) { + @entries = $tabs{kit}->getAllAttribsWhere( "\"basename\" = '$kit'", 'kitname', 'isinternal'); + } else { + @entries = $tabs{kit}->getAllAttribsWhere( "basename = '$kit'", 'kitname', 'isinternal'); + } unless (@entries) { my %rsp; push@{ $rsp{data} }, "Kit $kit could not be found in DB $t"; @@ -1545,8 +1551,12 @@ sub rmkit # Find all the components in this kit. my $kitcompnames; - my @kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "kitname = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall'); - + my @kitcomphash; + if ($DBname =~ /^DB2/) { + @kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "\"kitname\" = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall'); + } else { + @kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "kitname = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall'); + } if (@entries && (@entries > 0)) { if($::VERBOSE and !$test){ @@ -1682,7 +1692,12 @@ sub rmkit } # Remove kitrepo - my @kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "kitname = '$kitname'", 'kitreponame'); + my @kitrepohash; + if ($DBname =~ /^DB2/) { + @kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "\"kitname\" = '$kitname'", 'kitreponame'); + } else { + @kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "kitname = '$kitname'", 'kitreponame'); + } foreach my $kitrepo ( @kitrepohash ) { my $kitreponame = $kitrepo->{kitreponame}; $tabs{kitrepo}->delEntries({kitreponame => $kitreponame}); @@ -1716,7 +1731,7 @@ sub rmkit if ( $hasplugin ) { # Issue xcatd reload to load the new plugins - system("/etc/init.d/xcatd reload"); + system("/etc/init.d/xcatd restart"); } } @@ -1878,7 +1893,7 @@ sub addkitcomp return 1; } - + my $DBname = xCAT::Utils->get_DBName; # support for DB2 my %tabs = (); my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage); foreach my $t ( @tables ) { @@ -1911,7 +1926,12 @@ sub addkitcomp $kitcomps{$kitcomponent}{name} = $kitcomponent; $kitcomps{$kitcomponent}{basename} = $kitcomptable->{'basename'}; } else { - my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + my @entries; + if ($DBname =~ /^DB2/) { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + } else { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + } unless (@entries) { my %rsp; push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist"; @@ -2101,7 +2121,12 @@ sub addkitcomp my @kitcompdeps = split ',', $kitcomptable->{'kitcompdeps'}; foreach my $kitcompdependency ( @kitcompdeps ) { my ($kitcompdep, $vers) = split /<=|>=|=|<|>/, $kitcompdependency; - my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release'); + my @entries; + if ($DBname =~ /^DB2/) { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release'); + } else { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release'); + } unless (@entries) { my %rsp; push@{ $rsp{data} }, "Cannot find any matched kit component for kit component $kitcomp dependency $kitcompdep"; @@ -2413,7 +2438,7 @@ sub rmkitcomp return 1; } - + my $DBname = xCAT::Utils->get_DBName; # support for DB2 my %tabs = (); my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage); foreach my $t ( @tables ) { @@ -2456,7 +2481,12 @@ sub rmkitcomp $kitcomps{$kitcomponent}{driverpacks} = $kitcomptable->{driverpacks}; $kitcomps{$kitcomponent}{genimage_postinstall} = $kitcomptable->{genimage_postinstall}; } else { - my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + my @entries; + if ($DBname =~ /^DB2/) { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + } else { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + } unless (@entries) { my %rsp; push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist"; @@ -2530,7 +2560,12 @@ sub rmkitcomp my ($kitcompdep, $vers) = split /<=|>=|=|<|>/, $kitcompdependency; # Get the kit component full name from basename. - my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitcompname' , 'version', 'release'); + my @entries; + if ($DBname =~ /^DB2/) { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcompdep'", 'kitcompname' , 'version', 'release'); + } else { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitcompname' , 'version', 'release'); + } unless (@entries) { my %rsp; push@{ $rsp{data} }, "kitcomponent $kitcompdep basename does not exist"; @@ -3214,7 +3249,7 @@ sub chkkitcomp create_version_response('chkkitcomp'); return 1; # no usage - just exit } - + my $DBname = xCAT::Utils->get_DBName; # support for DB2 my %tabs = (); my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage); foreach my $t ( @tables ) { @@ -3248,7 +3283,12 @@ sub chkkitcomp $kitcomps{$kitcomponent}{serverroles} = $kitcomptable->{serverroles}; $kitcompbasename{$kitcomptable->{basename}} = 1; } else { - my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + my @entries; + if ($DBname =~ /^DB2/) { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + } else { + @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release'); + } unless (@entries) { my %rsp; push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist"; @@ -4660,6 +4700,7 @@ sub db_get_table_rows { my $table = xCAT::Table->new($tablename); my @table_rows = (); + # todo fix for DB2 support if (defined($filter_stmt)) { if (length($filter_stmt) > 0) { @table_rows = $table->getAllAttribsWhere($filter_stmt, @{$attrs}); From e3517ad90416f5bc364fa932fb6354037d39b36a Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 May 2014 10:03:50 -0400 Subject: [PATCH 27/27] defect 4076 + DB2 updates --- xCAT-OpenStack/xCAT-OpenStack.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-OpenStack/xCAT-OpenStack.spec b/xCAT-OpenStack/xCAT-OpenStack.spec index 68d3da8f3..1426238c1 100644 --- a/xCAT-OpenStack/xCAT-OpenStack.spec +++ b/xCAT-OpenStack/xCAT-OpenStack.spec @@ -92,7 +92,7 @@ rm -rf $RPM_BUILD_ROOT %ifos linux if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then - /etc/init.d/xcatd reload + /etc/init.d/xcatd restart fi fi %endif