From 0282e90cf023491b8af1cbc9882695823dc63e77 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 26 Jan 2012 22:06:09 +0000 Subject: [PATCH] Have bmcsetup work around a limitation of a certain service processor Fix mknb to more comprehensively handle the lzma case git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11419 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-nbroot2/bmcsetup | 27 +++++++++++++++++++-------- xCAT-server/lib/xcat/plugins/mknb.pm | 15 ++++++++++++++- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/xCAT-nbroot2/bmcsetup b/xCAT-nbroot2/bmcsetup index 171fd4018..21dcb919e 100755 --- a/xCAT-nbroot2/bmcsetup +++ b/xCAT-nbroot2/bmcsetup @@ -257,15 +257,26 @@ if [ $TRIES -gt $TIMEOUT ]; then echo "ERROR"; else echo "OK"; fi TRIES=0 if [ ! "$IPMIVER" == "1.5" ]; then echo -n "Enabling IPMI v 2.0 LAN access:" - SUPPORTEDSUITES=`ipmitool -d $idev lan print $LANCHAN|grep Suites|awk -F: '{print $2}'|sed -e 's/ 0//'` - PRIVS="X" - for priv in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do - if echo $SUPPORTEDSUITES|grep $priv > /dev/null; then - PRIVS="$PRIVS"a - else - PRIVS="$PRIVS"X - fi + #two goals here, make sure cipher suite 0 does not work as it is insecure + #mae sure cipher suite 3 does work because we will use it + #leave every thing else alone. + ACCESS=`ipmitool raw 0xc 2 1 24 0 0 ` + NEWACCESS="" + i=0 + for elem in $ACCESS; do + echo $i + if [ $i = 2 ]; then + NEWACCESS=`printf "$NEWACCESS 0x%02x" $((0x$elem&0xf0))` + elif [ $i = 3 ]; then + NEWACCESS=`printf "$NEWACCESS 0x%02x" $((0x$elem|0x40))` + elif [ $i != 0 ]; then + NEWACCESS="$NEWACCESS 0x$elem" + fi + i=$((i+1)) done + echo $NEWACCESS + + while ! ipmitool -d $idev lan set $LANCHAN cipher_privs $PRIVS > /dev/null; do sleep 1 let TRIES=TRIES+1 diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 875848cf0..fa0ed586b 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -108,11 +108,20 @@ sub process_request { system("ssh-keygen -t rsa -f $tempdir/etc/ssh_host_rsa_key -C '' -N ''"); system("ssh-keygen -t dsa -f $tempdir/etc/ssh_host_dsa_key -C '' -N ''"); } + my $lzma_exit_value=1; if ($invisibletouch) { + my $done=0; if (-x "/usr/bin/lzma") { #let's reclaim some of that size... $callback->({data=>["Creating genesis.fs.$arch.lzma in $tftpdir/xcat"]}); system("cd $tempdir; find . | cpio -o -H newc | lzma -C crc32 -9 > $tftpdir/xcat/genesis.fs.$arch.lzma"); - } else { + $lzma_exit_value=$? >> 8; + if ($lzma_exit_value) { + $callback->({data=>["Creating genesis.fs.$arch.lzma in $tftpdir/xcat failed, falling back to gzip"]}); + } else { + $done = 1; + } + + if (not $done) { $callback->({data=>["Creating genesis.fs.$arch.gz in $tftpdir/xcat"]}); system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/genesis.fs.$arch.gz"); } @@ -184,7 +193,11 @@ sub process_request { print $cfg "#!gpxe\n"; if ($invisibletouch) { print $cfg 'imgfetch -n kernel http://${next-server}/tftpboot/xcat/genesis.kernel.'."$arch quiet xcatd=".$normnets->{$_}.":$xcatdport $consolecmdline BOOTIF=01-".'${netX/machyp}'."\n"; + if ($lzma_exit_value) { print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/genesis.fs.'."$arch.gz\n"; + } else { + print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/genesis.fs.'."$arch.lzma\n"; + } } else { print $cfg 'imgfetch -n kernel http://${next-server}/tftpboot/xcat/nbk.'."$arch quiet xcatd=".$normnets->{$_}.":$xcatdport $consolecmdline\n"; print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/nbfs.'."$arch.gz\n";