From a9bf99652503a7eabc5bcd9985b6072bf1d7f5cf Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 3 May 2017 04:55:43 -0400 Subject: [PATCH 001/283] Modify xcat-genesis-builder script for Fedora26 ppc64 --- xCAT-genesis-builder/buildrpm | 39 +++++++++++++++++++---------------- xCAT-genesis-builder/install | 17 +++++++-------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index f301961a3..25a37c743 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -133,30 +133,32 @@ if [ "$HOSTOS" = "mcp" ]; then # For ppc64 platform, needs to remove some files, # # and some files are in different directories elif [ $BUILDARCH = "ppc64" ]; then - sed -i 's/dracut_install efibootmgr//' $DRACUTMODDIR/install + sed -i 's/ efibootmgr//' $DRACUTMODDIR/install sed -i 's/ dmidecode//' $DRACUTMODDIR/install - sed -i 's/\/lib\/libncurses.so.5.7/\/lib64\/libncurses.so.5.7/' $DRACUTMODDIR/install - sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.13/' $DRACUTMODDIR/install - sed -i 's/\/lib\/libgcc_s.so.1/\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install - sed -i 's/\/lib\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.7/' $DRACUTMODDIR/install + # Remove the libraries with special version number, starting from Fedora 26 Alpha ppc64 + # ========================================================== + #sed -i 's/\/lib\/libncurses.so.5.7/\/lib64\/libncurses.so.5.7/' $DRACUTMODDIR/install + #sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.13/' $DRACUTMODDIR/install + #sed -i 's/\/lib\/libgcc_s.so.1/\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install + #sed -i 's/\/lib\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.7/' $DRACUTMODDIR/install # following changes are required on Fedora 20 ppc64 # sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.18.so/' $DRACUTMODDIR/install - # following changes are required on Fedora 23 ppc64 - sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.22.so/' $DRACUTMODDIR/install - sed -i 's/\/lib\/libc.so.6/\/lib64\/libc.so.6/' $DRACUTMODDIR/install + # following changes are required on Fedora 26 Alpha ppc64 + #sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.25.so/' $DRACUTMODDIR/install + #sed -i 's/\/lib\/libc.so.6/\/lib64\/libc.so.6/' $DRACUTMODDIR/install # following changes are required on Fedora 23 ppc64 #sed -i 's/\/lib\/ld-linux.so.2/\/lib64\/ld-2.18.so/' $DRACUTMODDIR/install - sed -i 's/\/lib\/ld-linux.so.2/\/lib64\/ld-2.22.so/' $DRACUTMODDIR/install - sed -i 's/\/lib\/libdl.so.2/\/lib64\/libdl.so.2/' $DRACUTMODDIR/install - sed -i 's/\/lib\/libm.so.6/\/lib64\/libm.so.6/' $DRACUTMODDIR/install - sed -i 's/\/lib\/libpthread.so.0/\/lib64\/libpthread.so.0/' $DRACUTMODDIR/install - sed -i 's/\/lib64\/libncurses.so.5.7/\/lib64\/libncurses.so.5.9/' $DRACUTMODDIR/install - # following changes are required on Fedora 22 ppc64 + #sed -i 's/\/lib\/ld-linux.so.2/\/lib64\/ld-2.25.so/' $DRACUTMODDIR/install + #sed -i 's/\/lib\/libdl.so.2/\/lib64\/libdl.so.2/' $DRACUTMODDIR/install + #sed -i 's/\/lib\/libm.so.6/\/lib64\/libm.so.6/' $DRACUTMODDIR/install + #sed -i 's/\/lib\/libpthread.so.0/\/lib64\/libpthread.so.0/' $DRACUTMODDIR/install + #sed -i 's/\/lib64\/libncurses.so.5.7/\/lib64\/libncurses.so.6.0/' $DRACUTMODDIR/install #sed -i 's/\/usr\/lib64\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.19/' $DRACUTMODDIR/install - sed -i 's/\/usr\/lib64\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.21/' $DRACUTMODDIR/install - sed -i 's/\/lib64\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.9/' $DRACUTMODDIR/install - sed -i 's/\/usr\/lib64\/libsasl2.so.2/\/usr\/lib64\/libsasl2.so.3/' $DRACUTMODDIR/install + #sed -i 's/\/usr\/lib64\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.23/' $DRACUTMODDIR/install + #sed -i 's/\/lib64\/libtinfo.so.5.7/\/lib64\/libtinfo.so.6.0/' $DRACUTMODDIR/install + #sed -i 's/\/usr\/lib64\/libsasl2.so.2/\/usr\/lib64\/libsasl2.so.3/' $DRACUTMODDIR/install #sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.18.so/' $DRACUTMODDIR/install + # ========================================================== sed -i 's/\/lib\/terminfo\/l\/linux/\/usr\/share\/terminfo\/l\/linux/g' $DRACUTMODDIR/install sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install fi @@ -189,7 +191,8 @@ cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi # add the perl library -PERL_LIB_DIR="/usr/share/perl5 /usr/lib64/perl5 /usr/local/lib64/perl5 /usr/local/share/perl5" +# add /usr/share/ntp/lib for Fedora26 ppc64, the ntp-perl will installed libraries under it +PERL_LIB_DIR="/usr/share/perl5 /usr/lib64/perl5 /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/share/ntp/lib" for d in `echo $PERL_LIB_DIR`; do if [ -e $d ]; then echo Adding perl libary "$d" diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 2f1d0507f..36ee6207b 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -5,18 +5,16 @@ dracut_install netstat # broadcom update requires dracut_install uniq # mellanox update requires dracut_install grep ip hostname /usr/bin/awk egrep grep dirname expr dracut_install mount.nfs sshd vi reboot lspci parted screen mkfs mkfs.ext4 mkfs.xfs xfs_db #mkfs.btrfs removed -dracut_install efibootmgr #dracut_install libvirtd /usr/share/libvirt/cpu_map.xml /usr/bin/qemu-img /usr/libexec/qemu-kvm dracut_install mkswap df brctl vconfig ifenslave ssh-keygen scp clear dhclient lldpad -dracut_install lldptool /lib64/libnss_dns-2.12.so /lib64/libnss_dns.so.2 dracut_install poweroff ntpq ntpd ntp-wait hwclock date /usr/share/terminfo/x/xterm /usr/share/terminfo/s/screen /etc/nsswitch.conf /etc/services dracut_install /sbin/rsyslogd /etc/protocols umount /bin/rpm /usr/lib/rpm/rpmrc -dracut_install chmod /lib/libc.so.6 /lib/ld-linux.so.2 /lib/libdl.so.2 /lib/libm.so.6 /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements -dracut_install dmidecode /usr/lib64/libstdc++.so.6 #uxspi prereqs, but will use dmidecode to improve decision on loading ipmi_si -dracut_install dmidecode /usr/lib64/libstdc++.so.5 #broadcom firmware update links against old lib -dracut_install /lib/libpthread.so.0 #32 bit lib because UXSPI will not ship a native 64 bit build -dracut_install /lib/libncurses.so.5.7 /usr/lib/libstdc++.so.6.0.13 /lib/libgcc_s.so.1 /lib/libtinfo.so.5.7 -dracut_install /lib64/libldap-2.4.so.2 /lib64/liblber-2.4.so.2 /usr/lib64/libsasl2.so.2 #uxspi has incurred these... +dracut_install chmod /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements +dracut_install efibootmgr lldptool dmidecode #uxspi prereqs, but will use dmidecode to improve decision on loading ipmi_si +#dracut_install dmidecode /usr/lib64/libstdc++.so.5 #broadcom firmware update links against old lib +#dracut_install /lib/libpthread.so.0 #32 bit lib because UXSPI will not ship a native 64 bit build +#dracut_install /lib/libncurses.so.5.7 /usr/lib/libstdc++.so.6.0.13 /lib/libgcc_s.so.1 /lib/libtinfo.so.5.7 +#dracut_install /lib64/libldap-2.4.so.2 /lib64/liblber-2.4.so.2 /usr/lib64/libsasl2.so.2 #uxspi has incurred these... dracut_install /usr/share/zoneinfo/posix/Zulu dracut_install /usr/share/zoneinfo/posix/GMT-0 dracut_install /usr/share/zoneinfo/posix/Europe/Istanbul @@ -594,7 +592,6 @@ inst_dir /var/lib/nfs/statd/sm inst_dir /var/lib/nfs/statd/sm.bak inst_dir /var/lib/nfs/rpc_pipefs/nfs inst "/bin/bash" "/bin/sh" -inst "/lib64/libnss_dns-2.12.so" inst "/lib/terminfo/l/linux" "/lib/terminfo/l/linux" inst "/lib/terminfo/v/vt100" "/lib/terminfo/v/vt100" inst_hook cmdline 10 "$moddir/xcat-cmdline.sh" @@ -624,4 +621,4 @@ dracut_install /lib/udev/rules.d/95-dm-notify.rules dracut_install /usr/share/hwdata/pci.ids # The DB files for udevadm dracut_install /etc/udev/hwdb.bin -dracut_install /lib64/libform.so.5 /lib64/libpanel.so.5 /lib64/libmenu.so.5 /lib64/libsysfs.so.2 /usr/sbin/iprconfig # iprconfig for IBM Power RAID configuration +dracut_install /usr/sbin/iprconfig # iprconfig for IBM Power RAID configuration From 7a8d431650b1be81112c5e8e971f942d51eaecc1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 2 May 2017 10:49:39 -0400 Subject: [PATCH 002/283] Initialize IPMI variables earlier In some scenarios, an IPMI instance could be called to handle data earlier than it should. Ensure the state of the object is in adequate shape to react as soon as possible. --- xCAT-server/lib/perl/xCAT/IPMI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index d7223dc6b..54d33289a 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -181,6 +181,7 @@ sub new { my $self = {}; bless $self, $class; my %args = @_; + $self->init(); unless ($ipmi2support) { $self->{ipmi15only} = 1; } @@ -238,7 +239,6 @@ sub new { } else { $self->{peeraddr} = sockaddr_in($self->{port}, $bmc_n); } - $self->init(); return $self; } From 13ee6733e706b76f50f23e7c9e8fae30e5b2c602 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 2 May 2017 11:19:54 -0400 Subject: [PATCH 003/283] Fix FPC reseat behavior on multiple nodes --- xCAT-server/lib/perl/xCAT/IPMI.pm | 8 ++++++++ xCAT-server/lib/xcat/plugins/ipmi.pm | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index 54d33289a..bd0b480c6 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -471,6 +471,11 @@ sub checksum { sub subcmd { my $self = shift; my %args = @_; + while ($self->{incommand}) { + $self->waitforrsp(); + } + $self->{incommand} = 1; + $self->{expectedcmd} = $args{command}; $self->{expectednetfn} = $args{netfn} + 1; if ($self->{onlogon_args}->{xcatdebugmode}) { @@ -573,6 +578,7 @@ sub timedout { $self->{timeout} = $initialtimeout + (0.5 * rand()); my $rsp = {}; $rsp->{error} = "timeout"; + $self->{incommand} = 0; $self->{ipmicallback}->($rsp, $self->{ipmicallback_args}); $self->{nowait} = 0; return; @@ -833,6 +839,7 @@ sub init { #if we should incur 7 bumps, clear the taboo list and continue on, hoping for best (pessimistically assuming the spec means seq number or that someone could at least interpret it that way) #I'll implement this later... $self->{'logged'} = 0; + $self->{'incommand'} = 0; } sub relog { @@ -1008,6 +1015,7 @@ sub parse_ipmi_payload { $rsp->{code} = shift @payload; $rsp->{data} = \@payload; $self->{timeout} = $initialtimeout + (0.5 * rand()); + $self->{incommand} = 0; $self->{ipmicallback}->($rsp, $self->{ipmicallback_args}); return 0; } diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 00302d365..9bbecab53 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2301,6 +2301,8 @@ sub fpc_firmxfer_watch { } } +my %fpcsessions; + sub reseat_node { my $sessdata = shift; if (1) { # TODO: FPC path checked for @@ -2321,8 +2323,19 @@ sub reseat_node { my $nodeuser = $authdata->{$fpc}->{username}; my $nodepass = $authdata->{$fpc}->{password}; $sessdata->{slotnumber} = $mpent->{id}; - $sessdata->{fpcipmisession} = xCAT::IPMI->new(bmc => $mpent->{mpa}, userid => $nodeuser, password => $nodepass); - $sessdata->{fpcipmisession}->login(callback => \&fpc_node_reseat, callback_args => $sessdata); + if (exists $fpcsessions{$mpent->{mpa}}) { + $sessdata->{fpcipmisession} = $fpcsessions{$mpent->{mpa}}; + until ($sessdata->{fpcipmisession}->{logged}) { + $sessdata->{fpcipmisession}->waitforrsp(); + } + $sessdata->{fpcipmisession}->subcmd(netfn => 0x32, command => 0xa4, + data => [ $sessdata->{slotnumber}, 2 ], + callback => \&fpc_node_reseat_complete, callback_args => $sessdata); + } else { + $sessdata->{fpcipmisession} = xCAT::IPMI->new(bmc => $mpent->{mpa}, userid => $nodeuser, password => $nodepass); + $fpcsessions{$mpent->{mpa}} = $sessdata->{fpcipmisession}; + $sessdata->{fpcipmisession}->login(callback => \&fpc_node_reseat, callback_args => $sessdata); + } } } From e61b6c3789fa3d77b08d3693800962c5858699db Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 3 May 2017 11:34:22 -0400 Subject: [PATCH 004/283] Implement timeout for session sharing When an ipmi session is shared, have waitforrsp have a specified timeout. --- xCAT-server/lib/perl/xCAT/IPMI.pm | 2 +- xCAT-server/lib/xcat/plugins/ipmi.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index bd0b480c6..4b444ac48 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -472,7 +472,7 @@ sub subcmd { my $self = shift; my %args = @_; while ($self->{incommand}) { - $self->waitforrsp(); + $self->waitforrsp(timeout=>1); } $self->{incommand} = 1; diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 9bbecab53..fc10adc97 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2326,7 +2326,7 @@ sub reseat_node { if (exists $fpcsessions{$mpent->{mpa}}) { $sessdata->{fpcipmisession} = $fpcsessions{$mpent->{mpa}}; until ($sessdata->{fpcipmisession}->{logged}) { - $sessdata->{fpcipmisession}->waitforrsp(); + $sessdata->{fpcipmisession}->waitforrsp(timeout=>1); } $sessdata->{fpcipmisession}->subcmd(netfn => 0x32, command => 0xa4, data => [ $sessdata->{slotnumber}, 2 ], From 7091e7713faba8de82ec432240eacbe43cee68f6 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 5 May 2017 09:37:26 -0400 Subject: [PATCH 005/283] Add rsync as an xCAT dependency --- xCAT/xCAT.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 5842d6664..d293339d2 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -31,6 +31,7 @@ Requires: xCAT-server = 4:%{version}-%{release} Requires: xCAT-probe = 4:%{version}-%{release} Requires: xCAT-genesis-scripts-x86_64 = 1:%{version}-%{release} Requires: xCAT-genesis-scripts-ppc64 = 1:%{version}-%{release} +Requires: rsync %define pcm %(if [ "$pcm" = "1" ];then echo 1; else echo 0; fi) %define notpcm %(if [ "$pcm" = "1" ];then echo 0; else echo 1; fi) From 4434d4a6ffa4dffefaaf037d9ec5ade95bb4b049 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Mon, 8 May 2017 02:56:31 -0400 Subject: [PATCH 006/283] Fix issue 2350: Wcons IPMI not working due to xcat code --- xCAT-server/share/xcat/cons/ipmi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/cons/ipmi b/xCAT-server/share/xcat/cons/ipmi index fd4546c3c..631e7200a 100755 --- a/xCAT-server/share/xcat/cons/ipmi +++ b/xCAT-server/share/xcat/cons/ipmi @@ -125,7 +125,9 @@ if (grep /IPMI Version : 1.5/, @mcinfo) { $solcom = "isol"; $iface = "lan"; } elsif (grep /Manufacturer ID : 343/, @mcinfo && ! grep /Product ID : 117/,@mcinfo) { - $isintel = 1; + if (! grep /Product ID\s*:\s*64/,@mcinfo) { + $isintel = 1; + } } my $inteloption = ""; if ($isintel) { From b7f8af5e34f4cdfceccd6568a39d681ea5fbcf98 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 5 Jun 2017 14:09:37 -0400 Subject: [PATCH 007/283] When go-xcat prompts the user to continue, prompt until y or n is specified before aborting. --- xCAT-server/share/xcat/tools/go-xcat | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index b09adea6d..673bc20b4 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1567,14 +1567,22 @@ case "${GO_XCAT_ACTION}" in then echo echo "xCAT is going to be ${GO_XCAT_ACTION/%e/}ed." - read -r -p "Continue? [y/n] " - case "${REPLY}" in - "Y"*|"y"*) - ;; - *) - echo "Aborting ..." - exit 0 - esac + while true; do + + read -r -p "Continue? [y/n] " + case "${REPLY}" in + "Y"*|"y"*) + break + ;; + "N"*|"n"*) + echo "Good-bye!" + exit 0 + ;; + *) + echo "Invalid response!" + ;; + esac + done fi # Use `-y' here. Since the STDOUT is redirect to tee. # `yum' does not display the prompt message properly when From 65615ce7e9d7d73b3537710041fb845258ffc751 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 5 Jun 2017 14:18:30 -0400 Subject: [PATCH 008/283] Remove the quotes around the source command --- xCAT-server/share/xcat/tools/go-xcat | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 673bc20b4..3787ed9d4 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1653,10 +1653,11 @@ case "${GO_XCAT_ACTION}" in If this is the very first time xCAT has been installed, run the following commands to set environment variables into your PATH: - for sh, - \`source /etc/profile.d/xcat.sh' - or csh, - \`source /etc/profile.d/xcat.csh' + For sh: + source /etc/profile.d/xcat.sh + + For csh: + source /etc/profile.d/xcat.csh EOF ;; "update") From f1b406dbc03c611743a7b1740537223544724d82 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Sat, 25 Mar 2017 17:30:59 +0000 Subject: [PATCH 009/283] Reduce `grep` invocations by passing `-[46]` to `ip` --- perl-xCAT/xCAT/Client.pm | 2 +- xCAT-OpenStack/postscripts/configgw | 2 +- xCAT-client/bin/rcons | 2 +- xCAT-genesis-builder/dhclient-script | 2 +- xCAT-genesis-scripts/bin/dodiscovery | 8 ++++---- xCAT-genesis-scripts/bin/doxcat | 6 +++--- xCAT-probe/subcmds/xcatmn | 2 +- xCAT-server/sbin/xcatd | 2 +- xCAT-server/share/xcat/install/scripts/post.rh.common | 6 +++--- xCAT-server/share/xcat/install/scripts/post.ubuntu.common | 4 ++-- xCAT-server/share/xcat/tools/detect_dhcpd | 2 +- xCAT/postscripts/hardeths | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/perl-xCAT/xCAT/Client.pm b/perl-xCAT/xCAT/Client.pm index 079a62155..d7df0a9fc 100644 --- a/perl-xCAT/xCAT/Client.pm +++ b/perl-xCAT/xCAT/Client.pm @@ -33,7 +33,7 @@ if ($inet6support) { if ($^O =~ /^linux/i) { # Is IPv6 enabled on the MN or xcat client node at all? - my $ipv6enabled = `ip addr 2> /dev/null | grep inet6`; + my $ipv6enabled = `ip -6 -o addr 2> /dev/null`; if (!$ipv6enabled) { $inet6support = 0; } diff --git a/xCAT-OpenStack/postscripts/configgw b/xCAT-OpenStack/postscripts/configgw index 36c246eaf..e2b97be77 100755 --- a/xCAT-OpenStack/postscripts/configgw +++ b/xCAT-OpenStack/postscripts/configgw @@ -9,7 +9,7 @@ if [ -z "$1" ];then fi str_nic_name=$1 -str_ip_mask=`ip addr show dev $str_nic_name | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1` +str_ip_mask=`ip -4 -o addr show dev $str_nic_name | awk '{print $4}' | head -n 1` str_ip=`echo $str_ip_mask | awk -F'/' '{print $1}'` str_mask=`echo $str_ip_mask | awk -F'/' '{print $2}'` diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index 2fa148d6a..20c7da036 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -87,7 +87,7 @@ if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/ fi if [ -z "$CONSERVER" ]; then CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '` - declare -a ipaddrs=`ip addr | grep 'inet' | awk {'print $2'} | cut -d/ -f1 | grep -v : | tr '\n' ' '` + declare -a ipaddrs=`ip -o a | awk {'print $4'} | cut -d/ -f1 | grep -v : | tr '\n' ' '` for IP in ${ipaddrs[*]}; do if [[ "${CONSERVER}" == "${IP}" ]]; then # conserver is the same node, do not connect using -s diff --git a/xCAT-genesis-builder/dhclient-script b/xCAT-genesis-builder/dhclient-script index fcf51c9ac..21c1e0e76 100755 --- a/xCAT-genesis-builder/dhclient-script +++ b/xCAT-genesis-builder/dhclient-script @@ -14,7 +14,7 @@ elif [ $reason = "BOUND" ]; then if [ ! -z "$old_ip_address" ]; then ip addr del dev $interface $old_ip_address/$old_subnet_mask fi - for oldip in `ip addr show dev $interface|grep 'inet '|awk '{print $2}'`; do + for oldip in `ip -o addr show dev $interface|awk '{print $4}'`; do ip addr del dev $interface $oldip done if [ ! -z "$new_ip_address" -a ! -z "$new_subnet_mask" ]; then diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index f33ef9c3d..5c3591c00 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -25,11 +25,11 @@ logger -s -t $log_label -p local4.info "Waiting for nics to get addresses" while [ ! -z "$NICSGETTINGADDR" -a $timewaiting != 700 ]; do NEWNICSGETTINGADDR="" for nic in $NICSGETTINGADDR; do - if ! ip addr show dev $nic |grep -v inet6|grep inet >/dev/null; then + if ! ip -4 -o a show dev $nic |grep -q inet; then NEWNICSGETTINGADDR="$NEWNICSGETTINGADDR $nic" else echo -n "$nic|" - ip addr show dev $nic |grep -v inet6|grep inet|sed -e s/\\/.*//|awk '{print $2}' + ip -4 -o addr show dev $nic | awk '{print $4}' | sed -e sX/.*XX fi done sleep 0.1 @@ -187,8 +187,8 @@ for dev in `ip link|grep -B1 ether|grep UP|awk '{print $2}'|sed -e s/://|grep -v ONBOARDINDEX="" DRIVER=`grep DRIVER /sys/class/net/$dev/device/uevent|awk -F= '{print $2}'` PCI_SLOT=`grep PCI_SLOT_NAME /sys/class/net/$dev/device/uevent|awk -F= '{print $2}'` - ADDRESS=`ip address show dev $dev|grep "inet "|grep global|awk '{print $2}'` - MAC=`ip link show dev $dev|grep ether|awk '{print $2}'| tr /a-f/ /A-F/` + ADDRESS=`ip -4 -o a show dev $dev|awk '/global/{print $4}'` + MAC=`ip -o l show dev $dev|awk '/ether/{print $15}'| tr /a-f/ /A-F/` if [ "$MAC_OF_FIRST_UP_NIC" == "unknown" ]; then MAC_OF_FIRST_UP_NIC=`echo $MAC | sed -e s/://g` fi diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 88f86890d..b95a0e0e1 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -212,7 +212,7 @@ else tries=0 while [ -z "$bootnic" ]; do for tmp1 in $ALLUP_NICS; do - if ip addr show dev $tmp1|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; then + if ip -4 -o a show dev $tmp1|grep -v 'scope link'|grep -v 'dynamic'|grep -q inet ; then result=`ping -c1 -I $tmp1 $XCATMASTER 2>&1` if [ $? -eq 0 ]; then logger -s -t $log_label -p local4.info "the nic $tmp1 can ping $XCATMASTER" @@ -247,7 +247,7 @@ else gripeiter=101 logger -s -t $log_label -p local4.info "Acquiring network addresses.." - while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do + while ! ip -4 -o a show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -q inet; do sleep 0.1 if [ $gripeiter = 1 ]; then logger -s -t $log_label -p local4.info "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..." @@ -261,7 +261,7 @@ openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" -ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}' +ip -4 -o a show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|awk '{print $4}' logger -s -t $log_label -p local4.info "Starting ntpd..." ntpd -g -x diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index d192ae60d..e7867d51c 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -387,7 +387,7 @@ sub check_network { # on SN, get ip address by compare 'master' attribute in 'site' table # choose the one in the same network with 'master' - my @ipoutput = `ip addr show 2>&1| grep inet | grep -v inet6`; + my @ipoutput = `ip -4 a show 2>&1| grep inet`; foreach (@ipoutput) { if ($_ =~ /inet\s+(.+)\/(.+)\s+brd\s+(.+)\s+scope global/i) { if (xCAT::NetworkUtils::isInSameSubnet($sitetable_ref->{master}, $1, $2, 1)) { diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 8132fad96..99792c097 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -97,7 +97,7 @@ if ($inet6support) { if ($^O =~ /^linux/i) { # Is IPv6 enabled on the MN or SN at all? - my $ipv6enabled = `ip addr | grep inet6`; + my $ipv6enabled = `ip -6 -o a`; if (!$ipv6enabled) { $inet6support = 0; } diff --git a/xCAT-server/share/xcat/install/scripts/post.rh.common b/xCAT-server/share/xcat/install/scripts/post.rh.common index e3f570030..d9cd19a5a 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh.common +++ b/xCAT-server/share/xcat/install/scripts/post.rh.common @@ -39,12 +39,12 @@ elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-F fi #IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') -IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}') -if [ -z $IP ] +IP=$(ip -4 -o a sh dev $PRINIC | awk '/inet/{print $4}' | head -n 1 | awk -F '/' '{print $1}') +if [ -z "$IP" ] then dhclient $PRINIC #IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') - IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}') + IP=$(ip -4 -o a sh dev $PRINIC | awk '/inet/{print $4}' | head -n 1 | awk -F '/' '{print $1}') fi export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}') diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu.common b/xCAT-server/share/xcat/install/scripts/post.ubuntu.common index 7d1fa02a7..c937a7273 100755 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu.common +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu.common @@ -22,12 +22,12 @@ elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-F export PRINIC=`ip -o link|grep -i "$PRINIC" |awk '{print $2}'|sed s/://` fi #IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') -IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}') +IP=$(ip -4 -o a sh dev $PRINIC | awk '/inet/{print $4}' | head -n 1 | awk -F '/' '{print $1}') if [ -z $IP ] then dhclient $PRINIC #IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') - IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}') + IP=$(ip -4 -o a sh dev $PRINIC | awk '/inet/{print $4}' | head -n 1 | awk -F '/' '{print $1}') fi if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then diff --git a/xCAT-server/share/xcat/tools/detect_dhcpd b/xCAT-server/share/xcat/tools/detect_dhcpd index 1769ba5f1..7003dc297 100755 --- a/xCAT-server/share/xcat/tools/detect_dhcpd +++ b/xCAT-server/share/xcat/tools/detect_dhcpd @@ -46,7 +46,7 @@ $start =~ s/(\d.*)\.(\d.*)/$1/; if (!$nic) { print "specify a nic\n"; print $::USAGE; exit 1; } #my $IP = `ifconfig $nic | grep "inet addr" | awk '{print \$2}' | awk -F: '{print \$2}'`; -my $IPADDRMASK = `ip addr show dev $nic | grep inet | grep -v inet6 | awk '{print \$2}' | head -n 1`; +my $IPADDRMASK = `ip -4 -o a show dev $nic | awk '/inet/{print \$4}' | head -n 1`; my ($IP, $MASK) = split(/\//, $IPADDRMASK); my $MAC; my $tmpMAC; diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index 0d51de150..da2880bb1 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -88,7 +88,7 @@ if [ ! -z $HOSTNAMECTL ] && [ ! -z $NODE ]; then fi for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do - IPADDRMASK=`ip addr show dev $nic | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1` + IPADDRMASK=`ip -4 -o a sh dev $nic | awk '/inet/{print $4}' | head -n 1` IPADDR=`echo $IPADDRMASK | awk -F'/' '{print $1}'` [ -z $IPADDR ] && continue PREFIXMASK=`echo $IPADDRMASK | awk -F'/' '{print $2}'` From dc1b787f8e193efe9e47b915a8b57a08d0684188 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 12 Jun 2017 10:20:58 -0400 Subject: [PATCH 010/283] add cases for confignetwork to config installnic and secondarynic --- .../autotest/testcase/confignetwork/cases0 | 445 ++++++++++++++++++ 1 file changed, 445 insertions(+) create mode 100644 xCAT-test/autotest/testcase/confignetwork/cases0 diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 new file mode 100644 index 000000000..fbd1fd177 --- /dev/null +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -0,0 +1,445 @@ +start: confignetwork_s_installnic_diskful +description: this case is to test confignetwork -s could config installnic successfully in diskful provision. +cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi +cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:sleep 10 +cmd:copycds $$ISO +check:rc==0 +cmd:chdef $$CN postscripts="confignetwork -s" +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,mgt)__" = "ipmi" ]]; then rsetboot $$CN net; fi +check:rc==0 +cmd:if [ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" ];then rnetboot $$CN;else rpower $$CN boot;fi else rpower $$CN boot;fi +check:rc==0 +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +check:rc==0 +check:output=~__GETNODEATTR($$CN,ip)__ +check:output!~dhcp +cmd:chdef -m -t node $$CN postscripts="confignetwork -s" +check:rc==0 +end + +start:confignetwork_s_installnic_diskless +description: this case is to test confignetwork -s could config installnic successfully in diskless provision. +cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN +check:rc==0 +cmd:chdef -t node -o $$CN postbootscripts="confignetwork -s" +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]] && [[ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done +check:rc==0 +cmd:copycds $$ISO +check:rc==0 +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi +check:rc==0 +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +check:rc==0 +check:output=~__GETNODEATTR($$CN,ip)__ +check:output!~dhcp +cmd:chdef -m -t node $$CN postscripts="confignetwork -s" +check:rc==0 +cmd:if [ -d $rootimgdir.regbak ]; then mv $rootimgdir.regbak $rootimgdir -f;fi +end + +start: confignetwork_secondarynic_diskless +description: this case is to test confignetwork -s could config installnic and secondarynic at the same time successfully in diskless provision. +cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN +check:rc==0 +cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=100_1_0_0-255_255_0_0 +check:rc==0 +cmd:chdef -t node -o $$CN postbootscripts="confignetwork -s" +check:rc==0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf $$CN +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]] && [[ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done +check:rc==0 +cmd:copycds $$ISO +check:rc==0 +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi +check:rc==0 +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +check:rc==0 +check:output=~__GETNODEATTR($$CN,ip)__ +check:output!~dhcp +cmd:secondarynic=`xdsh $$CN ip addr |grep 100.1.0.100|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep 100.1.0.100 /etc/sysconfig/network/ifcfg-$secondarynic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 100.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$secondarynic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 100.1.0.100 /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +check:rc==0 +check:output=~100.1.0.100 +check:output!~dhcp +cmd:chdef -m -t node $$CN postscripts="confignetwork -s" +check:rc==0 +cmd:if [ -d $rootimgdir.regbak ]; then mv $rootimgdir.regbak $rootimgdir -f;fi +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= +check:rc==0 +end + +start:confignetwork_secondarynic_updatenode +description: this case is to test confignetwork could config secondarynic successfully with updatenode. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 +check:rc==0 +cmd:chdef -t node -o $$CN postscripts="confignetwork" +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +check:output=~11.1.0.100 +check:output=~MTU=1501 +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +end + +start: confignetwork_secondarynic_nicaliases_updatenode +description: this case is to test confignetwork could config secondarynic nicaliases successfully with updatenode. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:cp -f /etc/hosts /etc/hosts.bak +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nicaliases.$$SECONDNIC="aliases1-1|aliases1-2" +check:rc==0 +cmd:makehosts $$CN +check:rc==0 +cmd:cat /etc/hosts +check:output=~aliases1-1 +check:output=~aliases1-2 +cmd:updatenode $$CN -P confignetwork +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +check:output=~11.1.0.100 +check:output!~dhcp +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +check:output=~12.1.0.100 +check:output!~dhcp +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -f /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +cmd:mv -f /etc/hosts.bak /etc/hosts +end + +start:confignetwork_secondarynic_nicextraparams_updatenode +description: this case is to test confignetwork could config secondarynic nicextraparams successfully with updatenode. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:cp -f /etc/hosts /etc/hosts.bak +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC-1|-$$SECONDNIC-2" +check:rc==0 +cmd:makehosts $$CN +check:rc==0 +cmd:cat /etc/hosts +check:output=~$$CN-$$SECONDNIC-1 +check:output=~$$CN-$$SECONDNIC-2 +cmd:updatenode $$CN -P confignetwork +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:output=~11.1.0.100 +check:output!~dhcp +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi +check:output=~12.1.0.100 +check:output!~dhcp +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -f /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +cmd:mv -f /etc/hosts.bak /etc/hosts +end + +start:confignetwork_secondarynic_nicnetworks_updatenode_false +description: this case is to test confignetwork could return error message when there is no not enough attributes when configing secondarynic with updatenode. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC= +check:rc==0 +cmd:chdef -t node -o $$CN postscripts="confignetwork" +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc!=0 +#TODO check the error message +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +end + +start:confignetwork_secondarynic_nicips_updatenode_false +description: this case is to test confignetwork could return error message when there is no not enough attributes when configing secondarynic with updatenode. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 +check:rc==0 +cmd:chdef -t node -o $$CN postscripts="confignetwork" +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc!=0 +#TODO check the error message +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +end + +start:confignetwork_secondarynic_nictype_updatenode_false +description: this case is to test confignetwork could return error message when there is no not enough attributes when configing secondarynic with updatenode. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 +check:rc==0 +cmd:chdef -t node -o $$CN postscripts="confignetwork" +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc!=0 +#TODO check the error message +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +end + +start:confignetwork_disable_set_to_yes +description: this case is to test if confignetwork could work correctly when disable is set to yes in nics table +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 +check:rc==0 +cmd:chtab node=$$CN nics.disable=yes +check:rc==0 +cmd:chdef -t node -o $$CN postscripts="confignetwork" +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:output!~11.1.0.100 +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +cmd:chtab node=$$CN nics.disable=0 +check:rc==0 +end + +start:confignetwork_disable_set_to_1 +description: this case is to test if confignetwork could work correctly when disable is set to 1 in nics table +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 +check:rc==0 +cmd:chtab node=$$CN nics.disable=1 +check:rc==0 +cmd:chdef -t node -o $$CN postscripts="confignetwork" +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:output!~11.1.0.100 +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +cmd:chtab node=$$CN nics.disable=0 +check:rc==0 +end + +start:confignetwork_niccustomscripts +description: this case is to test confignetwork could config secondarynic and envoke scripts to execute. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:echo "echo hello > /tmp/confignetwork_niccustomscript" > /tmp/script1 +check:rc==0 +cmd:chmod a+x /tmp/script1 +check:rc==0 +cmd:cp /tmp/script1 /install/postscripts +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mut=1501 +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 niccustomscripts.$$SECONDNIC=script1 +check:rc==0 +cmd:chdef -t node -o $$CN postscripts=confignetwork +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:output=~11.1.0.100 +check:output=~MTU=1501 +check:output!~dhcp +cmd:xdsh $$CN "cat /tmp/confignetwork_niccustomscript" +check:rc==0 +check:output=~hello +cmd:xdsh $$CN "rm -rf /tmp/confignetwork_niccustomscript" +check:rc==0 +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +end + +start:confignetwork_secondarynic_thirdnic_multiplevalue_updatenode +description:this case is to verify if confignetwork could config serveral nics' multiple value at the same time. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC-1|-$$SECONDNIC-2" +check:rc==0 +cmd:chdef $$CN nicips.$$THIRDNIC="13.1.0.100|14.1.0.100" nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC="13_1_0_0-255_255_0_0|14_1_0_0-255_255_0_0" nichostnamesuffixes.$$THIRDNIC="-$$THIRDNIC-1|-$$THIRDNIC-2" +check:rc==0 +cmd:cp /etc/hosts /etc/hosts.bak +cmd:rc==0 +cmd:makehosts $$CN +check:rc==0 +cmd:cat /etc/hosts +check:output=~$$CN-$$SECONDNIC-1 +check:output=~$$CN-$$SECONDNIC-2 +check:output=~$$CN-$$THIRDNIC-1 +check:output=~$$CN-$$THIRDNIC-2 +cmd:chdef -t node -o $$CN postscripts="confignetwork" +check:rc==0 +cmd:updatenode $$CN -P confignetwork +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:output=~11.1.0.100 +check:output!~dhcp +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi +check:output=~12.1.0.100 +check:output!~dhcp +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 13.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 13.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 13.1.0.100 /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi +check:output=~13.1.0.100 +check:output!~dhcp +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/network/interfaces.d/$$THIRDNIC:1";else echo "Sorry,this is not supported os"; fi +check:output=~14.1.0.100 +check:output!~dhcp +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC /etc/network/interfaces.d/$$THIRDNIC:1";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +cmd:mv -f /etc/hosts.bak /etc/hosts +end + +start:confignetwork_help +cmd:confignetworks -h +check:rc==0 +#TODO help information is printed +cmd:confignetworks --help +check:rc==0 +#TODO help information is printed +end + + + + + + + From fac7d28f3fa8182883c3af0adc8694727bb20097 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 13 Jun 2017 04:59:19 -0400 Subject: [PATCH 011/283] add a description for help case --- xCAT-test/autotest/testcase/confignetwork/cases0 | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index fbd1fd177..46d93588e 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -429,6 +429,7 @@ cmd:mv -f /etc/hosts.bak /etc/hosts end start:confignetwork_help +description:this case is to verify if help information is provided cmd:confignetworks -h check:rc==0 #TODO help information is printed From 5d2e814243e723578774c67f036da0f31ecc1e5f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 14 Jun 2017 15:15:51 -0400 Subject: [PATCH 012/283] openbmc rflash command support for -u --upload option --- xCAT-server/lib/xcat/plugins/openbmc.pm | 71 +++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index ff192fbbf..618e96200 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -36,6 +36,7 @@ $::POWER_STATE_POWERING_OFF="powering-off"; $::POWER_STATE_POWERING_ON="powering-on"; $::POWER_STATE_QUIESCED="quiesced"; $::POWER_STATE_RESET="reset"; +$::UPLOAD_FILE=""; $::NO_ATTRIBUTES_RETURNED="No attributes returned from the BMC."; @@ -126,6 +127,13 @@ my %status_info = ( RFLASH_LIST_RESPONSE => { process => \&rflash_response, }, + RFLASH_FILE_UPLOAD_REQUEST => { + method => "PUT", + init_url => "$openbmc_project_url/upload/image/", + }, + RFLASH_FILE_UPLOAD_RESPONSE => { + process => \&rflash_response, + }, RINV_REQUEST => { method => "GET", @@ -217,6 +225,7 @@ my %status_info = ( $::RESPONSE_OK = "200 OK"; $::RESPONSE_SERVER_ERROR = "500 Internal Server Error"; $::RESPONSE_SERVICE_UNAVAILABLE = "503 Service Unavailable"; +$::RESPONSE_METHOD_NOT_ALLOWED = "405 Method Not Allowed"; #----------------------------- @@ -677,6 +686,7 @@ sub parse_command_status { if ($update_file =~ /.*\.tar$/) { # Filename ending on .tar was specified $filename = $update_file; + $::UPLOAD_FILE = $update_file; # Save filename to upload if ($check_version) { # Display firmware version of the specified .tar file my $firmware_version_in_file = `$grep_cmd $version_tag $filename`; @@ -710,8 +720,9 @@ sub parse_command_status { return 1; } if ($upload) { - xCAT::SvrUtils::sendmsg("Upload option is not yet supported.", $callback); - return 1; + # Upload specified update file to BMC + $next_status{LOGIN_RESPONSE} = "RFLASH_FILE_UPLOAD_REQUEST"; + $next_status{"RFLASH_FILE_UPLOAD_REQUEST"} = "RFLASH_FILE_UPLOAD_RESPONSE"; } } @@ -832,7 +843,13 @@ sub gen_send_request { if ($method eq "GET") { $debug_info = "$node: DEBUG $method $request_url"; } else { - $debug_info = "$node: DEBUG $method $request_url -d $content"; + if ($::UPLOAD_FILE) { + # Slightly different debug message when doing a file upload + $debug_info = "$node: DEBUG $method $request_url -T " . $::UPLOAD_FILE; + } + else { + $debug_info = "$node: DEBUG $method $request_url -d $content"; + } } print "$debug_info\n"; @@ -864,6 +881,15 @@ sub deal_with_response { my $error; if ($response->status_line eq $::RESPONSE_SERVICE_UNAVAILABLE) { $error = $::RESPONSE_SERVICE_UNAVAILABLE; + } elsif ($response->status_line eq $::RESPONSE_METHOD_NOT_ALLOWED) { + # Special processing for file upload. At this point we do not know how to + # form a proper file upload request. It always fails with "Method not allowed" error. + # If that happens, just assume it worked. + # TODO remove this block when proper request can be generated + $status_info{ $node_info{$node}{cur_status} }->{process}->($node, $response); + + return; + } else { my $response_info = decode_json $response->content; if ($response->status_line eq $::RESPONSE_SERVER_ERROR) { @@ -1420,6 +1446,45 @@ sub rflash_response { } xCAT::SvrUtils::sendmsg("", $callback, $node); #Separate output in case more than 1 endpoint } + if ($node_info{$node}{cur_status} eq "RFLASH_FILE_UPLOAD_RESPONSE") { + # Special processing for file upload. At this point we do not know how to + # form a proper file upload request. It always fails with "Method not allowed" error. + # If that happens, just call the curl commands for now. + # TODO remove this block when proper request can be generated + if ($::UPLOAD_FILE) { + my $request_url_login = "$http_protocol://" . $node_info{$node}{bmc} . "/login"; + my $request_url_logout = "$http_protocol://" . $node_info{$node}{bmc} . "/logout"; + my $request_url_upload = "$http_protocol://" . $node_info{$node}{bmc} . "/upload/image/"; + my $content_login = '{ "data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; + my $content_logout = '{ "data": [ ] }'; + + # curl commands + my $curl_login_cmd = "curl -c cjar -k -H 'Content-Type: application/json' -X POST $request_url_login -d '" . $content_login . "'"; + my $curl_logout_cmd = "curl -b cjar -k -H 'Content-Type: application/json' -X POST $request_url_logout -d '" . $content_logout . "'"; + my $curl_upload_cmd = "curl -b cjar -k -H 'Content-Type: application/octet-stream' -X PUT -T $::UPLOAD_FILE $request_url_upload"; + + # Try to login + my $curl_login_result = `$curl_login_cmd`; + my $h = from_json($curl_login_result); # convert command output to hash + if ($h->{message} eq $::RESPONSE_OK) { + # Login successfull, upload the file + my $curl_upload_result = `$curl_upload_cmd`; + $h = from_json($curl_upload_result); # convert command output to hash + if ($h->{message} eq $::RESPONSE_OK) { + # Upload successfull + xCAT::SvrUtils::sendmsg("Update file $::UPLOAD_FILE successfully uploaded", $callback, $node); + # Try to logoff, no need to check result, as there is nothing else to do if failure + my $curl_logout_result = `$curl_logout_cmd`; + } + else { + xCAT::SvrUtils::sendmsg("Failed to upload update file $::UPLOAD_FILE :" . $h->{message} . " - " . $h->{data}->{description}, $callback, $node); + } + } + else { + xCAT::SvrUtils::sendmsg("Unable to login :" . $h->{message} . " - " . $h->{data}->{description}, $callback, $node); + } + } + } if ($next_status{ $node_info{$node}{cur_status} }) { $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; From d80adecbc29d3dcdf63741f183056aa86b8da140 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 15 Jun 2017 05:43:58 -0400 Subject: [PATCH 013/283] add hardware control bundle for different hardware type --- xCAT-test/autotest/bundle/hdctrl_bmc.bundle | 5 ++++ .../autotest/bundle/hdctrl_general.bundle | 25 +++++++++++++++++++ .../bundle/hdctrl_openpower_ipmi.bundle | 10 ++++++++ .../bundle/hdctrl_openpower_openbmc.bundle | 10 ++++++++ .../autotest/bundle/hdctrl_ppc_hmc.bundle | 4 +++ 5 files changed, 54 insertions(+) create mode 100644 xCAT-test/autotest/bundle/hdctrl_bmc.bundle create mode 100644 xCAT-test/autotest/bundle/hdctrl_general.bundle create mode 100644 xCAT-test/autotest/bundle/hdctrl_openpower_ipmi.bundle create mode 100644 xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle create mode 100644 xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle diff --git a/xCAT-test/autotest/bundle/hdctrl_bmc.bundle b/xCAT-test/autotest/bundle/hdctrl_bmc.bundle new file mode 100644 index 000000000..08ddf66c1 --- /dev/null +++ b/xCAT-test/autotest/bundle/hdctrl_bmc.bundle @@ -0,0 +1,5 @@ +#INCLUDE:hdctrl_general.bundle# +rvitals_wattage +rvitals_fanspeed +rvitals_power +rvitals_leds diff --git a/xCAT-test/autotest/bundle/hdctrl_general.bundle b/xCAT-test/autotest/bundle/hdctrl_general.bundle new file mode 100644 index 000000000..7ea993052 --- /dev/null +++ b/xCAT-test/autotest/bundle/hdctrl_general.bundle @@ -0,0 +1,25 @@ +rpower_off +rpower_stat +rpower_status +rpower_state +rpower_boot +rpower_on +rpower_reset +rpower_noderange +rpower_noderange_nodeps +rpower_err_noderange +rinv_h +rinv_v +rinv_help +rinv_errorcommand +rinv_serial +rinv_model +rinv_firm +rinv_all +rvitals_h +rvitals_v +rvitals_errorcommand +rvitals_temp +rvitals_voltage +rvitals_all +rvitals_noderange_err diff --git a/xCAT-test/autotest/bundle/hdctrl_openpower_ipmi.bundle b/xCAT-test/autotest/bundle/hdctrl_openpower_ipmi.bundle new file mode 100644 index 000000000..7ab405aab --- /dev/null +++ b/xCAT-test/autotest/bundle/hdctrl_openpower_ipmi.bundle @@ -0,0 +1,10 @@ +#INCLUDE:hdctrl_general.bundle# +rinv_deviceid +rinv_uuid +rinv_guid +rinv_vpd +rinv_mprom +rvitals_wattage +rvitals_fanspeed +rvitals_power +rvitals_leds diff --git a/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle b/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle new file mode 100644 index 000000000..043bb245e --- /dev/null +++ b/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle @@ -0,0 +1,10 @@ +#INCLUDE:hdctrl_general.bundle# +rinv_deviceid +rinv_uuid +rinv_vpd +rinv_cpu +rinv_dimm +rvitals_wattage +rvitals_fanspeed +rvitals_power +rvitals_leds diff --git a/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle b/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle new file mode 100644 index 000000000..e7ba1aa74 --- /dev/null +++ b/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle @@ -0,0 +1,4 @@ +#INCLUDE:hdctrl_general.bundle# +rinv_bus +rinv_config +rvitals_lcds From c92e8eca1aea1db6a9de99fada7befcc602ac6e3 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 15 Jun 2017 07:15:03 -0400 Subject: [PATCH 014/283] Refine test case: nodeset_cmdline, nodeset_runimage, nodeset_shell --- xCAT-test/autotest/testcase/genesis/cases0 | 6 ++--- .../autotest/testcase/genesis/genesistest.pl | 25 ++++++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index 977261ad0..3b0037e5d 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -2,7 +2,7 @@ start:nodeset_shell description: verify could log in genesis shell cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -s +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -s ;if [[ $? -eq 0 ]];then exit 0 ;else cat /var/log/consoles/$$CN; cat /tmp/genesistestlog/*;exit 1;fi check:rc==0 cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 @@ -12,7 +12,7 @@ start:nodeset_cmdline description:verify could run cmdline successfully cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -d +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -d;if [[ $? -eq 0 ]];then exit 0 ;else cat /var/log/consoles/$$CN;cat /tmp/genesistestlog/*;exit 1;fi check:rc==0 cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 @@ -22,7 +22,7 @@ start:nodeset_runimg description:verify runimg could work cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -i +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -i;if [[ $? -eq 0 ]];then exit 0 ;else cat /var/log/consoles/$$CN;cat /tmp/genesistestlog/*;exit 1;fi check:rc==0 cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 diff --git a/xCAT-test/autotest/testcase/genesis/genesistest.pl b/xCAT-test/autotest/testcase/genesis/genesistest.pl index 73c3bc3b4..cf64a2bc5 100755 --- a/xCAT-test/autotest/testcase/genesis/genesistest.pl +++ b/xCAT-test/autotest/testcase/genesis/genesistest.pl @@ -5,7 +5,6 @@ BEGIN $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/lib/perl"; -use xCAT::Utils; use strict; use warnings; use Getopt::Long; @@ -71,7 +70,8 @@ if (!defined($noderange)) { print "$::USAGE"; exit 1; } -my $os = xCAT::Utils->osver("all"); +my $os = &get_os; +print "os is $os\n"; if ($check_genesis_file) { send_msg(2, "[$$]:Check genesis file..............."); &check_genesis_file(&get_arch); @@ -81,8 +81,9 @@ if ($check_genesis_file) { send_msg(2, "genesis file available"); } } -my $master=xCAT::TableUtils->get_site_Master(); +my $master=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print \$2}'`; if (!$master) { $master=hostname(); } +print "master is $master\n"; #################################### ####nodesetshell test for genesis @@ -236,6 +237,7 @@ sub rungenesisimg { chmod 0755, "/install/my_image/runme.sh"; `tar -zcvf /tmp/my_image.tgz -C /install/my_image .`; copy("/tmp/my_image.tgz", "/install/my_image") or die "Copy failed: $!"; + print "master is $master\n"; `rinstall $noderange "runimage=http://$master/install/my_image/my_image.tgz",shell`; if ($?) { send_msg(0, "rinstall noderange failed for runimg"); @@ -264,7 +266,7 @@ sub testxdsh { if (($value == 1) || ($value == 2) || ($value == 3)) { `xdsh $noderange -t 2 cat $checkfile |grep $checkstring`; if ($?) { - foreach (1 .. 1500) { + foreach (1 .. 15) { `xdsh $noderange -t 2 cat $checkfile | grep $checkstring`; last if ($? == 0); } @@ -311,6 +313,21 @@ sub clearenv { return 0; } #################################### +#get os +################################### +sub get_os { + my $os = "unknown"; + my $output = `cat /etc/*release* 2>&1`; + if ($output =~ /suse/i) { + $os = "sles"; + } elsif ($output =~ /Red Hat/i) { + $os = "redhat"; + } elsif ($output =~ /ubuntu/i) { + $os = "ubuntu"; + } + return $os; +} +#################################### #get arch ################################### sub get_arch { From 6cb1dbb82446fe4dedb770cd13213b50efd7dd51 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 15 Jun 2017 09:31:44 -0400 Subject: [PATCH 015/283] Refine test case: nodeset_cmdline, nodeset_runimage, nodeset_shell --- .../autotest/testcase/genesis/genesistest.pl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/xCAT-test/autotest/testcase/genesis/genesistest.pl b/xCAT-test/autotest/testcase/genesis/genesistest.pl index cf64a2bc5..d75ff6e7b 100755 --- a/xCAT-test/autotest/testcase/genesis/genesistest.pl +++ b/xCAT-test/autotest/testcase/genesis/genesistest.pl @@ -1,10 +1,5 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -BEGIN -{ - $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; -} -use lib "$::XCATROOT/lib/perl"; use strict; use warnings; use Getopt::Long; @@ -71,7 +66,6 @@ if (!defined($noderange)) { exit 1; } my $os = &get_os; -print "os is $os\n"; if ($check_genesis_file) { send_msg(2, "[$$]:Check genesis file..............."); &check_genesis_file(&get_arch); @@ -171,7 +165,7 @@ sub check_genesis_file { sub rungenesiscmd { my $runcmd_script = "/tmp/cmdtest"; my $result = "/tmp/testresult"; - my $genesis_base_dir = "$::XCATROOT/share/xcat/netboot/genesis"; + my $genesis_base_dir = "/opt/xcat/share/xcat/netboot/genesis"; my $genesis_bin_dir; my $value = 0; my $arch = shift; @@ -211,7 +205,7 @@ sub rungenesiscmd { sub rungenesisimg { my $runimg_script = "/tmp/imgtest"; my $result = "/tmp/testresult"; - my $genesis_base_dir = "$::XCATROOT/share/xcat/netboot/genesis"; + my $genesis_base_dir = "/opt/xcat/share/xcat/netboot/genesis"; my $genesis_bin_dir; my $value = 0; mkdir("/install/my_image"); @@ -237,7 +231,6 @@ sub rungenesisimg { chmod 0755, "/install/my_image/runme.sh"; `tar -zcvf /tmp/my_image.tgz -C /install/my_image .`; copy("/tmp/my_image.tgz", "/install/my_image") or die "Copy failed: $!"; - print "master is $master\n"; `rinstall $noderange "runimage=http://$master/install/my_image/my_image.tgz",shell`; if ($?) { send_msg(0, "rinstall noderange failed for runimg"); @@ -266,7 +259,7 @@ sub testxdsh { if (($value == 1) || ($value == 2) || ($value == 3)) { `xdsh $noderange -t 2 cat $checkfile |grep $checkstring`; if ($?) { - foreach (1 .. 15) { + foreach (1 .. 1500) { `xdsh $noderange -t 2 cat $checkfile | grep $checkstring`; last if ($? == 0); } @@ -285,7 +278,7 @@ sub clearenv { my $runmetar = "/install/my_image/my_image.tgz"; my $runmetar_tmp = "/tmp/my_image.tgz"; my $runmedir = "/install/my_image"; - my $genesis_base_dir = "$::XCATROOT/share/xcat/netboot/genesis"; + my $genesis_base_dir = "/opt/xcat/share/xcat/netboot/genesis"; if (-e "$runimg_script") { unlink("$runme"); unlink("$runmetar_tmp"); From 3735a07bb91fea3ce8ec32aa47ec3fe5716d5f04 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 15 Jun 2017 04:06:11 -0400 Subject: [PATCH 016/283] add SIGN=0 option to skip repo sign in ubuntu build script --- build-ubunturepo | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 6e01caab8..42625d895 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -22,6 +22,8 @@ # When you are ready to release this build, use PROMOTE=1 without PREGA # BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in # prep for a release. +# GPGSIGN=0 - Do not sign the repo in the end of the build. The repo will be signed by default +# # LOG= - provide an LOG file option to redirect some output into log file # # For the dependency packages 1. All the xcat dependency deb packages should be uploaded to @@ -125,16 +127,20 @@ if [ ! -z ${LOG} ]; then WGET_CMD="wget -o ${LOG}" fi -#sync the gpg key to the build machine local -gsa_url=http://pokgsa.ibm.com/projects/x/xcat/build/linux -mkdir -p $HOME/.gnupg -for key_name in pubring.gpg secring.gpg trustdb.gpg; do - if [ ! -f $HOME/.gnupg/$key_name ] || [ `wc -c $HOME/.gnupg/$key_name|cut -f 1 -d' '` == 0 ]; then - rm -f $HOME/.gnupg/$key_name - ${WGET_CMD} -P $HOME/.gnupg $gsa_url/keys/$key_name - chmod 600 $HOME/.gnupg/$key_name - fi -done +if [ "$GPGSIGN" = "0" ];then + echo "GPGSIGN=$GPGSIGN specified, skip gnupg key downloading" +else + #sync the gpg key to the build machine local + gsa_url=http://pokgsa.ibm.com/projects/x/xcat/build/linux + mkdir -p $HOME/.gnupg + for key_name in pubring.gpg secring.gpg trustdb.gpg; do + if [ ! -f $HOME/.gnupg/$key_name ] || [ `wc -c $HOME/.gnupg/$key_name|cut -f 1 -d' '` == 0 ]; then + rm -f $HOME/.gnupg/$key_name + ${WGET_CMD} -P $HOME/.gnupg $gsa_url/keys/$key_name + chmod 600 $HOME/.gnupg/$key_name + fi + done +fi if [ "$c_flag" ] then @@ -323,9 +329,14 @@ Codename: $dist Architectures: $tmp_out_arch Components: main Description: Repository automatically genereted conf -SignWith: yes __EOF__ + + if [ "$GPGSIGN" = "0" ];then + echo "GPGSIGN=$GPGSIGN specified, the repo will not be signed" + else + echo "SignWith: yes" >> conf/distributions + fi done cat << __EOF__ > conf/options @@ -444,11 +455,16 @@ Codename: $dist Architectures: $tmp_out_arch Components: main Description: Repository automatically genereted conf -SignWith: yes __EOF__ done + if [ "$GPGSIGN" = "0" ];then + echo "GPGSIGN=$GPGSIGN specified, the repo will not be signed" + else + echo "SignWith: yes" >> conf/distributions + fi + cat << __EOF__ > conf/options verbose ask-passphrase From 9e0406b0e960511349f6d533ada42b7409993dd2 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 16 Jun 2017 02:15:04 -0400 Subject: [PATCH 017/283] update descriptions and rspconfig/rsetboot cases --- xCAT-test/autotest/bundle/hdctrl_bmc.bundle | 11 +++++++++++ xCAT-test/autotest/bundle/hdctrl_general.bundle | 1 + .../autotest/bundle/hdctrl_openpower_ipmi.bundle | 1 + .../autotest/bundle/hdctrl_openpower_openbmc.bundle | 11 +++++++++++ xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle | 1 + 5 files changed, 25 insertions(+) diff --git a/xCAT-test/autotest/bundle/hdctrl_bmc.bundle b/xCAT-test/autotest/bundle/hdctrl_bmc.bundle index 08ddf66c1..b75dc41ce 100644 --- a/xCAT-test/autotest/bundle/hdctrl_bmc.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_bmc.bundle @@ -1,5 +1,16 @@ +description:the cases in this bundle is to used to verify xCAT hardware control funtions on BMC managed servers. #INCLUDE:hdctrl_general.bundle# rvitals_wattage rvitals_fanspeed rvitals_power rvitals_leds +rsetboot_net_statcheck +rsetboot_cd_statcheck +rsetboot_default_statcheck +rsetboot_h +rsetboot_help +rsetboot_v +rsetboot_node_invalidnode +rsetboot_noderange_net +rsetboot_node_invalidaction +rsetboot_group_net diff --git a/xCAT-test/autotest/bundle/hdctrl_general.bundle b/xCAT-test/autotest/bundle/hdctrl_general.bundle index 7ea993052..84ed91f6f 100644 --- a/xCAT-test/autotest/bundle/hdctrl_general.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_general.bundle @@ -1,3 +1,4 @@ +description:the cases in this bundle is to verify xCAT hardware control functions. This is the basic bundle for all hardware types. rpower_off rpower_stat rpower_status diff --git a/xCAT-test/autotest/bundle/hdctrl_openpower_ipmi.bundle b/xCAT-test/autotest/bundle/hdctrl_openpower_ipmi.bundle index 7ab405aab..c44ce9d54 100644 --- a/xCAT-test/autotest/bundle/hdctrl_openpower_ipmi.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_openpower_ipmi.bundle @@ -1,3 +1,4 @@ +description:the cases in this bundle is to verify xCAT hardware control functions on servers which are managed using IPMI. #INCLUDE:hdctrl_general.bundle# rinv_deviceid rinv_uuid diff --git a/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle b/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle index 043bb245e..a271c5b6a 100644 --- a/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle @@ -1,3 +1,4 @@ +description:the cases in this bundle is to used to verify xCAT hardware control funtions on openpower servers which are mananged using openbmc. #INCLUDE:hdctrl_general.bundle# rinv_deviceid rinv_uuid @@ -8,3 +9,13 @@ rvitals_wattage rvitals_fanspeed rvitals_power rvitals_leds +rsetboot_net_statcheck +rsetboot_cd_statcheck +rsetboot_default_statcheck +rsetboot_h +rsetboot_help +rsetboot_v +rsetboot_node_invalidnode +rsetboot_noderange_net +rsetboot_node_invalidaction +rsetboot_group_net diff --git a/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle b/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle index e7ba1aa74..2cf057542 100644 --- a/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle @@ -1,3 +1,4 @@ +description:the cases in this bundle is to used to verify xCAT hardware control funtions on HMC managed servers. #INCLUDE:hdctrl_general.bundle# rinv_bus rinv_config From 56e418d81aa3b3fa0e11f4fe20249e9d6d8b04c7 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 16 Jun 2017 04:05:04 -0400 Subject: [PATCH 018/283] add reventlog cases in hdctrl_general.bundle --- xCAT-test/autotest/bundle/hdctrl_general.bundle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT-test/autotest/bundle/hdctrl_general.bundle b/xCAT-test/autotest/bundle/hdctrl_general.bundle index 84ed91f6f..e7020b1d6 100644 --- a/xCAT-test/autotest/bundle/hdctrl_general.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_general.bundle @@ -24,3 +24,7 @@ rvitals_temp rvitals_voltage rvitals_all rvitals_noderange_err +reventlog_null +reventlog_all +reventlog_clear +reventlog_numofentries From ce5ad6f52651b739c83c2cbbb8d2ccaeb4deeeb0 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 16 Jun 2017 04:38:33 -0400 Subject: [PATCH 019/283] Remove the commented out lines to not have the reviewer confusing --- xCAT-genesis-builder/buildrpm | 24 ------------------------ xCAT-genesis-builder/install | 4 ---- 2 files changed, 28 deletions(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 25a37c743..28f3985aa 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -135,30 +135,6 @@ if [ "$HOSTOS" = "mcp" ]; then elif [ $BUILDARCH = "ppc64" ]; then sed -i 's/ efibootmgr//' $DRACUTMODDIR/install sed -i 's/ dmidecode//' $DRACUTMODDIR/install - # Remove the libraries with special version number, starting from Fedora 26 Alpha ppc64 - # ========================================================== - #sed -i 's/\/lib\/libncurses.so.5.7/\/lib64\/libncurses.so.5.7/' $DRACUTMODDIR/install - #sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.13/' $DRACUTMODDIR/install - #sed -i 's/\/lib\/libgcc_s.so.1/\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install - #sed -i 's/\/lib\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.7/' $DRACUTMODDIR/install - # following changes are required on Fedora 20 ppc64 - # sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.18.so/' $DRACUTMODDIR/install - # following changes are required on Fedora 26 Alpha ppc64 - #sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.25.so/' $DRACUTMODDIR/install - #sed -i 's/\/lib\/libc.so.6/\/lib64\/libc.so.6/' $DRACUTMODDIR/install - # following changes are required on Fedora 23 ppc64 - #sed -i 's/\/lib\/ld-linux.so.2/\/lib64\/ld-2.18.so/' $DRACUTMODDIR/install - #sed -i 's/\/lib\/ld-linux.so.2/\/lib64\/ld-2.25.so/' $DRACUTMODDIR/install - #sed -i 's/\/lib\/libdl.so.2/\/lib64\/libdl.so.2/' $DRACUTMODDIR/install - #sed -i 's/\/lib\/libm.so.6/\/lib64\/libm.so.6/' $DRACUTMODDIR/install - #sed -i 's/\/lib\/libpthread.so.0/\/lib64\/libpthread.so.0/' $DRACUTMODDIR/install - #sed -i 's/\/lib64\/libncurses.so.5.7/\/lib64\/libncurses.so.6.0/' $DRACUTMODDIR/install - #sed -i 's/\/usr\/lib64\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.19/' $DRACUTMODDIR/install - #sed -i 's/\/usr\/lib64\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.23/' $DRACUTMODDIR/install - #sed -i 's/\/lib64\/libtinfo.so.5.7/\/lib64\/libtinfo.so.6.0/' $DRACUTMODDIR/install - #sed -i 's/\/usr\/lib64\/libsasl2.so.2/\/usr\/lib64\/libsasl2.so.3/' $DRACUTMODDIR/install - #sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.18.so/' $DRACUTMODDIR/install - # ========================================================== sed -i 's/\/lib\/terminfo\/l\/linux/\/usr\/share\/terminfo\/l\/linux/g' $DRACUTMODDIR/install sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install fi diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 36ee6207b..e5dfbe0f0 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -11,10 +11,6 @@ dracut_install poweroff ntpq ntpd ntp-wait hwclock date /usr/share/terminfo/x/xt dracut_install /sbin/rsyslogd /etc/protocols umount /bin/rpm /usr/lib/rpm/rpmrc dracut_install chmod /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements dracut_install efibootmgr lldptool dmidecode #uxspi prereqs, but will use dmidecode to improve decision on loading ipmi_si -#dracut_install dmidecode /usr/lib64/libstdc++.so.5 #broadcom firmware update links against old lib -#dracut_install /lib/libpthread.so.0 #32 bit lib because UXSPI will not ship a native 64 bit build -#dracut_install /lib/libncurses.so.5.7 /usr/lib/libstdc++.so.6.0.13 /lib/libgcc_s.so.1 /lib/libtinfo.so.5.7 -#dracut_install /lib64/libldap-2.4.so.2 /lib64/liblber-2.4.so.2 /usr/lib64/libsasl2.so.2 #uxspi has incurred these... dracut_install /usr/share/zoneinfo/posix/Zulu dracut_install /usr/share/zoneinfo/posix/GMT-0 dracut_install /usr/share/zoneinfo/posix/Europe/Istanbul From beb7d5af12304226dbe5cd518202e1b6239a745f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 16 Jun 2017 14:40:11 -0400 Subject: [PATCH 020/283] Check for update file existance and eliminate few lines --- xCAT-server/lib/xcat/plugins/openbmc.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 618e96200..3128b3f21 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -687,6 +687,11 @@ sub parse_command_status { # Filename ending on .tar was specified $filename = $update_file; $::UPLOAD_FILE = $update_file; # Save filename to upload + # Verify file exists and is readable + unless (-r $filename) { + xCAT::SvrUtils::sendmsg("Error accessing update file $filename", $callback); + return 1; + } if ($check_version) { # Display firmware version of the specified .tar file my $firmware_version_in_file = `$grep_cmd $version_tag $filename`; @@ -1452,16 +1457,14 @@ sub rflash_response { # If that happens, just call the curl commands for now. # TODO remove this block when proper request can be generated if ($::UPLOAD_FILE) { - my $request_url_login = "$http_protocol://" . $node_info{$node}{bmc} . "/login"; - my $request_url_logout = "$http_protocol://" . $node_info{$node}{bmc} . "/logout"; - my $request_url_upload = "$http_protocol://" . $node_info{$node}{bmc} . "/upload/image/"; + my $request_url = "$http_protocol://" . $node_info{$node}{bmc}; my $content_login = '{ "data": [ "' . $node_info{$node}{username} .'", "' . $node_info{$node}{password} . '" ] }'; my $content_logout = '{ "data": [ ] }'; # curl commands - my $curl_login_cmd = "curl -c cjar -k -H 'Content-Type: application/json' -X POST $request_url_login -d '" . $content_login . "'"; - my $curl_logout_cmd = "curl -b cjar -k -H 'Content-Type: application/json' -X POST $request_url_logout -d '" . $content_logout . "'"; - my $curl_upload_cmd = "curl -b cjar -k -H 'Content-Type: application/octet-stream' -X PUT -T $::UPLOAD_FILE $request_url_upload"; + my $curl_login_cmd = "curl -c cjar -k -H 'Content-Type: application/json' -X POST $request_url/login -d '" . $content_login . "'"; + my $curl_logout_cmd = "curl -b cjar -k -H 'Content-Type: application/json' -X POST $request_url/logout -d '" . $content_logout . "'"; + my $curl_upload_cmd = "curl -b cjar -k -H 'Content-Type: application/octet-stream' -X PUT -T $::UPLOAD_FILE $request_url/upload/image/"; # Try to login my $curl_login_result = `$curl_login_cmd`; From 978ed4ab6978b1c95acc69789950aad388cab158 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 19 Jun 2017 04:53:46 -0400 Subject: [PATCH 021/283] add missed cases for hardware control commands. Fix bug 3269 --- xCAT-test/autotest/testcase/rinv/cases2 | 26 ++++++++++++ xCAT-test/autotest/testcase/rpower/cases0 | 49 ++++++++++++++--------- 2 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 xCAT-test/autotest/testcase/rinv/cases2 diff --git a/xCAT-test/autotest/testcase/rinv/cases2 b/xCAT-test/autotest/testcase/rinv/cases2 new file mode 100644 index 000000000..0588d179c --- /dev/null +++ b/xCAT-test/autotest/testcase/rinv/cases2 @@ -0,0 +1,26 @@ +start:rinv_mprom +hcp:ipmi +arch:x86_64 +cmd:rinv $$CN mprom +check:rc==0 +check:output=~BMC Firmware:\s*\w+.\w+ +end + +start:rinv_guid +hcp:ipmi +arch:x86_64 +cmd:rinv $$CN guid +check:rc==0 +check:output=~UUID/GUID:\s*\w+-\w+-\w+-\w+-\w+ +end + +start:rinv_dimm +hcp:ipmi +arch:x86_64 +cmd:rinv $$CN dimm +check:rc==0 +check:output=~DIMM 1 :\s*\w+ +check:output=~DIMM 1 Manufacture Date:\s*\w+ +check:output=~DIMM 1 Manufacture Location:\s*\d+ +check:output=~DIMM 1 Model:\s*\w+-\w+ +end diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index c8ab300c9..23b0d1905 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -1,6 +1,4 @@ start:rpower_off -description:This case is to test off option could remote power off nodes -Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN on cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done check:ouptut=~Running|on @@ -12,8 +10,6 @@ check:output=~Not Activated|off end start:rpower_stat -description:This case is to test stat option could show the power status of nodes -Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN on cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 5 ];then break;fi done cmd:rpower $$CN stat @@ -33,8 +29,6 @@ check:output=~Not Activated|off end start:rpower_boot -description:This case is to test boot option could power on the nodes if nodes in off state. Or could hard reset the nodes if they are on. -Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat @@ -47,8 +41,7 @@ check:output=~Running|on end start:rpower_status -description:This case is to test status option could show the power status of nodes -Attribute: $$CN-The operation object of rpower command +description:checkout rpower node status could get node's stauts cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN status|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN status @@ -61,8 +54,7 @@ check:output=~Running|on end start:rpower_state -description:This case is to test state option could show the power status of nodes -Attribute: $$CN-The operation object of rpower command +description:checkout rpower node status could get node's stauts cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN state|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN state @@ -75,8 +67,6 @@ check:output=~Running|on end start:rpower_on -description:This case is to test on option could remote power on nodes -Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat @@ -89,8 +79,6 @@ check:output=~Running|on end start:rpower_reset -description:This case is to test reset option could hard reset nodes when nodes are in on state. -Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN on cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat @@ -103,25 +91,46 @@ check:output=~Running|on end start:rpower_noderange -description:This case is to test rpower could process error usage and return help information. -Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN check:rc!=0 check:output=~Unsupported|Usage end start:rpower_noderange_nodeps -description:This case is to test rpower could process error usage and return help information. -Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN --nodeps check:rc!=0 check:output=~Unsupported|Usage end start:rpower_err_noderange -description:This case is to test rpower could process error usage and return help information. -Attribute:N/A cmd:rpower testnode stat check:rc!=0 check:output=~Error end + +start:rpower_softoff +description:This case is to test softoff option could remote shutdown nodes +Attribute: $$CN-The operation object of rpower command +cmd:rpower $$CN on +cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +check:ouptut=~Running|on +cmd:rpower $$CN softoff +check:rc==0 +cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +cmd:rpower $$CN stat +check:output=~Not Activated|off +end + +start:rpower_onstandby +description:This case is to test onstandby option could bring server to standby state +Attribute: $$CN-The operation object of rpower command +arch:ppc64 +cmd:rpower $$CN off +check:rc==0 +cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +cmd:rpower $$CN stat +check:output=~Not Activated|off +cmd:rpower $$CN onstandby +cmd:a=0;while ! `rpower $$CN stat|grep "standby\|Standby" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done +check:ouptut=~standby|Standby +end From d445a91c7405b0e3ee997b31ae6f96fbd1c391f5 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 19 Jun 2017 05:03:20 -0400 Subject: [PATCH 022/283] update the description --- xCAT-test/autotest/testcase/rinv/cases2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-test/autotest/testcase/rinv/cases2 b/xCAT-test/autotest/testcase/rinv/cases2 index 0588d179c..388ae6ce5 100644 --- a/xCAT-test/autotest/testcase/rinv/cases2 +++ b/xCAT-test/autotest/testcase/rinv/cases2 @@ -1,4 +1,5 @@ start:rinv_mprom +description:this case is to test mprom option for rinv on x86_64 servers. hcp:ipmi arch:x86_64 cmd:rinv $$CN mprom @@ -7,6 +8,7 @@ check:output=~BMC Firmware:\s*\w+.\w+ end start:rinv_guid +description:this case is to test guid option for rinv on x86_64 servers. hcp:ipmi arch:x86_64 cmd:rinv $$CN guid @@ -15,6 +17,7 @@ check:output=~UUID/GUID:\s*\w+-\w+-\w+-\w+-\w+ end start:rinv_dimm +description:this case is to test dimm option for rinv on x86_64 servers. hcp:ipmi arch:x86_64 cmd:rinv $$CN dimm From df1a5aeb522c0297a8c47a17b1caa6934b73904b Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 19 Jun 2017 10:32:30 -0400 Subject: [PATCH 023/283] Change to only display the active firmware instead of any firmware that is listed and add in the software id into the output so that sorting would keep the various software information together. --- xCAT-server/lib/xcat/plugins/openbmc.pm | 30 +++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 64bfbb99c..9bbed2852 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1036,25 +1036,31 @@ sub rinv_response { # Handle printing out all posssible Software values in a generic format: # node: Software: () # + my $sw_id = (split(/\//, $key_url))[-1]; if (defined($content{Version}) and $content{Version}) { my $purpose_value = uc ((split(/\./, $content{Purpose}))[-1]); my $activation_value = (split(/\./, $content{Activation}))[-1]; # - # The space below between "SOFTWARE:" and $content{Version} is intentional - # to cause the sorting of this line before any additional info lines + # For 'rinv firm', only print Active software. 'rflash list' will handle others # - $content_info = "$purpose_value SOFTWARE: $content{Version} ($activation_value)"; - push (@sorted_output, $content_info); - - if ($content{ExtendedVersion} ne "") { - # ExtendedVersion is going to be a comma separated list of additional software - my @versions = split(',', $content{ExtendedVersion}); - foreach my $ver (@versions) { - $content_info = "$purpose_value SOFTWARE: -- additional info: $ver"; - push (@sorted_output, $content_info); + if ($activation_value =~ "Active") { + # + # The space below between "SOFTWARE:" and $content{Version} is intentional + # to cause the sorting of this line before any additional info lines + # + $content_info = "$purpose_value SOFTWARE[$sw_id]: $content{Version} ($activation_value)"; + push (@sorted_output, $content_info); + + if (defined($content{ExtendedVersion}) and $content{ExtendedVersion} ne "") { + # ExtendedVersion is going to be a comma separated list of additional software + my @versions = split(',', $content{ExtendedVersion}); + foreach my $ver (@versions) { + $content_info = "$purpose_value SOFTWARE[$sw_id]: -- additional info: $ver"; + push (@sorted_output, $content_info); + } } + next; } - next; } } else { if (! defined $content{Present}) { From cbf7c3b00749acf3ddfc525ede5c1025a6531e41 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 19 Jun 2017 10:52:20 -0400 Subject: [PATCH 024/283] update the doc for steps on checking packages that changed in xcat-dep --- docs/source/guides/install-guides/yum/update_xcat.rst | 4 ++-- docs/source/guides/install-guides/zypper/update_xcat.rst | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/install-guides/yum/update_xcat.rst b/docs/source/guides/install-guides/yum/update_xcat.rst index fc01d99ad..fbbbe4762 100644 --- a/docs/source/guides/install-guides/yum/update_xcat.rst +++ b/docs/source/guides/install-guides/yum/update_xcat.rst @@ -6,5 +6,5 @@ If at a later date you want to update xCAT, first, update the software repositor yum clean metadata # or, yum clean all yum update '*xCAT*' - - + # To check and update the packages provided by xcat-dep: + yum update '*xcat*' diff --git a/docs/source/guides/install-guides/zypper/update_xcat.rst b/docs/source/guides/install-guides/zypper/update_xcat.rst index c18bb5b3c..3da2a2bb2 100644 --- a/docs/source/guides/install-guides/zypper/update_xcat.rst +++ b/docs/source/guides/install-guides/zypper/update_xcat.rst @@ -6,4 +6,5 @@ If at a later date you want to update xCAT, first, update the software repositor zypper refresh zypper update "*xCAT*" - + # To check and update the packages provided by xcat-dep: + zypper update "*xcat*" From 4cdad73b8f2d710f537660f38d754a8d50d79cbc Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 19 Jun 2017 10:59:53 -0400 Subject: [PATCH 025/283] Better error message for missing file --- xCAT-server/lib/xcat/plugins/openbmc.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 3128b3f21..284f9d4a5 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -689,7 +689,7 @@ sub parse_command_status { $::UPLOAD_FILE = $update_file; # Save filename to upload # Verify file exists and is readable unless (-r $filename) { - xCAT::SvrUtils::sendmsg("Error accessing update file $filename", $callback); + xCAT::SvrUtils::sendmsg([1,"Cannot access $filename"], $callback); return 1; } if ($check_version) { From e5e93255071556d6fe828dfed82efdd5ee082f83 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 19 Jun 2017 14:59:25 -0400 Subject: [PATCH 026/283] Change the dhcpinterface documentation to avoid confusion about xcatmn --- .../manage_clusters/ppc64le/configure/networks.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst index 3bacd82b5..7d10ecd29 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst @@ -45,6 +45,10 @@ Configure DHCP to listen on different network interfaces [**Optional**] To set "eth1" and "eth3" on the management node and "bond0" on all nodes in the nodegroup="service", set ``dhcpinterfaces`` using: :: + chdef -t site dhcpinterfaces="eth1,eth3;service|bond0" + + or, to explicitly identify the management node with hostname ``xcatmn``: :: + chdef -t site dhcpinterfaces="xcatmn|eth1,eth3;service|bond0" **noboot** From a6696f7fde0e4243f07911842082c0f957767fe6 Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 20 Jun 2017 10:12:54 +0800 Subject: [PATCH 027/283] Fix the calculation error for conserver version number This patch fix the error while calculating the version number. Use int instead of ord to convert string to integer. fix-issue: #3286 --- perl-xCAT/xCAT/Utils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 1dde56d16..ea107f482 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -638,7 +638,7 @@ sub calc_conserver_version { my $ver_str = shift; my @vers = split(/\./, $ver_str); - return ord($vers[2]) + ord($vers[1]) * 10000 + ord($vers[0]) * 100000000; + return int($vers[2]) + int($vers[1]) * 10000 + int($vers[0]) * 100000000; } From 74942a8f20763e139a13a746ed135407ad288b5a Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 19 Jun 2017 22:23:40 -0400 Subject: [PATCH 028/283] update for an error checkin --- xCAT-test/autotest/testcase/rpower/cases0 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/rpower/cases0 b/xCAT-test/autotest/testcase/rpower/cases0 index 23b0d1905..09f619fe0 100644 --- a/xCAT-test/autotest/testcase/rpower/cases0 +++ b/xCAT-test/autotest/testcase/rpower/cases0 @@ -1,4 +1,6 @@ start:rpower_off +description:This case is to test off option could remote power off nodes +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN on cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done check:ouptut=~Running|on @@ -10,6 +12,8 @@ check:output=~Not Activated|off end start:rpower_stat +description:This case is to test stat option could show the power status of nodes +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN on cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 5 ];then break;fi done cmd:rpower $$CN stat @@ -29,6 +33,8 @@ check:output=~Not Activated|off end start:rpower_boot +description:This case is to test boot option could power on the nodes if nodes in off state. Or could hard reset the nodes if they are on. +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat @@ -41,7 +47,8 @@ check:output=~Running|on end start:rpower_status -description:checkout rpower node status could get node's stauts +description:This case is to test status option could show the power status of nodes +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN status|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN status @@ -54,7 +61,8 @@ check:output=~Running|on end start:rpower_state -description:checkout rpower node status could get node's stauts +description:This case is to test state option could show the power status of nodes +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN state|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN state @@ -67,6 +75,8 @@ check:output=~Running|on end start:rpower_on +description:This case is to test on option could remote power on nodes +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN off cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat @@ -79,6 +89,8 @@ check:output=~Running|on end start:rpower_reset +description:This case is to test reset option could hard reset nodes when nodes are in on state. +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN on cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done cmd:rpower $$CN stat @@ -91,18 +103,24 @@ check:output=~Running|on end start:rpower_noderange +description:This case is to test rpower could process error usage and return help information. +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN check:rc!=0 check:output=~Unsupported|Usage end start:rpower_noderange_nodeps +description:This case is to test rpower could process error usage and return help information. +Attribute: $$CN-The operation object of rpower command cmd:rpower $$CN --nodeps check:rc!=0 check:output=~Unsupported|Usage end start:rpower_err_noderange +description:This case is to test rpower could process error usage and return help information. +Attribute:N/A cmd:rpower testnode stat check:rc!=0 check:output=~Error From 32060a54cc2a58b63bcb48c9e4d880fe134bfbc2 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 19 Jun 2017 23:23:00 -0400 Subject: [PATCH 029/283] update rpower cases for hdctrl_ppc_hmc.bundle and rinv cases for hdctrl_bmc.bundle --- xCAT-test/autotest/bundle/hdctrl_bmc.bundle | 3 +++ xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle | 2 ++ 2 files changed, 5 insertions(+) diff --git a/xCAT-test/autotest/bundle/hdctrl_bmc.bundle b/xCAT-test/autotest/bundle/hdctrl_bmc.bundle index b75dc41ce..e8fcfd2fa 100644 --- a/xCAT-test/autotest/bundle/hdctrl_bmc.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_bmc.bundle @@ -1,5 +1,8 @@ description:the cases in this bundle is to used to verify xCAT hardware control funtions on BMC managed servers. #INCLUDE:hdctrl_general.bundle# +rinv_mprom +rinv_guid +rinv_dimm rvitals_wattage rvitals_fanspeed rvitals_power diff --git a/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle b/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle index 2cf057542..51a886de1 100644 --- a/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_ppc_hmc.bundle @@ -1,5 +1,7 @@ description:the cases in this bundle is to used to verify xCAT hardware control funtions on HMC managed servers. #INCLUDE:hdctrl_general.bundle# +rpower_softoff +rpower_onstandby rinv_bus rinv_config rvitals_lcds From f3ea0a27296b6fbc7d6dc0a2f87a35edd07f9924 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 20 Jun 2017 02:53:12 -0400 Subject: [PATCH 030/283] When start simulator failed, will exit not mkdef nodes --- xCAT-test/autotest/testcase/simulator/config_simulator.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT-test/autotest/testcase/simulator/config_simulator.sh b/xCAT-test/autotest/testcase/simulator/config_simulator.sh index 80860227a..fc4013fdd 100755 --- a/xCAT-test/autotest/testcase/simulator/config_simulator.sh +++ b/xCAT-test/autotest/testcase/simulator/config_simulator.sh @@ -47,6 +47,10 @@ if [ $flag = "-s" ]; then rmdef $cnhn /root/openbmc_simulator/simulator -n $nic -r $range + if [ $? != 0 ]; then + echo "Start simulator Failed" + exit 1 + fi node_end=$[nodes-1] chdef -t group $cnhn mgt=openbmc bmc="|\D+(\d+)$|10.100.(1+((\$1)/100)).((\$1)%100+1)|" bmcusername=$username bmcpassword=$password From 6720675b21440e30d56f7b4e491352f4587c6617 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Tue, 20 Jun 2017 17:08:51 +0800 Subject: [PATCH 031/283] revert to old udevadm code (#3294) --- xCAT-server/share/xcat/install/scripts/getinstdisk | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/getinstdisk b/xCAT-server/share/xcat/install/scripts/getinstdisk index 311a7294d..fcc517565 100644 --- a/xCAT-server/share/xcat/install/scripts/getinstdisk +++ b/xCAT-server/share/xcat/install/scripts/getinstdisk @@ -141,19 +141,8 @@ if [ -z "$install_disk" ]; then disk_wwn=$(echo $output_for_wwn | $utolcmd) output_for_path=$(IFS= ;echo $disk_info | grep DEVPATH | cut -d "=" -f2) disk_path=$(echo $output_for_path | $utolcmd) - - # Work around the issue Pegas running on Power9 installation hang in anaconda - # with "TypeError: argument of type 'NoneType' is not iterable", - # after running of "udevadm info --attribute-walk --name=/dev/sda" in %pre section of kickstart - cpu_model=$(awk '/model/ { print $NF }' /proc/cpuinfo) - p9_bool=$(grep POWER9 /proc/cpuinfo|head -n 1|awk '{print $3}') - anaconda --version >/dev/null 2>&1 - if [ $? -eq 0 ] && [ "$cpu_model" = "0000000000000000" ] && [ "$p9_bool" = "POWER9" ]; then - disk_driver="" - else - disk_driver=$(udevadm info --attribute-walk --name=$disk | grep DRIVERS| grep -v '""'| grep -v '"sd"'| + disk_driver=$(udevadm info --attribute-walk --name=$disk | grep DRIVERS| grep -v '""'| grep -v '"sd"'| \head -n 1| sed -e 's/[^"]*"//' -e 's/"//' | $utolcmd) - fi echo "[get_install_disk]The disk $disk information: " echo "[get_install_disk] disk_wwn=$disk_wwn" From 1340f398e0b28e857516fa93cd4b9f5a4a753079 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 20 Jun 2017 08:50:35 -0400 Subject: [PATCH 032/283] Refine test case: nodeset_cmdline, nodeset_runimage, nodeset_shell --- xCAT-test/autotest/testcase/genesis/cases0 | 9 ++++++--- xCAT-test/autotest/testcase/genesis/genesistest.pl | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index 3b0037e5d..f9fb966ea 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -2,28 +2,31 @@ start:nodeset_shell description: verify could log in genesis shell cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -s ;if [[ $? -eq 0 ]];then exit 0 ;else cat /var/log/consoles/$$CN; cat /tmp/genesistestlog/*;exit 1;fi +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -s check:rc==0 cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 +cmd:cat /tmp/genesistestlog/* end start:nodeset_cmdline description:verify could run cmdline successfully cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -d;if [[ $? -eq 0 ]];then exit 0 ;else cat /var/log/consoles/$$CN;cat /tmp/genesistestlog/*;exit 1;fi +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -d check:rc==0 cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 +cmd:cat /tmp/genesistestlog/* end start:nodeset_runimg description:verify runimg could work cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -i;if [[ $? -eq 0 ]];then exit 0 ;else cat /var/log/consoles/$$CN;cat /tmp/genesistestlog/*;exit 1;fi +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -i check:rc==0 cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 +cmd:cat /tmp/genesistestlog/* end diff --git a/xCAT-test/autotest/testcase/genesis/genesistest.pl b/xCAT-test/autotest/testcase/genesis/genesistest.pl index d75ff6e7b..1c3c20fe6 100755 --- a/xCAT-test/autotest/testcase/genesis/genesistest.pl +++ b/xCAT-test/autotest/testcase/genesis/genesistest.pl @@ -195,7 +195,7 @@ sub rungenesiscmd { } `rinstall $noderange "runcmd=cmdtest,shell"`; if ($?) { - send_msg(0, "rinstall noderange shell failed for runcmd test"); + send_msg(0, "nodeset noderange shell failed for runcmd test"); } return $value; } @@ -257,10 +257,12 @@ sub testxdsh { $checkfile = "/proc/cmdline"; } if (($value == 1) || ($value == 2) || ($value == 3)) { - `xdsh $noderange -t 2 cat $checkfile |grep $checkstring`; + `xdsh $noderange -t 2 cat $checkfile 2>&1|grep $checkstring `; if ($?) { - foreach (1 .. 1500) { - `xdsh $noderange -t 2 cat $checkfile | grep $checkstring`; + foreach (1 .. 10) { + `sleep 300`; + send_msg(1,"try to run xdsh to check the results again"); + `xdsh $noderange -t 2 cat $checkfile 2>&1| grep $checkstring `; last if ($? == 0); } } From d8e2303b050b278b0a11d4639567b64964b0896f Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 20 Jun 2017 09:21:22 -0400 Subject: [PATCH 033/283] Refine test case: nodeset_cmdline, nodeset_runimage, nodeset_shell --- xCAT-test/autotest/testcase/genesis/genesistest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/genesis/genesistest.pl b/xCAT-test/autotest/testcase/genesis/genesistest.pl index 1c3c20fe6..75d88398f 100755 --- a/xCAT-test/autotest/testcase/genesis/genesistest.pl +++ b/xCAT-test/autotest/testcase/genesis/genesistest.pl @@ -195,7 +195,7 @@ sub rungenesiscmd { } `rinstall $noderange "runcmd=cmdtest,shell"`; if ($?) { - send_msg(0, "nodeset noderange shell failed for runcmd test"); + send_msg(0, "rinstall noderange shell failed for runcmd test"); } return $value; } From 3f43f44c7e44428b10ef071b9637f3558dc66bd9 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 20 Jun 2017 15:58:16 -0400 Subject: [PATCH 034/283] Update code to print a warning message if we get a response error. Currently there is nothing printed back so we can't tell if an error has occurred. Allow for some debug output if XCATBYPASS=1 --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 9fe214b77..f1fb34b32 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -46,6 +46,7 @@ my $bmc_user; my $bmc_pass; my $openbmc_user; my $openbmc_pass; +my $openbmc_port = 2200; #------------------------------------------------------- @@ -584,9 +585,9 @@ sub scan_process { # Set child process default, if not the function runcmd may return error $SIG{CHLD} = 'DEFAULT'; - my $nmap_cmd = "nmap ${$live_ip}[$i] -p 2200 -Pn"; + my $nmap_cmd = "nmap ${$live_ip}[$i] -p $openbmc_port -Pn"; my $nmap_output = xCAT::Utils->runcmd($nmap_cmd, -1); - if ($nmap_output =~ /2200\/tcp (\w+)/) { + if ($nmap_output =~ /$openbmc_port\/tcp (\w+)/) { my $port_stat = $1; if ($port_stat eq "open") { bmcdiscovery_openbmc(${$live_ip}[$i], $opz, $opw, $request_command); @@ -1048,6 +1049,7 @@ sub bmcdiscovery_openbmc{ my $request_command = shift; my $node = sprintf("node-%08x", unpack("N*", inet_aton($ip))); + print "$ip: Detected openbmc, attempting to obtain system information...\n"; my $http_protocol="https"; my $openbmc_project_url = "xyz/openbmc_project"; my $login_endpoint = "login"; @@ -1068,7 +1070,10 @@ sub bmcdiscovery_openbmc{ $url = "$http_protocol://$ip/$openbmc_project_url/$system_endpoint"; my $req = HTTP::Request->new('GET', $url, $header); my $req_output = $brower->request($req); - return if ($req_output->is_error); + if ($req_output->is_error) { + xCAT::MsgUtils->message("W", { data => ["$ip: Could not obtain system information from BMC. Verify firmware levels are up-to-date."] }, $::CALLBACK); + return; + } my $response = decode_json $req_output->content; my $mtm; my $serial; From 0ab98f9273c0095d5a16c2d001192155824be47d Mon Sep 17 00:00:00 2001 From: zet809 Date: Wed, 21 Jun 2017 10:24:05 +0800 Subject: [PATCH 035/283] To replace pull request 3061: use rpm inside chroot to query dracut version (#3293) --- xCAT-server/share/xcat/netboot/sles/genimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 84897d2ed..f3e80aaa8 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -615,7 +615,7 @@ if ((-d "$rootimg_dir/usr/share/dracut") or (-d "$rootimg_dir/usr/lib/dracut")) $dracutmode = 1; # get dracut version - $dracutver = `rpm --root $rootimg_dir -qi dracut | grep Version | awk -F' ' '{print \$3}' `; + $dracutver = `chroot $rootimg_dir rpm -qi dracut | awk '/Version/{print $3}' `; chomp($dracutver); if ($dracutver =~ /^\d\d\d$/) { if ($dracutver >= "033") { From d038c61851d675ce20591470220ccb372d9a1b46 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 21 Jun 2017 05:02:53 -0400 Subject: [PATCH 036/283] Refine test case: nodeset_cmdline, nodeset_runimage, nodeset_shell --- xCAT-test/autotest/testcase/genesis/genesistest.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/genesis/genesistest.pl b/xCAT-test/autotest/testcase/genesis/genesistest.pl index 75d88398f..f7b376049 100755 --- a/xCAT-test/autotest/testcase/genesis/genesistest.pl +++ b/xCAT-test/autotest/testcase/genesis/genesistest.pl @@ -77,6 +77,7 @@ if ($check_genesis_file) { } my $master=`lsdef -t site -i master -c 2>&1 | awk -F'=' '{print \$2}'`; if (!$master) { $master=hostname(); } +chomp($master); print "master is $master\n"; #################################### @@ -260,7 +261,7 @@ sub testxdsh { `xdsh $noderange -t 2 cat $checkfile 2>&1|grep $checkstring `; if ($?) { foreach (1 .. 10) { - `sleep 300`; + sleep 300; send_msg(1,"try to run xdsh to check the results again"); `xdsh $noderange -t 2 cat $checkfile 2>&1| grep $checkstring `; last if ($? == 0); From 5f1a506cfbf497c425f5d452d4aad180d23c4169 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 21 Jun 2017 02:00:28 -0400 Subject: [PATCH 037/283] update rspconfig cases in bundle file hdctrl_openpower_openbmc.bundle --- xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle b/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle index a271c5b6a..42e3d05a2 100644 --- a/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle +++ b/xCAT-test/autotest/bundle/hdctrl_openpower_openbmc.bundle @@ -19,3 +19,11 @@ rsetboot_node_invalidnode rsetboot_noderange_net rsetboot_node_invalidaction rsetboot_group_net +rspconfig_ip +rspconfig_ip_invalid +rspconfig_ip_null +rspconfig_netmask +rspconfig_netmask_invalid +rspconfig_gateway +rspconfig_gateway_invalid +rspconfig_node_invalid From e5dd79d55eb169e79f455a75200ee20dcdd0aaf5 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 21 Jun 2017 14:56:38 +0800 Subject: [PATCH 038/283] add nodeset_errorcommand testcase for issue :3175 (#3300) --- xCAT-test/autotest/testcase/nodeset/cases0 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index 6972152d3..d43f6ae66 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -196,4 +196,11 @@ cmd:noderm testnode1 cmd:rmdef -t osimage -o "__GETNODEATTR($$CN,os)__-x86_64-install-compute" cmd:cp -f /etc/hosts.xcattestbak /etc/hosts end - +start:nodeset_errorcommand +description:This testcase is to very nodeset osimage errorcommand could give right output +Attribute: $$CN-The operation object of nodeset command +cmd:nodeset $$CN osimage= __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==1 +check:output=~Error: Invalid argument: +check:output=~Usage: nodeset +end From 17faabe04e6a9264dfaf9f911cd358044bd49977 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 21 Jun 2017 03:57:51 -0400 Subject: [PATCH 039/283] fix issue 3289: Changing site table attributes using chdef does not return the correct message --- perl-xCAT/xCAT/DBobjUtils.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 4faa725b8..880160f42 100755 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -780,6 +780,7 @@ sub setobjdefs $montable->commit; $monsettable->commit; + $objhash{$objname}{updated} = 1; next; } #if ($type eq 'monitoring') @@ -870,6 +871,9 @@ sub setobjdefs } } + unless ($ret) { + $objhash{$objname}{updated} = 1; + } $thistable->commit; From dad84e8820990f32af0bd2dea020a3f8c3f1355b Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 21 Jun 2017 04:35:47 -0400 Subject: [PATCH 040/283] update confignetwork cases according to comments --- .../autotest/testcase/confignetwork/cases0 | 82 +++++++++++-------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index 46d93588e..76fbce5f3 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -1,5 +1,5 @@ start: confignetwork_s_installnic_diskful -description: this case is to test confignetwork -s could config installnic successfully in diskful provision. +description: this case is to test confignetwork -s could configure installnic successfully in diskful provision. cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 @@ -16,16 +16,12 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:sleep 10 +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done cmd:copycds $$ISO check:rc==0 cmd:chdef $$CN postscripts="confignetwork -s" check:rc==0 -cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,mgt)__" = "ipmi" ]]; then rsetboot $$CN net; fi -check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" ];then rnetboot $$CN;else rpower $$CN boot;fi else rpower $$CN boot;fi +cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done @@ -44,7 +40,7 @@ check:rc==0 end start:confignetwork_s_installnic_diskless -description: this case is to test confignetwork -s could config installnic successfully in diskless provision. +description: this case is to test confignetwork -s could configure installnic successfully in diskless provision. cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 cmd:chdef -t node -o $$CN postbootscripts="confignetwork -s" @@ -74,7 +70,7 @@ cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-comput check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:sleep 900 +cmd:sleep 180 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 @@ -86,7 +82,7 @@ cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{pr check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output!~dhcp -cmd:chdef -m -t node $$CN postscripts="confignetwork -s" +cmd:chdef -m -t node $$CN postbootscripts="confignetwork -s" check:rc==0 cmd:if [ -d $rootimgdir.regbak ]; then mv $rootimgdir.regbak $rootimgdir -f;fi end @@ -126,7 +122,7 @@ cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-comput check:rc==0 cmd:rinstall $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:sleep 900 +cmd:sleep 180 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 @@ -142,18 +138,23 @@ cmd:secondarynic=`xdsh $$CN ip addr |grep 100.1.0.100|awk -F " " '{print $NF}'`; check:rc==0 check:output=~100.1.0.100 check:output!~dhcp -cmd:chdef -m -t node $$CN postscripts="confignetwork -s" +cmd:chdef -m -t node $$CN postbootscripts="confignetwork -s" check:rc==0 cmd:if [ -d $rootimgdir.regbak ]; then mv $rootimgdir.regbak $rootimgdir -f;fi +cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= check:rc==0 end start:confignetwork_secondarynic_updatenode -description: this case is to test confignetwork could config secondarynic successfully with updatenode. +description: this case is to test confignetwork could configure secondarynic successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 -cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 +cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1496 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 @@ -161,20 +162,28 @@ cmd:chdef -t node -o $$CN postscripts="confignetwork" check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 -check:output=~MTU=1501 +check:output=~MTU=1496 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" +check:rc==0 end start: confignetwork_secondarynic_nicaliases_updatenode description: this case is to test confignetwork could config secondarynic nicaliases successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +check:rc==0 cmd:cp -f /etc/hosts /etc/hosts.bak cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 @@ -202,18 +211,26 @@ check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 cmd:mv -f /etc/hosts.bak /etc/hosts +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" +check:rc==0 end start:confignetwork_secondarynic_nicextraparams_updatenode -description: this case is to test confignetwork could config secondarynic nicextraparams successfully with updatenode. +description: this case is to test confignetwork could configure secondarynic nicextraparams successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +check:rc==0 cmd:cp -f /etc/hosts /etc/hosts.bak cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC-1|-$$SECONDNIC-2" +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC-1|-$$SECONDNIC-2" nicextraparams.$$SECONDNIC="CONNECTED_MODE=yes" check:rc==0 cmd:makehosts $$CN check:rc==0 @@ -227,6 +244,7 @@ check:output=~11.1.0.100 check:output!~dhcp cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi check:output=~12.1.0.100 +check:output=~CONNECTED_MODE=yes check:output!~dhcp cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 @@ -235,6 +253,10 @@ check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 cmd:mv -f /etc/hosts.bak /etc/hosts +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" +check:rc==0 end start:confignetwork_secondarynic_nicnetworks_updatenode_false @@ -312,8 +334,6 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 -cmd:chtab node=$$CN nics.disable=0 -check:rc==0 end start:confignetwork_disable_set_to_1 @@ -336,8 +356,6 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 -cmd:chtab node=$$CN nics.disable=0 -check:rc==0 end start:confignetwork_niccustomscripts @@ -350,7 +368,7 @@ cmd:chmod a+x /tmp/script1 check:rc==0 cmd:cp /tmp/script1 /install/postscripts check:rc==0 -cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mut=1501 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mut=1496 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 niccustomscripts.$$SECONDNIC=script1 check:rc==0 @@ -360,7 +378,7 @@ cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 -check:output=~MTU=1501 +check:output=~MTU=1496 check:output!~dhcp cmd:xdsh $$CN "cat /tmp/confignetwork_niccustomscript" check:rc==0 @@ -378,6 +396,10 @@ start:confignetwork_secondarynic_thirdnic_multiplevalue_updatenode description:this case is to verify if confignetwork could config serveral nics' multiple value at the same time. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 +cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +check:rc==0 cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC @@ -426,6 +448,10 @@ check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 cmd:mv -f /etc/hosts.bak /etc/hosts +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/" +check:rc==0 end start:confignetwork_help @@ -436,11 +462,3 @@ check:rc==0 cmd:confignetworks --help check:rc==0 #TODO help information is printed -end - - - - - - - From 1531f136c83c34a0a97c5bdcb6bfd8cc85f7105b Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 21 Jun 2017 05:36:44 -0400 Subject: [PATCH 041/283] update confignetwork cases according to comments --- xCAT-test/autotest/testcase/confignetwork/cases0 | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index 76fbce5f3..1b36ff610 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -158,8 +158,6 @@ cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtif check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 -cmd:chdef -t node -o $$CN postscripts="confignetwork" -check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi @@ -267,8 +265,6 @@ cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtif check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC= check:rc==0 -cmd:chdef -t node -o $$CN postscripts="confignetwork" -check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc!=0 #TODO check the error message @@ -285,8 +281,6 @@ cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtif check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 -cmd:chdef -t node -o $$CN postscripts="confignetwork" -check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc!=0 #TODO check the error message @@ -303,8 +297,6 @@ cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtif check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 -cmd:chdef -t node -o $$CN postscripts="confignetwork" -check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc!=0 #TODO check the error message @@ -324,8 +316,6 @@ cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicne check:rc==0 cmd:chtab node=$$CN nics.disable=yes check:rc==0 -cmd:chdef -t node -o $$CN postscripts="confignetwork" -check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi @@ -346,8 +336,6 @@ cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicne check:rc==0 cmd:chtab node=$$CN nics.disable=1 check:rc==0 -cmd:chdef -t node -o $$CN postscripts="confignetwork" -check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi @@ -372,8 +360,6 @@ cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtif check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 niccustomscripts.$$SECONDNIC=script1 check:rc==0 -cmd:chdef -t node -o $$CN postscripts=confignetwork -check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi @@ -421,8 +407,6 @@ check:output=~$$CN-$$SECONDNIC-1 check:output=~$$CN-$$SECONDNIC-2 check:output=~$$CN-$$THIRDNIC-1 check:output=~$$CN-$$THIRDNIC-2 -cmd:chdef -t node -o $$CN postscripts="confignetwork" -check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi From b8c402c86a23ce0203bcc8da8712f89ebd4eb305 Mon Sep 17 00:00:00 2001 From: yangsong Date: Wed, 21 Jun 2017 04:45:23 -0500 Subject: [PATCH 042/283] Revert "add GPGSIGN =0 option to skip repo sign in ubuntu build script" (#3303) --- build-ubunturepo | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 42625d895..6e01caab8 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -22,8 +22,6 @@ # When you are ready to release this build, use PROMOTE=1 without PREGA # BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in # prep for a release. -# GPGSIGN=0 - Do not sign the repo in the end of the build. The repo will be signed by default -# # LOG= - provide an LOG file option to redirect some output into log file # # For the dependency packages 1. All the xcat dependency deb packages should be uploaded to @@ -127,20 +125,16 @@ if [ ! -z ${LOG} ]; then WGET_CMD="wget -o ${LOG}" fi -if [ "$GPGSIGN" = "0" ];then - echo "GPGSIGN=$GPGSIGN specified, skip gnupg key downloading" -else - #sync the gpg key to the build machine local - gsa_url=http://pokgsa.ibm.com/projects/x/xcat/build/linux - mkdir -p $HOME/.gnupg - for key_name in pubring.gpg secring.gpg trustdb.gpg; do - if [ ! -f $HOME/.gnupg/$key_name ] || [ `wc -c $HOME/.gnupg/$key_name|cut -f 1 -d' '` == 0 ]; then - rm -f $HOME/.gnupg/$key_name - ${WGET_CMD} -P $HOME/.gnupg $gsa_url/keys/$key_name - chmod 600 $HOME/.gnupg/$key_name - fi - done -fi +#sync the gpg key to the build machine local +gsa_url=http://pokgsa.ibm.com/projects/x/xcat/build/linux +mkdir -p $HOME/.gnupg +for key_name in pubring.gpg secring.gpg trustdb.gpg; do + if [ ! -f $HOME/.gnupg/$key_name ] || [ `wc -c $HOME/.gnupg/$key_name|cut -f 1 -d' '` == 0 ]; then + rm -f $HOME/.gnupg/$key_name + ${WGET_CMD} -P $HOME/.gnupg $gsa_url/keys/$key_name + chmod 600 $HOME/.gnupg/$key_name + fi +done if [ "$c_flag" ] then @@ -329,14 +323,9 @@ Codename: $dist Architectures: $tmp_out_arch Components: main Description: Repository automatically genereted conf +SignWith: yes __EOF__ - - if [ "$GPGSIGN" = "0" ];then - echo "GPGSIGN=$GPGSIGN specified, the repo will not be signed" - else - echo "SignWith: yes" >> conf/distributions - fi done cat << __EOF__ > conf/options @@ -455,16 +444,11 @@ Codename: $dist Architectures: $tmp_out_arch Components: main Description: Repository automatically genereted conf +SignWith: yes __EOF__ done - if [ "$GPGSIGN" = "0" ];then - echo "GPGSIGN=$GPGSIGN specified, the repo will not be signed" - else - echo "SignWith: yes" >> conf/distributions - fi - cat << __EOF__ > conf/options verbose ask-passphrase From 3c75e9cfae2ce5f868593743fa5079943f0893e1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 21 Jun 2017 13:23:54 -0400 Subject: [PATCH 043/283] Fix man page and usage for MPA rinv command --- .../admin-guides/references/man1/rinv.1.rst | 19 +++++++++---------- perl-xCAT/xCAT/Usage.pm | 6 ++---- xCAT-client/pods/man1/rinv.1.pod | 16 +++++++--------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rinv.1.rst b/docs/source/guides/admin-guides/references/man1/rinv.1.rst index f7202fae2..214b06e13 100644 --- a/docs/source/guides/admin-guides/references/man1/rinv.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rinv.1.rst @@ -25,7 +25,7 @@ BMC/MPA specific: ================= -\ **rinv**\ \ *noderange*\ {\ **pci | model | serial | asset | vpd | mprom | deviceid | guid | firm | diag | dimm | bios | mparom | mac | all**\ } +\ **rinv**\ \ *noderange*\ [\ **model | serial | asset | vpd | deviceid | guid | firm | dimm | mprom | all**\ ] OpenPOWER (IPMI) server specific: @@ -126,12 +126,6 @@ Calling \ **rinv**\ for VMware will display the UUID/GUID, number of CPUs, amou -\ **pci**\ - - Retrieves PCI bus information. - - - \ **bus**\ List all buses for each I/O slot. @@ -140,8 +134,7 @@ Calling \ **rinv**\ for VMware will display the UUID/GUID, number of CPUs, amou \ **config**\ - Retrieves number of processors, speed, total memory, and DIMM - locations. + Retrieves number of processors, speed, total memory, and DIMM locations. @@ -177,7 +170,7 @@ Calling \ **rinv**\ for VMware will display the UUID/GUID, number of CPUs, amou \ **asset**\ - Retrieves asset tag. Usually it's the MAC address of eth0. + Retrieves asset tag. Usually it's the MAC address of eth0. @@ -199,6 +192,12 @@ Calling \ **rinv**\ for VMware will display the UUID/GUID, number of CPUs, amou +\ **dimm**\ + + Retrieves dual in-line memory module information. + + + \ **deviceid**\ Retrieves device identification. Usually device, manufacturing and product IDs. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index a2c1c5864..b733daca9 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -95,14 +95,12 @@ my %usage = ( Common: rinv [all|model|serial] [-V|--verbose] rinv [-h|--help|-v|--version] - BMC specific: - rinv [mprom|deviceid|uuid|guid|vpd|dimm|all] + BMC/MPA specific: + rinv [model|serial|asset|vpd|deviceid|guid|firm|dimm|mprom|all] OpenPOWER (IPMI) server specific: rinv [model|serial|deviceid|uuid|guid|vpd|mprom|firm|all] OpenPOWER (OpenBMC) server specific: rinv [model|serial|firm|cpu|dimm|all] - MPA specific: - rinv [firm|bios|diag|mprom|sprom|mparom|mac|mtm] PPC specific(with HMC): rinv [all|bus|config|serial|model|firm] PPC specific(using Direct FSP Management): diff --git a/xCAT-client/pods/man1/rinv.1.pod b/xCAT-client/pods/man1/rinv.1.pod index e6fda9914..090194df1 100644 --- a/xCAT-client/pods/man1/rinv.1.pod +++ b/xCAT-client/pods/man1/rinv.1.pod @@ -8,7 +8,7 @@ B [B<-h>|B<--help>|B<-v>|B<--version>] =head2 BMC/MPA specific: -B I {B|B|B|B|B|B|B|B|B|B|B|B|B|B|B} +B I [B|B|B|B|B|B|B|B|B|B] =head2 OpenPOWER (IPMI) server specific: @@ -40,7 +40,6 @@ B I [B<-t>] B I - =head2 zVM specific: B I [B|B] @@ -78,18 +77,13 @@ Calling B for VMware will display the UUID/GUID, number of CPUs, amount of =over 7 -=item B - -Retrieves PCI bus information. - =item B List all buses for each I/O slot. =item B -Retrieves number of processors, speed, total memory, and DIMM -locations. +Retrieves number of processors, speed, total memory, and DIMM locations. =item B @@ -113,7 +107,7 @@ To output the raw information of deconfigured resources for CEC. =item B -Retrieves asset tag. Usually it's the MAC address of eth0. +Retrieves asset tag. Usually it's the MAC address of eth0. =item B @@ -127,6 +121,10 @@ Diagnostics information of firmware. Retrieves mprom firmware level. +=item B + +Retrieves dual in-line memory module information. + =item B Retrieves device identification. Usually device, manufacturing and product IDs. From aaa62e33337957f5fbef9e13b479b5c52fd69015 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 21 Jun 2017 22:26:48 -0400 Subject: [PATCH 044/283] Modified judging condition of openbmc in bmcdiscover, if not open enter bmcdiscover_ipmi --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index f1fb34b32..9cd5b02b7 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -587,18 +587,10 @@ sub scan_process { my $nmap_cmd = "nmap ${$live_ip}[$i] -p $openbmc_port -Pn"; my $nmap_output = xCAT::Utils->runcmd($nmap_cmd, -1); - if ($nmap_output =~ /$openbmc_port\/tcp (\w+)/) { - my $port_stat = $1; - if ($port_stat eq "open") { - bmcdiscovery_openbmc(${$live_ip}[$i], $opz, $opw, $request_command); - } else { - bmcdiscovery_ipmi(${$live_ip}[$i], $opz, $opw, $request_command); - } + if ($nmap_output =~ /$openbmc_port(.+)open/) { + bmcdiscovery_openbmc(${$live_ip}[$i], $opz, $opw, $request_command); } else { - my $rsp = {}; - push @{ $rsp->{data} }, "Can not get status of 2200 port for ip ${$live_ip}[$i].\n"; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); - exit 1; + bmcdiscovery_ipmi(${$live_ip}[$i], $opz, $opw, $request_command); } exit 0; From 0624deb5471245b90241dc28a7e6ce133f4be6a2 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 21 Jun 2017 22:52:01 -0400 Subject: [PATCH 045/283] correct typo in PR#3293 --- xCAT-server/share/xcat/netboot/sles/genimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index f3e80aaa8..0f914415e 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -615,7 +615,7 @@ if ((-d "$rootimg_dir/usr/share/dracut") or (-d "$rootimg_dir/usr/lib/dracut")) $dracutmode = 1; # get dracut version - $dracutver = `chroot $rootimg_dir rpm -qi dracut | awk '/Version/{print $3}' `; + $dracutver = `chroot $rootimg_dir rpm -qi dracut | awk '/Version/{print \$3}' `; chomp($dracutver); if ($dracutver =~ /^\d\d\d$/) { if ($dracutver >= "033") { From d97db29102fd893986f6ec9cbfa96124a10b161e Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 21 Jun 2017 22:59:38 -0400 Subject: [PATCH 046/283] Add a case confignetwork_s_installnic_secondarynic_updatenode --- xCAT-test/autotest/testcase/confignetwork/cases0 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index 1b36ff610..cf7a707a3 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -362,20 +362,15 @@ cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicne check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi -check:output=~11.1.0.100 -check:output=~MTU=1496 -check:output!~dhcp cmd:xdsh $$CN "cat /tmp/confignetwork_niccustomscript" check:rc==0 check:output=~hello cmd:xdsh $$CN "rm -rf /tmp/confignetwork_niccustomscript" check:rc==0 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi -check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 +cmd:rm -rf /tmp/script1 /install/postscripts/script1 end start:confignetwork_secondarynic_thirdnic_multiplevalue_updatenode @@ -440,9 +435,9 @@ end start:confignetwork_help description:this case is to verify if help information is provided -cmd:confignetworks -h +cmd:confignetwork -h check:rc==0 #TODO help information is printed -cmd:confignetworks --help +cmd:confignetwork --help check:rc==0 #TODO help information is printed From dde6ccdde89a472422e38720ac6d77d7fc223ed1 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 21 Jun 2017 23:02:58 -0400 Subject: [PATCH 047/283] update according to comments --- .../autotest/testcase/confignetwork/cases0 | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index cf7a707a3..dcdf442f3 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -146,6 +146,38 @@ cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC check:rc==0 end +start:confignetwork_s_installnic_secondarynic_updatenode +description: this case is to test confignetwork -s could configure installnic and secondarynic successfully with updatenode. +cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi +check:rc==0 +cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1496 +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 +check:rc==0 +cmd:updatenode $$CN -P "confignetwork -s" +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:output=~11.1.0.100 +check:output=~MTU=1496 +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +check:rc==0 +check:output=~__GETNODEATTR($$CN,ip)__ +check:output!~dhcp +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" +check:rc==0 +end + start:confignetwork_secondarynic_updatenode description: this case is to test confignetwork could configure secondarynic successfully with updatenode. cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi From b7236100397863768e42216bfdad38360487e820 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 22 Jun 2017 14:03:48 +0800 Subject: [PATCH 048/283] Add test cases for command nodeset for grub2/petitboot/yaboot (#3155) * Add test cases for command nodeset for grub2/petitboot/yaboot * Revise nodeset test cases and add more negative verifications * Revise nodeset test cases by add more verifications with makedhcp and getent * Temporary remove all dhcp lease checking from nodeset test cases, since it is rely on DNS service * Minor tweaks while doing unit tests --- xCAT-test/autotest/testcase/nodeset/cases0 | 167 +++++++++++++++++++-- 1 file changed, 155 insertions(+), 12 deletions(-) diff --git a/xCAT-test/autotest/testcase/nodeset/cases0 b/xCAT-test/autotest/testcase/nodeset/cases0 index d43f6ae66..84546a788 100644 --- a/xCAT-test/autotest/testcase/nodeset/cases0 +++ b/xCAT-test/autotest/testcase/nodeset/cases0 @@ -27,7 +27,6 @@ cmd:rmdef -t osimage -o "rhels7.5-ppc64-install-compute" cmd:noderm testnode1 end - start:nodeset_check_yaboot_yes os:rhels cmd:mkdef -t node -o testnode1 arch=ppc64 cons=hmc groups=lpar hcp=hmc1 hwtype=lpar id=1 ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=hmc monserver=10.1.1.1 nameservers=10.1.1.1 nodetype=ppc,osi parent=fsp1 pprofile=testnode1 profile=compute tftpserver=10.1.1.1 xcatmaster=10.1.1.1 @@ -173,29 +172,173 @@ check:output=~Warning: testnode1: petitboot might be invalid|testnode1 could not cmd:noderm testnode1 end -start:nodeset_addkcmdline -description: This case is to verify when netboot=xnba, addkcmdline is correctly supported. -cmd:mkdef -t node -o testnode1 arch=x86_64 cons=kvm groups=kvm ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=kvm monserver=10.1.1.1 nameservers=10.1.1.1 profile=compute tftpserver=10.1.1.1 xcatmaster=10.1.1.1 -os=__GETNODEATTR($$CN,os)__ +start:nodeset_xnba +description: Verify when xnba is used for OS loader, whether the configuration files under /tftpboot can be generated corrently +cmd:rmdef testnode1 +cmd:rm -f /tftpboot/xcat/xnba/nodes/testnode1 /tftpboot/xcat/xnba/nodes/testnode1.elilo +cmd:mkdef -t node -o testnode1 arch=x86_64 cons=kvm groups=kvm ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=kvm profile=compute os=rhels6.99 +check:rc==0 +cmd:cp -f /etc/hosts /etc/hosts.xcattestbak +cmd:echo "10.1.1.200 testnode1" >> /etc/hosts +check:rc==0 +cmd:chdef testnode1 netboot=xnba addkcmdline=debug +check:rc==0 +cmd:mkdef "rhels6.99-x86_64-install-compute" -u profile=compute provmethod=install osvers=rhels6.99 osarch=x86_64 +cmd:mkdir -p /install/rhels6.99/x86_64/images/pxeboot +cmd:echo blah >/install/rhels6.99/x86_64/images/pxeboot/vmlinuz +cmd:echo blah >/install/rhels6.99/x86_64/images/pxeboot/initrd.img +cmd:nodeset testnode1 osimage=rhels6.99-x86_64-install-compute +check:rc==0 +cmd:grep "debug" /tftpboot/xcat/xnba/nodes/testnode1 +check:rc==0 +cmd:grep "debug" /tftpboot/xcat/xnba/nodes/testnode1.elilo +check:rc==0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc==0 +cmd:nodeset testnode1 offline +check:rc==0 +cmd:grep "debug" /tftpboot/xcat/xnba/nodes/testnode1 +check:rc!=0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc!=0 +cmd:chdef -t node -o testnode1 ip= +check:rc==0 +cmd:cp -f /etc/hosts.xcattestbak /etc/hosts +cmd:getent hosts testnode1 | grep testnode1 +check:rc!=0 +cmd:nodeset testnode1 osimage=rhels6.99-x86_64-install-compute +check:rc!=0 +cmd:noderm testnode1 +cmd:rmdef -t osimage -o "rhels6.99-x86_64-install-compute" +cmd:rm -rf /install/rhels6.99 +end + +start:nodeset_grub2 +description: Verify when grub2 is used for OS loader, whether the configuration files under /tftpboot can be generated corrently +cmd:rmdef testnode1 +cmd:rm -f /tftpboot/boot/grub2/{testnode1,grub.cfg-{01-e6-d4-d2-3a-ad-06,0[aA]0101[cC]8}} +cmd:mkdef -t node -o testnode1 arch=ppc64 cons=hmc groups=lpar ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=hmc profile=compute os=rhels7.99 check:rc==0 cmd:cp -f /etc/hosts /etc/hosts.xcattestbak cmd:echo "10.1.1.200 testnode1" >> /etc/hosts cmd:makedns -n check:rc==0 -cmd:chdef testnode1 netboot=xnba addkcmdline=rd.break=pre-pivot +cmd:chdef testnode1 netboot=grub2 addkcmdline=debug check:rc==0 -cmd: mkdef "__GETNODEATTR($$CN,os)__-x86_64-install-compute" -u profile=compute provmethod=install osvers=__GETNODEATTR($$CN,os)__ +cmd:mkdef "rhels7.99-ppc64-install-compute" -u profile=compute provmethod=install osvers=rhels7.99 osarch=ppc64 +cmd:mkdir -p /install/rhels7.99/ppc64/ppc/ppc64 +cmd:echo blah >/install/rhels7.99/ppc64/ppc/ppc64/vmlinuz +cmd:echo blah >/install/rhels7.99/ppc64/ppc/ppc64/initrd.img +cmd:nodeset testnode1 osimage=rhels7.99-ppc64-install-compute check:rc==0 -cmd:nodeset testnode1 osimage=__GETNODEATTR($$CN,os)__-x86_64-install-compute +cmd:grep "debug" /tftpboot/boot/grub2/testnode1 check:rc==0 -cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1 +cmd:grep "debug" /tftpboot/boot/grub2/grub.cfg-01-e6-d4-d2-3a-ad-06 check:rc==0 -cmd:grep "rd.break=pre-pivot" /tftpboot/xcat/xnba/nodes/testnode1.elilo +cmd:grep "debug" /tftpboot/boot/grub2/grub.cfg-0[aA]0101[cC]8 +check:rc==0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc==0 +cmd:nodeset testnode1 offline +check:rc==0 +cmd:grep "debug" /tftpboot/boot/grub2/testnode1 +check:rc!=0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc!=0 +cmd:chdef -t node -o testnode1 ip= check:rc==0 -cmd:noderm testnode1 -cmd:rmdef -t osimage -o "__GETNODEATTR($$CN,os)__-x86_64-install-compute" cmd:cp -f /etc/hosts.xcattestbak /etc/hosts +cmd:getent hosts testnode1 | grep testnode1 +check:rc!=0 +cmd:nodeset testnode1 osimage=rhels7.99-ppc64-install-compute +check:rc!=0 +cmd:noderm testnode1 +cmd:rmdef -t osimage -o "rhels7.99-ppc64-install-compute" +cmd:rm -rf /install/rhels7.99 end + +start:nodeset_petitboot +description: Verify when petitboot is used for OS loader, whether the configuration files under /tftpboot can be generated corrently +cmd:rmdef testnode1 +cmd:rm -f /tftpboot/petitboot/testnode1 +cmd:mkdef -t node -o testnode1 arch=ppc64le cons=bmc groups=ipmi ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=ipmi profile=compute os=rhels7.99 +check:rc==0 +cmd:cp -f /etc/hosts /etc/hosts.xcattestbak +cmd:echo "10.1.1.200 testnode1" >> /etc/hosts +cmd:makedns -n +check:rc==0 +cmd:chdef testnode1 netboot=petitboot addkcmdline=debug +check:rc==0 +cmd:mkdef "rhels7.99-ppc64le-install-compute" -u profile=compute provmethod=install osvers=rhels7.99 osarch=ppc64le +cmd:mkdir -p /install/rhels7.99/ppc64le +cmd:mkdir -p /install/rhels7.99/ppc64le/ppc/ppc64le +cmd:echo blah >/install/rhels7.99/ppc64le/ppc/ppc64le/vmlinuz +cmd:echo blah >/install/rhels7.99/ppc64le/ppc/ppc64le/initrd.img +cmd:nodeset testnode1 osimage=rhels7.99-ppc64le-install-compute +check:rc==0 +cmd:grep "debug" /tftpboot/petitboot/testnode1 +check:rc==0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc==0 +cmd:nodeset testnode1 offline +check:rc==0 +cmd:grep "debug" /tftpboot/petitboot/testnode1 +check:rc!=0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc!=0 +cmd:chdef -t node -o testnode1 ip= +check:rc==0 +cmd:cp -f /etc/hosts.xcattestbak /etc/hosts +cmd:getent hosts testnode1 | grep testnode1 +check:rc!=0 +cmd:nodeset testnode1 osimage=rhels7.99-ppc64le-install-compute +check:rc!=0 +cmd:noderm testnode1 +cmd:rmdef -t osimage -o "rhels7.99-ppc64le-install-compute" +cmd:rm -rf /install/rhels7.99 +end + +start:nodeset_yaboot +description: Verify when yaboot is used for OS loader, whether the configuration files under /tftpboot can be generated corrently +cmd:rmdef testnode1 +cmd:rm -f /tftpboot/yaboot.conf-e6-d4-d2-3a-ad-06 +cmd:mkdef -t node -o testnode1 arch=ppc64 cons=hmc groups=lpar ip=10.1.1.200 mac=e6:d4:d2:3a:ad:06 mgt=hmc profile=compute os=rhels6.99 +check:rc==0 +cmd:cp -f /etc/hosts /etc/hosts.xcattestbak +cmd:echo "10.1.1.200 testnode1" >> /etc/hosts +cmd:makedns -n +check:rc==0 +cmd:chdef testnode1 netboot=yaboot addkcmdline=debug +check:rc==0 +cmd:mkdef "rhels6.99-ppc64-install-compute" -u profile=compute provmethod=install osvers=rhels6.99 osarch=ppc64 +cmd:mkdir -p /install/rhels6.99/ppc64/ppc/{chrp,ppc64} +cmd:echo blah >/install/rhels6.99/ppc64/ppc/ppc64/vmlinuz +cmd:echo blah >/install/rhels6.99/ppc64/ppc/ppc64/initrd.img +cmd:echo blah >/install/rhels6.99/ppc64/ppc/chrp/yaboot +cmd:nodeset testnode1 osimage=rhels6.99-ppc64-install-compute +check:rc==0 +cmd:grep "debug" /tftpboot/yaboot.conf-e6-d4-d2-3a-ad-06 +check:rc==0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc==0 +cmd:nodeset testnode1 offline +check:rc==0 +cmd:grep "debug" /tftpboot/yaboot.conf-e6-d4-d2-3a-ad-06 +check:rc!=0 +#cmd:makedhcp -q testnode1 | grep ^testnode1: +#check:rc!=0 +cmd:chdef -t node -o testnode1 ip= +check:rc==0 +cmd:cp -f /etc/hosts.xcattestbak /etc/hosts +cmd:getent hosts testnode1 | grep testnode1 +check:rc!=0 +cmd:nodeset testnode1 osimage=rhels6.99-ppc64-install-compute +check:rc!=0 +cmd:noderm testnode1 +cmd:rmdef -t osimage -o "rhels6.99-ppc64-install-compute" +cmd:rm -rf /install/rhels6.99 +end + start:nodeset_errorcommand description:This testcase is to very nodeset osimage errorcommand could give right output Attribute: $$CN-The operation object of nodeset command From 9f09aacb534ec83215ced7e125570e5a203ba286 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 22 Jun 2017 02:25:33 -0400 Subject: [PATCH 049/283] update installnic files location and MTU --- xCAT-test/autotest/testcase/confignetwork/cases0 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index dcdf442f3..a1ce6239c 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -31,7 +31,7 @@ check:output=~64 bytes from $$CN cmd:lsdef -l $$CN | grep status check:rc==0 check:output=~booted -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output!~dhcp @@ -78,7 +78,7 @@ check:output=~64 bytes from $$CN cmd:lsdef -l $$CN | grep status check:rc==0 check:output=~booted -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output!~dhcp @@ -154,7 +154,7 @@ cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1496 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 @@ -162,7 +162,6 @@ cmd:updatenode $$CN -P "confignetwork -s" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 -check:output=~MTU=1496 cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ @@ -194,6 +193,7 @@ cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep MTU /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep MTU /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep MTU /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~MTU=1496 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi @@ -228,10 +228,10 @@ check:output=~aliases1-1 check:output=~aliases1-2 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 check:output!~dhcp -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:output=~12.1.0.100 check:output!~dhcp cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 From 736725de210336aa20ea809f976ddc71f8c2e7fd Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 22 Jun 2017 04:52:23 -0400 Subject: [PATCH 050/283] fix 3242 --- xCAT-test/autotest/testcase/confignics/cases0 | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignics/cases0 b/xCAT-test/autotest/testcase/confignics/cases0 index a730ff864..9f3589d5f 100644 --- a/xCAT-test/autotest/testcase/confignics/cases0 +++ b/xCAT-test/autotest/testcase/confignics/cases0 @@ -149,45 +149,47 @@ start:confignics_config_multiple_port_withnicaliases_multiple_value description:confignics cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 -cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 -cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1501 +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 -cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1503 +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC mtu=1503 +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nicaliases.$$SECONDNIC="aliases1-1|aliases1-2" +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nicaliases.$$SECONDNIC="aliases1-1 aliases1-1-1|aliases1-2" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC|-$$SECONDNIC-1" check:rc==0 -cmd:chdef $$CN nicips.$$THIRDNIC="13.1.0.100|14.1.0.100" nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC="13_1_0_0-255_255_0_0|14_1_0_0-255_255_0_0" nicaliases.$$THIRDNIC="aliases2-1|aliases2-2" +cmd:chdef $$CN nicips.$$THIRDNIC="13.1.0.100|14.1.0.100" nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC="13_1_0_0-255_255_0_0|14_1_0_0-255_255_0_0" nicaliases.$$THIRDNIC="aliases2-1|aliases2-2" nichostnamesuffixes.$$THIRDNIC="-$$THIRDNIC|-$$THIRDNIC-1" check:rc==0 cmd:makehosts $$CN check:rc==0 -#cmd:cat /etc/hosts -#check:output=~aliases1-1 -#check:output=~aliases1-2 -#check:output=~aliases2-1 -#check:output=~aliases2-2 +cmd:cat /etc/hosts +check:output=~aliases1-1 +check:output=~aliases1-2 +check:output=~aliases2-1 +check:output=~aliases2-2 cmd:updatenode $$CN -P confignics check:rc==0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~11.1.0.100 check:output!~dhcp -output=~MTU=1501 -cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi check:output=~12.1.0.100 check:output!~dhcp cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi check:output=~13.1.0.100 check:output!~dhcp -output=~MTU=1503 -cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi check:output=~14.1.0.100 check:output!~dhcp cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 +cmd:ip addr del 11.1.0.100/16 dev $$SECONDNIC +cmd:ip addr del 12.1.0.100/16 dev $$SECONDNIC +cmd:ip addr del 13.1.0.100/16 dev $$THIRDNIC +cmd:ip addr del 14.1.0.100/16 dev $$THIRDNIC cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi From 0c74811424a4201447ea9cc7e53e73a57aed8c82 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 22 Jun 2017 05:17:35 -0400 Subject: [PATCH 051/283] polished --- xCAT-test/autotest/testcase/confignics/cases0 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignics/cases0 b/xCAT-test/autotest/testcase/confignics/cases0 index 9f3589d5f..0765fc90f 100644 --- a/xCAT-test/autotest/testcase/confignics/cases0 +++ b/xCAT-test/autotest/testcase/confignics/cases0 @@ -186,10 +186,6 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 -cmd:ip addr del 11.1.0.100/16 dev $$SECONDNIC -cmd:ip addr del 12.1.0.100/16 dev $$SECONDNIC -cmd:ip addr del 13.1.0.100/16 dev $$THIRDNIC -cmd:ip addr del 14.1.0.100/16 dev $$THIRDNIC cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi From 4456b5210558de2963b22627e14e20dfd416d822 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 22 Jun 2017 05:27:02 -0400 Subject: [PATCH 052/283] polished --- xCAT-test/autotest/testcase/confignics/cases0 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignics/cases0 b/xCAT-test/autotest/testcase/confignics/cases0 index 0765fc90f..c00b7676d 100644 --- a/xCAT-test/autotest/testcase/confignics/cases0 +++ b/xCAT-test/autotest/testcase/confignics/cases0 @@ -149,13 +149,13 @@ start:confignics_config_multiple_port_withnicaliases_multiple_value description:confignics cmd:lsdef $$CN;if [ $? -eq 0 ]; then lsdef -l $$CN -z >/tmp/CN.standa ;fi check:rc==0 -cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 -cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 -cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nicaliases.$$SECONDNIC="aliases1-1 aliases1-1-1|aliases1-2" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC|-$$SECONDNIC-1" check:rc==0 @@ -186,6 +186,10 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 +cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" +cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$SECONDNIC" +cmd:xdsh $$CN "ip addr del 13.1.0.100/16 dev $$THIRDNIC" +cmd:xdsh $$CN "ip addr del 14.1.0.100/16 dev $$THIRDNIC" cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi From 6ed46ff77f32042ccb45bc61c058e10f51a6678c Mon Sep 17 00:00:00 2001 From: yangsong Date: Thu, 22 Jun 2017 05:04:55 -0500 Subject: [PATCH 053/283] support service node pool (#3268) --- xCAT-server/lib/xcat/plugins/dhcp.pm | 6 ++-- xCAT-server/lib/xcat/plugins/grub2.pm | 41 ++++++++++++++++-------- xCAT-server/lib/xcat/plugins/networks.pm | 3 +- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 291a9b370..c30eceffd 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -502,7 +502,7 @@ sub addnode if ($nrhash) { $nrent = $nrhash->{$node}->[0]; - if ($nrent and $nrent->{tftpserver}) + if ($nrent and $nrent->{tftpserver} and $nrent->{tftpserver} ne '') { #check the value of inet_ntoa(inet_aton("")),if the hostname cannot be resolved, #the value of inet_ntoa() will be "undef", which will cause fatal error @@ -531,9 +531,7 @@ sub addnode my $node_server = undef; if ($nrent->{xcatmaster}) { $node_server = $nrent->{xcatmaster}; - } elsif ($nrent->{servicenode}) { - $node_server = $nrent->{servicenode}; - } + } unless ($node_server) { my @nxtsrvd = xCAT::NetworkUtils->my_ip_facing($node); unless ($nxtsrvd[0]) { $nxtsrv = $nxtsrvd[1]; } diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 14fa9702a..f6600d22c 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -218,21 +218,36 @@ sub setstate { } elsif (defined($nrhash{$node}->[0]) && $nrhash{$node}->[0]->{'xcatmaster'}) { $tftpserver = $nrhash{$node}->[0]->{'xcatmaster'}; } else { - my @master = xCAT::TableUtils->get_site_attribute("master"); - $tftpserver = $master[0]; - } - my $serverip; - if (defined($tftpserverip{$tftpserver})) { - $serverip = $tftpserverip{$tftpserver}; - } else { - $serverip = xCAT::NetworkUtils->getipaddr($tftpserver); - unless ($serverip) { - syslog("local1|err", "xCAT unable to resolve $tftpserver"); - return; - } - $tftpserverip{$tftpserver} = $serverip; + $tftpserver = ""; } + my $serverip; + + if($tftpserver eq ""){ + my @nxtsrvd = xCAT::NetworkUtils->my_ip_facing($node); + unless ($nxtsrvd[0]) { + $serverip = $nxtsrvd[1]; + } else { + $callback->({ error => [ $nxtsrvd[1] ], errorcode => [1] }); + return; + } + }else{ + if (defined($tftpserverip{$tftpserver})) { + $serverip = $tftpserverip{$tftpserver}; + } else { + $serverip = xCAT::NetworkUtils->getipaddr($tftpserver); + unless ($serverip) { + syslog("local1|err", "xCAT unable to resolve $tftpserver"); + return; + } + $tftpserverip{$tftpserver} = $serverip; + } + } + + unless($serverip){ + $callback->({ error => ["Unable to determine the tftpserver for $node"], errorcode => [1] }); + return; + } my $grub2protocol = "tftp"; if (defined($nrhash{$node}->[0]) && $nrhash{$node}->[0]->{'netboot'} && ($nrhash{$node}->[0]->{'netboot'} =~ /grub2-(.*)/)) { diff --git a/xCAT-server/lib/xcat/plugins/networks.pm b/xCAT-server/lib/xcat/plugins/networks.pm index 49f318854..cbbea2188 100644 --- a/xCAT-server/lib/xcat/plugins/networks.pm +++ b/xCAT-server/lib/xcat/plugins/networks.pm @@ -549,6 +549,7 @@ sub donets } } + my $tent=$nethash{$netname}; unless ($tent and $tent->{tftpserver}) { my $netdev = $ent[7]; @@ -577,7 +578,7 @@ sub donets push @{ $rsp->{data} }, " tftpserver=$ipaddr"; } else { if (!$foundmatch) { - $nettab->setAttribs({ 'net' => $net, 'mask' => $mask }, { tftpserver => $ipaddr }); + $nettab->setAttribs({ 'net' => $net, 'mask' => $mask }, { tftpserver => "" }); } } last; From eba16f3dd84b5acc1bbc7601482761d009fecc6c Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 22 Jun 2017 20:39:27 -0400 Subject: [PATCH 054/283] Found out that for Witherspoon machines, if the host has not been booted there is no system information returned, so check for the boxelder bmc for a model/serial combination to use --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index f1fb34b32..5fb0f8009 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -1054,6 +1054,7 @@ sub bmcdiscovery_openbmc{ my $openbmc_project_url = "xyz/openbmc_project"; my $login_endpoint = "login"; my $system_endpoint = "inventory/system"; + my $motherboard_boxelder_endpoint = "$system_endpoint/chassis/motherboard/boxelder/bmc"; my $node_data = $ip; my $brower = LWP::UserAgent->new( ssl_opts => { SSL_verify_mode => 0x00, verify_hostname => 0 }, ); @@ -1067,12 +1068,19 @@ sub bmcdiscovery_openbmc{ my $login_response = $brower->request($login_request); if ($login_response->is_success) { + # attempt to find the system serial/model $url = "$http_protocol://$ip/$openbmc_project_url/$system_endpoint"; my $req = HTTP::Request->new('GET', $url, $header); my $req_output = $brower->request($req); if ($req_output->is_error) { - xCAT::MsgUtils->message("W", { data => ["$ip: Could not obtain system information from BMC. Verify firmware levels are up-to-date."] }, $::CALLBACK); - return; + # If the host system has not yet been powered on, check the boxelder bmc info for model/serial + $url = "$http_protocol://$ip/$openbmc_project_url/$motherboard_boxelder_endpoint"; + $req = HTTP::Request->new('GET', $url, $header); + $req_output = $brower->request($req); + if ($req_output->is_error) { + xCAT::MsgUtils->message("W", { data => ["$ip: Could not obtain system information from BMC."] }, $::CALLBACK); + return; + } } my $response = decode_json $req_output->content; my $mtm; From 8e90e30bac13413997764fc927665a30b4951062 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 21 Jun 2017 12:39:53 -0400 Subject: [PATCH 055/283] Add verbose option to be parsed by rinv [openbmc] --- xCAT-server/lib/xcat/plugins/openbmc.pm | 26 ++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index cf9b9cc60..1fca69eb0 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -29,6 +29,7 @@ use xCAT::SvrUtils; use xCAT::GlobalDef; use xCAT_monitoring::monitorctrl; +$::VERBOSE = 0; # String constants for rpower states $::POWER_STATE_OFF="off"; $::POWER_STATE_ON="on"; @@ -409,16 +410,27 @@ sub parse_args { my $extrargs = shift; my $noderange = shift; my $check = undef; - + if (!defined($extrargs) and $command =~ /rpower|rsetboot|rspconfig|rflash/) { return ([ 1, "No option specified for $command" ]); } - if (scalar(@ARGV) > 1 and ($command =~ /rpower|rinv|rsetboot|rvitals/)) { + my $subcommand = undef; + if (scalar(@ARGV) > 2 and ($command =~ /rpower|rinv|rsetboot|rvitals/)) { return ([ 1, "Only one option is supported at the same time" ]); + } elsif (scalar(@ARGV) == 2) { + # Check if one is calling for Verbose output + foreach (@ARGV) { + if ($_ =~ /V|verbose/) { + $::VERBOSE=1; + } else { + $subcommand = $_ + } + } + } else { + $subcommand = $ARGV[0] } - my $subcommand = $ARGV[0]; if ($command eq "rpower") { unless ($subcommand =~ /^on$|^off$|^reset$|^boot$|^status$|^stat$|^state$/) { return ([ 1, "Unsupported command: $command $subcommand" ]); @@ -526,6 +538,14 @@ sub parse_command_status { $next_status{LOGIN_REQUEST} = "LOGIN_RESPONSE"; + my $verbose = undef; + unless (GetOptions( + 'V|verbose' => \$verbose, + )) { + xCAT::SvrUtils::sendmsg("Error parsing arguments.", $callback); + return 1; + } + if ($command eq "rpower") { $subcommand = $ARGV[0]; From b658a17af30ddc67c18bc64c7985fddee5e40ade Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 21 Jun 2017 13:23:24 -0400 Subject: [PATCH 056/283] Change the output of firm [openbmc] to more closely match the output of OPAL P8 machines when displaying the firmware. Use the ID to sort, but remove it when printing out the messages to the user --- xCAT-server/lib/xcat/plugins/openbmc.pm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 1fca69eb0..3c30b1407 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1083,30 +1083,27 @@ sub rinv_response { if ($grep_string eq "firm") { # This handles the data from the /xyz/openbmc_project/Software endpoint. - # - # Handle printing out all posssible Software values in a generic format: - # node: Software: () - # my $sw_id = (split(/\//, $key_url))[-1]; if (defined($content{Version}) and $content{Version}) { my $purpose_value = uc ((split(/\./, $content{Purpose}))[-1]); + $purpose_value = "[$sw_id]$purpose_value"; my $activation_value = (split(/\./, $content{Activation}))[-1]; # - # For 'rinv firm', only print Active software. 'rflash list' will handle others + # For 'rinv firm', only print Active software, unless verbose is specified # - if ($activation_value =~ "Active") { + if ($activation_value =~ "Active" or $::VERBOSE) { # - # The space below between "SOFTWARE:" and $content{Version} is intentional + # The space below between "Firmware Product Version:" and $content{Version} is intentional # to cause the sorting of this line before any additional info lines # - $content_info = "$purpose_value SOFTWARE[$sw_id]: $content{Version} ($activation_value)"; + $content_info = "$purpose_value Firmware Product: $content{Version} ($activation_value)"; push (@sorted_output, $content_info); if (defined($content{ExtendedVersion}) and $content{ExtendedVersion} ne "") { # ExtendedVersion is going to be a comma separated list of additional software my @versions = split(',', $content{ExtendedVersion}); foreach my $ver (@versions) { - $content_info = "$purpose_value SOFTWARE[$sw_id]: -- additional info: $ver"; + $content_info = "$purpose_value Firmware Product: -- additional info: $ver"; push (@sorted_output, $content_info); } } @@ -1149,7 +1146,14 @@ sub rinv_response { # sort alpha, then numeric my @sorted_output = grep {s/(^|\D)0+(\d)/$1$2/g,1} sort grep {s/(\d+)/sprintf"%06.6d",$1/ge,1} @sorted_output; - xCAT::SvrUtils::sendmsg("$_", $callback, $node) foreach (@sorted_output); + foreach (@sorted_output) { + # + # The firmware output requires the ID to be part of the string to sort correctly. + # Remove this ID from the output to the user + # + $_ =~ s/\[.*?\]//; + xCAT::SvrUtils::sendmsg("$_", $callback, $node); + } } else { xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node); } From 27607d7495382713bc2f57a14ad16613fc4fee6a Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 22 Jun 2017 20:55:52 -0400 Subject: [PATCH 057/283] Add verbose option to rinv for OpenBMC supported machines --- .../source/guides/admin-guides/references/man1/rinv.1.rst | 8 +++++++- perl-xCAT/xCAT/Usage.pm | 2 +- xCAT-client/pods/man1/rinv.1.pod | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rinv.1.rst b/docs/source/guides/admin-guides/references/man1/rinv.1.rst index 214b06e13..045866ae0 100644 --- a/docs/source/guides/admin-guides/references/man1/rinv.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rinv.1.rst @@ -39,7 +39,7 @@ OpenPOWER (OpenBMC) server specific: ==================================== -\ **rinv**\ \ *noderange*\ [\ **model | serial | firm | cpu | dimm | all**\ ] +\ **rinv**\ \ *noderange*\ [\ **model | serial | firm | cpu | dimm | all**\ ] [\ **-V | -**\ **-verbose**\ ] PPC (with HMC) specific: @@ -234,6 +234,12 @@ Calling \ **rinv**\ for VMware will display the UUID/GUID, number of CPUs, amou +\ **-V | -**\ **-verbose**\ + + Not supported for all managed machines. Prints verbose output. + + + \ **-t**\ Set the values in the vm table to what vCenter has for the indicated nodes. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index b733daca9..b0348dd53 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -100,7 +100,7 @@ my %usage = ( OpenPOWER (IPMI) server specific: rinv [model|serial|deviceid|uuid|guid|vpd|mprom|firm|all] OpenPOWER (OpenBMC) server specific: - rinv [model|serial|firm|cpu|dimm|all] + rinv [model|serial|firm|cpu|dimm|all] [-V|--verbose] PPC specific(with HMC): rinv [all|bus|config|serial|model|firm] PPC specific(using Direct FSP Management): diff --git a/xCAT-client/pods/man1/rinv.1.pod b/xCAT-client/pods/man1/rinv.1.pod index 090194df1..5b3e92665 100644 --- a/xCAT-client/pods/man1/rinv.1.pod +++ b/xCAT-client/pods/man1/rinv.1.pod @@ -16,7 +16,7 @@ B I [B|B|B|B|B|B|B I [B|B|B|B|B|B] +B I [B|B|B|B|B|B] [B<-V>|B<--verbose>] =head2 PPC (with HMC) specific: @@ -149,6 +149,10 @@ Print help. Print version. +=item B<-V>|B<--verbose> + +Not supported for all managed machines. Prints verbose output. + =item B<-t> Set the values in the vm table to what vCenter has for the indicated nodes. From c7aff42ca27605fdbd652db79183e67508a1e5a6 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 22 Jun 2017 21:00:43 -0400 Subject: [PATCH 058/283] Modify the description for verbose option in rinv --- docs/source/guides/admin-guides/references/man1/rinv.1.rst | 2 +- xCAT-client/pods/man1/rinv.1.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rinv.1.rst b/docs/source/guides/admin-guides/references/man1/rinv.1.rst index 045866ae0..d760fc576 100644 --- a/docs/source/guides/admin-guides/references/man1/rinv.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rinv.1.rst @@ -236,7 +236,7 @@ Calling \ **rinv**\ for VMware will display the UUID/GUID, number of CPUs, amou \ **-V | -**\ **-verbose**\ - Not supported for all managed machines. Prints verbose output. + Prints verbose output, if available. diff --git a/xCAT-client/pods/man1/rinv.1.pod b/xCAT-client/pods/man1/rinv.1.pod index 5b3e92665..52ed22ccc 100644 --- a/xCAT-client/pods/man1/rinv.1.pod +++ b/xCAT-client/pods/man1/rinv.1.pod @@ -151,7 +151,7 @@ Print version. =item B<-V>|B<--verbose> -Not supported for all managed machines. Prints verbose output. +Prints verbose output, if available. =item B<-t> From 65d882b9901f6b4346a610c05c6c68b847fc6bee Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 24 May 2017 04:40:43 -0400 Subject: [PATCH 059/283] add cumulus discover script --- perl-xCAT/xCAT/GlobalDef.pm | 4 + perl-xCAT/xCAT/data/switchinfo.pm | 45 ++++++ xCAT-server/lib/xcat/plugins/nodediscover.pm | 26 +++- .../lib/xcat/plugins/switchdiscover.pm | 49 +----- xCAT/postscripts/configinterface | 5 + xCAT/postscripts/cumulusztp | 145 ++++++++++++++++-- xCAT/postscripts/documulusdiscovery | 132 ++++++++++++++++ xCAT/postscripts/enablesnmp | 5 + xCAT/postscripts/getmypostscript.cumulus | 58 +++++++ 9 files changed, 410 insertions(+), 59 deletions(-) create mode 100644 perl-xCAT/xCAT/data/switchinfo.pm create mode 100755 xCAT/postscripts/documulusdiscovery create mode 100755 xCAT/postscripts/getmypostscript.cumulus diff --git a/perl-xCAT/xCAT/GlobalDef.pm b/perl-xCAT/xCAT/GlobalDef.pm index b953a5168..b9b99ea20 100644 --- a/perl-xCAT/xCAT/GlobalDef.pm +++ b/perl-xCAT/xCAT/GlobalDef.pm @@ -51,7 +51,9 @@ $::STATUS_BOOTED = "booted"; $::STATUS_POWERING_ON = "powering-on"; $::STATUS_POWERING_OFF = "powering-off"; $::STATUS_DISCOVERING = "discovering"; +$::STATUS_DISCOVERED = "discovered"; $::STATUS_CONFIGURING = "configuring"; +$::STATUS_CONFIGURED = "configured"; $::STATUS_STANDING_BY = "standingby"; $::STATUS_SHELL = "shell"; $::STATUS_DEFINED = "defined"; @@ -69,7 +71,9 @@ $::STATUS_BMCREADY = "bmcready"; $::STATUS_POWERING_ON => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_DISCOVERING => 1, + $::STATUS_DISCOVERED => 1, $::STATUS_CONFIGURING => 1, + $::STATUS_CONFIGURED => 1, $::STATUS_STANDING_BY => 1, $::STATUS_SHELL => 1, $::STATUS_DEFINED => 1, diff --git a/perl-xCAT/xCAT/data/switchinfo.pm b/perl-xCAT/xCAT/data/switchinfo.pm new file mode 100644 index 000000000..79c36abfa --- /dev/null +++ b/perl-xCAT/xCAT/data/switchinfo.pm @@ -0,0 +1,45 @@ +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html + +#This module includes some glocal table to look up the switch type via mac and vendor + +package xCAT::data::switchinfo; + +require Exporter; +@ISA = qw(Exporter); +@EXPORT = qw(); +@EXPORT_OK = qw(global_mac_identity global_switch_type); + +use strict; + +#the hash to look up switch type with MAC +our %global_mac_identity = ( + "a8:97:dc" => "BNT G8052 switch", + "6c:ae:8b" => "BNT G8264-T switch", + "fc:cf:62" => "BNT G8124 switch", + "7c:fe:90" => "Mellanox IB switch", + "cc:37:ab" => "Edgecore Networks Switch", + "8c:ea:1b" => "Edgecore Networks Switch" +); + +#the hash to lookup switch type with vendor +our %global_switch_type = ( + Juniper => "Juniper", + juniper => "Juniper", + Cisco => "Cisco", + cisco => "Cisco", + BNT => "BNT", + Blade => "BNT", + G8052 => "BNT", + RackSwitch => "BNT", + Mellanox => "Mellanox", + mellanox => "Mellanox", + MLNX => "Mellanox", + MELLAN => "Mellanox", + Cumulus => "onie", + cumulus => "onie", + Edgecore => "onie" +); + + + +1; diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index d9b9ada43..7188d8cc2 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -4,10 +4,8 @@ package xCAT_plugin::nodediscover; use xCAT::Table; use IO::Socket; use strict; - use XML::Simple; $XML::Simple::PREFERRED_PARSER = 'XML::Parser'; -use Data::Dumper; use POSIX "WNOHANG"; use Storable qw(freeze thaw); use IO::Select; @@ -15,7 +13,7 @@ use IO::Handle; use xCAT::Utils; use Sys::Syslog; use Text::Balanced qw(extract_bracketed); - +use xCAT::data::switchinfo; use xCAT::DiscoveryUtils; @@ -175,6 +173,7 @@ sub process_request { } } + # save inventory info into the hwinv table if (defined($request->{cpucount}) or defined($request->{cputype}) or defined($request->{memory}) or defined($request->{disksize})) { my $basicdata; @@ -232,15 +231,32 @@ sub process_request { if ($rent and $rent->{'netboot'}) { $currboot = $rent->{'netboot'}; } + if ($request->{arch}->[0] =~ /x86/ and $currboot !~ /pxe/ and $currboot !~ /xnba/) { $nrtab->setNodeAttribs($node, { netboot => 'xnba' }); } elsif ($request->{arch}->[0] =~ /ppc/ and $request->{platform}->[0] =~ /PowerNV/) { $nrtab->setNodeAttribs($node, { netboot => 'petitboot' }); } elsif ($request->{arch}->[0] =~ /ppc/ and $currboot !~ /yaboot/) { $nrtab->setNodeAttribs($node, { netboot => 'yaboot' }); + } elsif($request->{arch}->[0] =~ /armv7l/ and $currboot !~ /onie/) { + #for onie switch, the netboot should be "onie" + $nrtab->setNodeAttribs($node, { netboot => 'onie' }); } } + if(defined $request->{nodetype} and $request->{nodetype}->[0] = 'switch' and $request->{_xcat_clientmac}->[0]){ + #for onie switch, lookup and set the switchtype via mac of mgt interface + my $switchestab = xCAT::Table->new('switches'); + if ($switchestab) { + my $switchtype=$xCAT::data::switchinfo::global_mac_identity{substr(lc($request->{_xcat_clientmac}->[0]),0,8)}; + if(defined $switchtype){ + $switchestab->setNodeAttribs($node,{ switchtype => $switchtype }); + } + $switchestab->close(); + } + } + + my $macstring = ""; if (defined($request->{mac})) { my $mactab = xCAT::Table->new("mac", -create => 1); @@ -252,9 +268,11 @@ sub process_request { my $forcenic = 0; #-1 is force skip, 0 is use default behavior, 1 is force to be declared even if hosttag is skipped to do so foreach (@{ $request->{mac} }) { @ifinfo = split /\|/; + if ($ifinfo[1] eq 'usb0') { #skip usb nic next; } + $bydriverindex{ $ifinfo[0] } += 1; if (scalar @discoverynics) { $forcenic = -1; #$forcenic defaults to explicitly skip nic @@ -295,7 +313,7 @@ sub process_request { push @hostnames_to_update, $hosttag; } } - print Dumper($hosttag) . "\n"; + #print Dumper($hosttag) . "\n"; if ($hosttag) { $usednames{$hosttag} = 1; unless ($usednames_for_net{$netn}) { diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 168cf6ea8..70970480d 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -21,6 +21,7 @@ no strict; use Data::Dumper; use Socket; use Expect; +use xCAT::data::switchinfo; #global variables for this module my $community; @@ -33,42 +34,6 @@ my %global_scan_type = ( snmp => "snmp_scan" ); -my %global_mac_identity = ( - "a8:97:dc" => "BNT G8052 switch", - "6c:ae:8b" => "BNT G8264-T switch", - "fc:cf:62" => "BNT G8124 switch", - "7c:fe:90" => "Mellanox switch", - "e4:1d:2d" => "Mellanox switch", - "24:8a:07" => "Mellanox switch", - "00:25:8b" => "Mellanox switch", - "00:02:c9" => "Mellanox switch", - "f4:52:14" => "Mellanox switch", - "ec:0d:9a" => "Mellanox switch", - "cc:37:ab" => "Edgecore Networks Switch", - "a8:2b:b5" => "Edgecore Networks Switch", - "70:72:cf" => "Edgecore Networks Switch", - "8c:ea:1b" => "Edgecore Networks Switch" -); - -my %global_switch_type = ( - Juniper => "Juniper", - juniper => "Juniper", - Cisco => "Cisco", - cisco => "Cisco", - BNT => "BNT", - Blade => "BNT", - G8052 => "BNT", - RackSwitch => "BNT", - Mellanox => "Mellanox", - mellanox => "Mellanox", - MLNX => "Mellanox", - MELLAN => "Mellanox", - Cumulus => "onie", - cumulus => "onie", - Edgecore => "onie" -); - - #------------------------------------------------------------------------------- =head1 xCAT_plugin:switchdiscover @@ -748,16 +713,16 @@ sub nmap_scan { } my $vendor = $addr->{vendor}; if ($vendor) { - my $search_string = join '|', keys(%global_switch_type); + my $search_string = join '|', keys(%xCAT::data::switchinfo::global_switch_type); if ($vendor =~ /($search_string)/) { $found = 1; } } if ( ($found == 0) && ($type eq "mac") ) { - my $search_string = join '|', keys(%global_mac_identity); + my $search_string = join '|', keys(%xCAT::data::switchinfo::global_mac_identity); if ($mac =~ /($search_string)/i) { my $key = $1; - $vendor = $global_mac_identity{lc $key}; + $vendor = $xCAT::data::switchinfo::global_mac_identity{lc $key}; $found = 1; } @@ -851,7 +816,7 @@ sub nmap_osguess { last; } } - my $search_string = join '|', keys(%global_switch_type); + my $search_string = join '|', keys(%xCAT::data::switchinfo::global_switch_type); if ($line =~ /Running/) { if ($line =~ /($search_string)/){ $vendor = $1; @@ -1180,10 +1145,10 @@ sub get_switchtype { my $vendor = shift; my $key = "Not support"; - my $search_string = join '|', keys(%global_switch_type); + my $search_string = join '|', keys(%xCAT::data::switchinfo::global_switch_type); if ($vendor =~ /($search_string)/) { $key = $1; - return $global_switch_type{$key}; + return $xCAT::data::switchinfo::global_switch_type{$key}; } else { return $key; } diff --git a/xCAT/postscripts/configinterface b/xCAT/postscripts/configinterface index 40deeb269..53d9c720a 100755 --- a/xCAT/postscripts/configinterface +++ b/xCAT/postscripts/configinterface @@ -9,6 +9,11 @@ fi xcat_intf="/etc/network/interfaces.d/xCAT.intf" +if [ -f $xcat_intf ] && grep -w '#This is sample interface file provided by xCAT' $xcat_intf ; then + echo "The switch data ports and default brige have been configured. Do nothing..." + exit 0 +fi + echo "#This is sample interface file provided by xCAT" > $xcat_intf echo "# bridge-vlan-aware: set to yes to indicate that the bridge is VLAN-aware. " >> $xcat_intf echo "# bridge-access: declares the access port. " >> $xcat_intf diff --git a/xCAT/postscripts/cumulusztp b/xCAT/postscripts/cumulusztp index 311cdfdf1..d1403edeb 100755 --- a/xCAT/postscripts/cumulusztp +++ b/xCAT/postscripts/cumulusztp @@ -1,4 +1,7 @@ #!/bin/bash +#this script will be invoked by ZTP(zero touch provision) process in the onie switch +#this script finish the discovery and configuration after the switch is pluged in the cluster and powered on + function error() { echo -e "\e[0;33mERROR: The Zero Touch Provisioning script failed while running the command $BASH_COMMAND at line $BASH_LINENO.\e[0m" >&2 exit 1 @@ -7,28 +10,144 @@ function error() { # Log all output from this script exec >/var/log/autoprovision 2>&1 -trap error ERR +#trap error ERR #Add Debian Repositories -echo "deb http://http.us.debian.org/debian jessie main" >> /etc/apt/sources.list -echo "deb http://security.debian.org/ jessie/updates main" >> /etc/apt/sources.list +#since in most cases, the switch has no internet access, skip this step +#echo "deb http://http.us.debian.org/debian jessie main" >> /etc/apt/sources.list +#echo "deb http://security.debian.org/ jessie/updates main" >> /etc/apt/sources.list #get ip address for server node server_ip=`grep cumulus-provision-url /var/lib/dhcp/dhclient.eth0.leases | tail -1 | awk -F/ '{print $3}'` - + +#download /install/postscripts from MN +max_retries=5 +retry=0 +rc=1 # this is a fail return +downloaded=0 +while [ 0 -eq 0 ]; do + + if [ -e "/xcatpost" ]; then + rm -rf "/xcatpost" + fi + + export LANG=C; wget -l inf -nH -N -r --waitretry=10 --random-wait -e robots=off -T 60 -nH --cut-dirs=2 --reject "index.html*" --no-parent http://$server_ip/install/postscripts/ -P /xcatpost 2> /tmp/wget.log + rc=$? + if [ $rc -eq 0 ]; then + # return from wget was 0 but some OS do not return errors, so we + # have additional checks for + # failed: Connection httpd not running + # 404: Not Found - if directory does not exist + grep -i -E "... failed: Connection refused.$" /tmp/wget.log + rc1=$? + grep -i -E "ERROR 404: Not Found.$" /tmp/wget.log + rc2=$? + # check to see no errors at all, grep returns 1 + if [ $rc1 -eq 1 ] && [ $rc2 -eq 1 ]; then + logger -s -t "xcat.cumulusztp" -p local4.info "download_postscripts return successfully " + downloaded=1 + break + fi + fi + + retry=$(($retry+1)) + logger -s -t "xcat.cumulusztp" -p local4.info "download_postscripts retry $retry" + if [ $retry -eq $max_retries ]; then + + break + fi + + SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*20)}') + sleep $SLI +done + +if [ "$downloaded" = "0" ];then + logger -s -t "xcat.cumulusztp" -p local4.err "download_postscripts failed" + ztp -R + exit 1 +fi + +chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'` + +cd /xcatpost +rc=0 + +./documulusdiscovery +rc=$? +if [ "$rc" != "0" ];then + ztp -R + exit 1 +fi + +logger -s -t "xcat.cumulusztp" -p local4.info "switch discovered!" + +#restart mgt interface to apply the specified IP address +ifdown eth0;ifup eth0 + +retry=0 +while true; do + #check whether the network access between MN/CN and the node is ready + ping $server_ip -c 1 >/dev/null && break + retry=$[ $retry + 1 ] + if [ $retry -eq 90 ];then + #timeout, complain and exit + logger -s -t "xcat.cumulusztp" -p local4.err " the network between the node and $server_ip is not ready, please check[retry=$retry]..." "/var/log/xcat/xcat.log" + ztp -R + exit 1 + fi + + #sleep sometime before the next scan + sleep 2 +done + #push root ssh keys, config passwordless -echo "CumulusLinux!" | sudo -S mkdir -p /root/.ssh -echo "CumulusLinux!" | sudo -S /usr/bin/wget -O /root/.ssh/authorized_keys http://$server_ip/install/postscripts/_ssh/authorized_keys - +mkdir -p /root/.ssh +mv _ssh/authorized_keys /root/.ssh/authorized_keys + #enable and config snmpd -echo "CumulusLinux!" | sudo -S /usr/bin/wget -O /home/cumulus/enablesnmp http://$server_ip/install/postscripts/enablesnmp -sudo chmod +x /home/cumulus/enablesnmp -sudo /home/cumulus/enablesnmp +./enablesnmp +rc=$? +if [ "$rc" != "0" ];then + logger -s -t "xcat.cumulusztp" -p local4.err "enablesnmp: failed to enable SNMP" + echo "enablesnmp: failed to enable SNMP" +else + logger -s -t "xcat.cumulusztp" -p local4.info "SNMP enabled!" +fi #config base interface -echo "CumulusLinux!" | sudo -S /usr/bin/wget -O /home/cumulus/configinterface http://$server_ip/install/postscripts/configinterface -sudo chmod +x /home/cumulus/configinterface -sudo /home/cumulus/configinterface +./configinterface +rc=$? +if [ "$rc" != "0" ];then + echo "configinterface: failed to config switch data ports" +else + logger -s -t "xcat.cumulusztp" -p local4.info "data ports enabled!" +fi + +#obtain myposctscript from MN +./getmypostscript.cumulus $server_ip:3001 +rc=$? +if [ "$rc" != "0" ]; then + logger -s -t "xcat.cumulusztp" -p local4.info "failed to get mypostscript" + echo "failed to get mypostscript" + ztp -R + exit 1 +fi + +#config static ip address for mgt interface +echo './confignics -s' >> ./mypostscript +chmod +x ./mypostscript +./mypostscript +rc=$? +if [ "$rc" != "0" ]; then + logger -s -t "xcat.cumulusztp" -p local4.info "failed to set static ip address for mgt interface" + echo "failed to set static ip address for mgt interface" + ztp -R + exit 1 +fi + + +#report status +echo "installstatus configured" | socat STDIN TCP:$server_ip:3002,sourceport=301,reuseaddr,retry=5 # CUMULUS-AUTOPROVISIONING exit 0 diff --git a/xCAT/postscripts/documulusdiscovery b/xCAT/postscripts/documulusdiscovery new file mode 100755 index 000000000..a6f8bae60 --- /dev/null +++ b/xCAT/postscripts/documulusdiscovery @@ -0,0 +1,132 @@ +#!/bin/bash +#this script grabs the switch information, then composes a "findme" request and sends it to MN +#so that the switch can be discovered + +# TODO: Figure out the master based on the DHCP packet +XCATMASTER=$(cat /var/lib/dhcp/dhclient.eth0.leases |grep cumulus-provision-url|tail -1|awk -F/ '{print $3}') +XCATPORT=3001 +log_label="xcat.documulusdiscovery" + +#helper script for socat, write the received message to /tmp/helper.socat.sh +cat > /tmp/helper.socat.sh << 'EOF' +read strin +echo $strin > /tmp/result.socat.out +EOF + +[ -f "/tmp/helper.socat.sh" ] && chmod 777 /tmp/helper.socat.sh + +#listen to the 3001 port for any response from xcatd on MN +#the message in the response will be written to /tmp/result.socat.out +socat TCP4-LISTEN:3001,reuseaddr EXEC:"/tmp/helper.socat.sh" & + +#generate key pairs for the SSL connection between switch and xcatd on MN +mkdir -p /etc/xcat +mkdir -p /etc/pki/tls + +if [ ! -f /etc/xcat/privkey.pem ]; then +echo "[ req ] +distinguished_name = nodedn + +[ nodedn ]" > /etc/pki/tls/openssl.cnf + logger -s -t $log_label -p local4.info "Generating private key..." + openssl genrsa -out /etc/xcat/privkey.pem 1024 >& /dev/null + logger -s -t $log_label -p local4.info "Done" +fi + +PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout 2> /dev/null|grep -v "PUBLIC KEY"` +PUBKEY=`echo $PUBKEY|sed -e 's/ //g'` +export PUBKEY + +logger -s -t $log_label -p local4.info "Beginning switch discovery process..." + +#grab the switch information +dmidweinfo=$(/usr/sbin/dmidecode 2>/dev/null) +PRODUCTNAME=$(echo "$dmidweinfo"|grep "Product Name"|cut -d: -f2|sed -e 's/^\s*//' -e 's/\s*$//') +MTM=$PRODUCTNAME +ARCH=$(uname -m) +SERIAL=$(echo "$dmidweinfo"|grep "Serial Number"|cut -d: -f2|sed -e 's/^\s*//' -e 's/\s*$//') + +#compose the findme request +echo '' > /tmp/discopacket +echo "findme" >> /tmp/discopacket +echo "1" >> /tmp/discopacket +echo "switch" >> /tmp/discopacket +echo "$ARCH" >> /tmp/discopacket +#echo "$MTM" >> /tmp/discopacket +echo "$MTM" >> /tmp/discopacket +echo "$SERIAL" >> /tmp/discopacket + +MAC_OF_FIRST_UP_NIC=$(ip addr show eth0|grep "link/ether"|awk -F' ' '{print $2}') +MAC=$MAC_OF_FIRST_UP_NIC +ADDRESS=$(ip address show dev eth0|grep "inet "|grep global|awk '{print $2}') +DRIVER=$(grep DRIVER /sys/class/net/eth0/device/uevent|awk -F= '{print $2}') +echo "$DRIVER|eth0|$MAC|$ADDRESS" >> /tmp/discopacket + +UUID=`echo $MTM-$SERIAL-$MAC_OF_FIRST_UP_NIC| tr /A-Z/ /a-z/` +echo "$UUID" >> /tmp/discopacket + +echo "$PUBKEY" >> /tmp/discopacket +echo "" >> /tmp/discopacket +echo "" >> /tmp/discopacket +echo "" >> /tmp/discopacket +openssl dgst -sha512 -out /tmp/discopacket.sha512 -sign /etc/xcat/privkey.pem /tmp/discopacket +openssl enc -e -a -in /tmp/discopacket.sha512 > /tmp/discopacket.b64sig +cat /tmp/discopacket |while read line; do + if [ "$line" = "" ]; then + cat /tmp/discopacket.b64sig >> /tmp/discopacket.new + fi + echo $line >> /tmp/discopacket.new +done +mv /tmp/discopacket.new /tmp/discopacket +logger -s -t $log_label -p local4.info "Discovery packet file is ready." +rm -f /tmp/discopacket.gz +gzip -9 /tmp/discopacket + + + +if [ -z "$XCATMASTER" ] || [ -z "$XCATPORT" ]; then + logger -s -t $log_label -p local4.err "Failed to get xcatd connection information, exit..." + rm -rf /tmp/result.socat.out + rm -rf /tmp/helper.socat.sh + exit 1 +fi + + +#send the find me request ot xcatd on MN +MAX_RETRY=10 +RETRY=0 +DISCOVERED=0 + +while [ $RETRY -lt $MAX_RETRY ]; do + logger -s -t $log_label -p local4.info "Sending the discovery packet to xCAT ($XCATMASTER:$XCATPORT) [ RETRY= $RETRY ] ..." + (cat /tmp/discopacket.gz | socat STDIN UDP:$XCATMASTER:$XCATPORT,sourceport=301 ) & + + WAITRETRY=0 + while [ $WAITRETRY -lt 100 ]; do + if [ -f "/tmp/result.socat.out" ] && grep "restart" /tmp/result.socat.out; then + DISCOVERED=1 + break; + fi + sleep 1 + ((WAITRETRY=WAITRETRY+1)) + done + + if [ "$DISCOVERED" = "1" ]; then + break + fi + + sleep 2 + ((RETRY=RETRY+1)) +done + +rm -rf /tmp/result.socat.out +rm -rf /tmp/helper.socat.sh + +if [ "$DISCOVERED" = "0" ] ; then + logger -s -t $log_label -p local4.info "Failed to discover me, exit..." + exit 1 +elif [ "$DISCOVERED" = "1" ]; then + echo "installstatus discovered" | socat STDIN TCP:$XCATMASTER:3002,sourceport=301,reuseaddr,retry=5 +fi + +exit 0 diff --git a/xCAT/postscripts/enablesnmp b/xCAT/postscripts/enablesnmp index 2d4f2fd96..6f5661346 100755 --- a/xCAT/postscripts/enablesnmp +++ b/xCAT/postscripts/enablesnmp @@ -6,7 +6,12 @@ if ! cat /etc/os-release |grep -i '^NAME=[ "]*Cumulus Linux[ "]*$' >/dev/null 2 echo "This script is only supported on Cumulus OS in ONIE switch" exit 2 fi + snmp_conf="/etc/snmp/snmpd.conf" +if [ -f "$snmp_conf" ] && grep -w '#xCAT customized snmpd configuration' $snmp_conf;then + echo "The snmp has already been configured. Do nothing..." + exit 0 +fi [ -f "$snmp_conf" ] || exit -1 diff --git a/xCAT/postscripts/getmypostscript.cumulus b/xCAT/postscripts/getmypostscript.cumulus new file mode 100755 index 000000000..54a54d1d0 --- /dev/null +++ b/xCAT/postscripts/getmypostscript.cumulus @@ -0,0 +1,58 @@ +#!/bin/bash +#this script send getpostscript request to xcatd on MN and generate /xcatpost/mypostscript +#which includes the glocal environment variables to run postscripts + +if [ -z "$XCATDEST" ]; then + XCATDEST=$1 +fi + +#compose getpostscript request +echo " +getpostscript +" > /tmp/req.xml + + + +if [ -f /tmp/resp.xml ]; then + #remove any existing response file + rm /tmp/resp.xml; +fi + + +#communicate with xcatd on MN with getpostscript request +#the response will be saved in /tmp/resp.xml +while [ ! -f /tmp/resp.xml ] || grep error /tmp/resp.xml; do + if [ -f /tmp/resp.xml ]; then + timer=60 + while [ $timer -gt 0 ]; do + echo -en "Retrying in $timer seconds \r" >&2 + sleep 1 + timer=$(($timer-1)); + done + fi + #echo " " >&2 + if [ -f /etc/xcat/cert.pem -a -f /etc/xcat/certkey.pem ]; then #use client cert if available + cat /tmp/req.xml | /usr/bin/openssl s_client -key /etc/xcat/certkey.pem -cert /etc/xcat/cert.pem -connect $XCATDEST -quiet 2> /dev/null > /tmp/resp.xml + else + cat /tmp/req.xml | /usr/bin/openssl s_client -connect $XCATDEST -quiet 2>/dev/null > /tmp/resp.xml + fi +done + +if [ -f /tmp/resp.xml ] && grep '' /tmp/resp.xml >/dev/null 2>&1 ;then + echo "Success to obtain mypostscript!" +else + echo "Failed to obtain mypostscript!" + exit 1 +fi + +#parse the script from the xml-formated resposne +cat /tmp/resp.xml | 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 + +#the script specified in the "postscripts" and "postbootscripts" are currently not supported +#will be supported if there is requrement on this +sed -i -e "/# postscripts-start-here/,$ d" /xcatpost/mypostscript + +rm -f /tmp/req.xml +rm -f /tmp/resp.xml +exit 0 + From 32b467d635a3fe175405edc6c0cd4225638aef57 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 22 Jun 2017 22:29:20 -0400 Subject: [PATCH 060/283] Our p9 boxes do not have any VPD information, so in order to force the code to return a generated discovered definition, blank out the mtm string if XCAT_DEV_WITHERSPOON=TRUE --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 5fb0f8009..63da7ea97 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -83,6 +83,11 @@ sub process_request $::CALLBACK = $callback; #$::args = $request->{arg}; + if (ref($request->{environment}) eq 'ARRAY' and ref($request->{environment}->[0]->{XCAT_DEV_WITHERSPOON}) eq 'ARRAY') { + $::XCAT_DEV_WITHERSPOON = $request->{environment}->[0]->{XCAT_DEV_WITHERSPOON}->[0]; + } else { + $::XCAT_DEV_WITHERSPOON = $request->{environment}->{XCAT_DEV_WITHERSPOON}; + } unless (defined($request->{arg})) { bmcdiscovery_usage(); @@ -1089,6 +1094,10 @@ sub bmcdiscovery_openbmc{ if (defined($response->{data})) { if (defined($response->{data}->{Model}) and defined($response->{data}->{SerialNumber})) { $mtm = $response->{data}->{Model}; + if (defined($::XCAT_DEV_WITHERSPOON) && ($::XCAT_DEV_WITHERSPOON eq "TRUE")) { + print "XCAT_DEV_WITHERSPOON=TRUE, forcing MTM to blank string (ORIG MTM=$mtm)\n"; + $mtm = ""; + } $serial = $response->{data}->{SerialNumber}; } else { xCAT::MsgUtils->message("W", { data => ["Could not obtain Model Type and/or Serial Number for BMC at $ip"] }, $::CALLBACK); From bc46643b739302708a402986e876fa5aedf8b6ab Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 22 Jun 2017 23:08:15 -0400 Subject: [PATCH 061/283] Print the XCAT_DEV_WITHERSPOON bypass message out to the user --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 63da7ea97..fdf03b3b7 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -1095,7 +1095,7 @@ sub bmcdiscovery_openbmc{ if (defined($response->{data}->{Model}) and defined($response->{data}->{SerialNumber})) { $mtm = $response->{data}->{Model}; if (defined($::XCAT_DEV_WITHERSPOON) && ($::XCAT_DEV_WITHERSPOON eq "TRUE")) { - print "XCAT_DEV_WITHERSPOON=TRUE, forcing MTM to blank string (ORIG MTM=$mtm)\n"; + xCAT::MsgUtils->message("I", { data => ["XCAT_DEV_WITHERSPOON=TRUE, forcing MTM to empty string for $ip (Original MTM=$mtm)"] }, $::CALLBACK); $mtm = ""; } $serial = $response->{data}->{SerialNumber}; From d5290be6642849784b637bfba441375581eb4d05 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 22 Jun 2017 23:41:06 -0400 Subject: [PATCH 062/283] update according to comments --- .../autotest/testcase/confignetwork/cases0 | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index a1ce6239c..9267030af 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -31,7 +31,7 @@ check:output=~64 bytes from $$CN cmd:lsdef -l $$CN | grep status check:rc==0 check:output=~booted -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output!~dhcp @@ -78,7 +78,7 @@ check:output=~64 bytes from $$CN cmd:lsdef -l $$CN | grep status check:rc==0 check:output=~booted -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output!~dhcp @@ -130,17 +130,18 @@ check:output=~64 bytes from $$CN cmd:lsdef -l $$CN | grep status check:rc==0 check:output=~booted -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output!~dhcp -cmd:secondarynic=`xdsh $$CN ip addr |grep 100.1.0.100|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep 100.1.0.100 /etc/sysconfig/network/ifcfg-$secondarynic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 100.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$secondarynic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 100.1.0.100 /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:secondarynic=`xdsh $$CN ip addr |grep 100.1.0.100|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$secondarynic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$secondarynic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~100.1.0.100 check:output!~dhcp cmd:chdef -m -t node $$CN postbootscripts="confignetwork -s" check:rc==0 cmd:if [ -d $rootimgdir.regbak ]; then mv $rootimgdir.regbak $rootimgdir -f;fi +cmd:xdsh $$CN "ip addr del 100.1.0.100/16 dev $$SECONDNIC" cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= check:rc==0 @@ -162,11 +163,12 @@ cmd:updatenode $$CN -P "confignetwork -s" check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output!~dhcp cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi @@ -195,6 +197,7 @@ cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/ne check:output=~11.1.0.100 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep MTU /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep MTU /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep MTU /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~MTU=1496 +cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 @@ -219,23 +222,25 @@ cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtif check:rc==0 cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 -cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nicaliases.$$SECONDNIC="aliases1-1|aliases1-2" +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nicaliases.$$SECONDNIC="aliases1-1 aliases1-1-1|aliases1-2" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC|-$$SECONDNIC-1" check:rc==0 cmd:makehosts $$CN check:rc==0 cmd:cat /etc/hosts -check:output=~aliases1-1 +check:output=~aliases1-1 aliases1-1-1 check:output=~aliases1-2 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 check:output!~dhcp -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:output=~12.1.0.100 check:output!~dhcp cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 +cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" +cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$SECONDNIC" cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -f /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi @@ -269,10 +274,10 @@ check:output=~$$CN-$$SECONDNIC-1 check:output=~$$CN-$$SECONDNIC-2 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 check:output!~dhcp -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi check:output=~12.1.0.100 check:output=~CONNECTED_MODE=yes check:output!~dhcp @@ -280,6 +285,8 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -f /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi check:rc==0 +cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" +cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$SECONDNIC" cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 cmd:mv -f /etc/hosts.bak /etc/hosts @@ -349,7 +356,7 @@ check:rc==0 cmd:chtab node=$$CN nics.disable=yes check:rc==0 cmd:updatenode $$CN -P confignetwork -check:rc==0 +check:rc==1 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output!~11.1.0.100 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 @@ -369,7 +376,7 @@ check:rc==0 cmd:chtab node=$$CN nics.disable=1 check:rc==0 cmd:updatenode $$CN -P confignetwork -check:rc==0 +check:rc==1 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output!~11.1.0.100 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 @@ -438,16 +445,12 @@ cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 -check:output!~dhcp cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi check:output=~12.1.0.100 -check:output!~dhcp cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 13.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 13.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 13.1.0.100 /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi check:output=~13.1.0.100 -check:output!~dhcp cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/network/interfaces.d/$$THIRDNIC:1";else echo "Sorry,this is not supported os"; fi check:output=~14.1.0.100 -check:output!~dhcp cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 @@ -456,6 +459,10 @@ cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifc check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC:1"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC /etc/network/interfaces.d/$$THIRDNIC:1";else echo "Sorry,this is not supported os"; fi check:rc==0 +cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" +cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$SECONDNIC" +cmd:xdsh $$CN "ip addr del 13.1.0.100/16 dev $$THIRDNIC" +cmd:xdsh $$CN "ip addr del 14.1.0.100/16 dev $$THIRDNIC" cmd:if [ -e /tmp/CN.standa ]; then rmdef $$CN; cat /tmp/CN.standa | mkdef -z; rm -rf /tmp/CN.standa; fi check:rc==0 cmd:mv -f /etc/hosts.bak /etc/hosts @@ -464,12 +471,3 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" check:rc==0 end - -start:confignetwork_help -description:this case is to verify if help information is provided -cmd:confignetwork -h -check:rc==0 -#TODO help information is printed -cmd:confignetwork --help -check:rc==0 -#TODO help information is printed From 0e879470def003a08f5827f198e597141028c216 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 23 Jun 2017 00:05:47 -0400 Subject: [PATCH 063/283] update the return code --- xCAT-test/autotest/testcase/confignetwork/cases0 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index 9267030af..7800598c2 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -337,7 +337,7 @@ check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork -check:rc!=0 +check:rc==0 #TODO check the error message cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 check:rc==0 @@ -356,7 +356,7 @@ check:rc==0 cmd:chtab node=$$CN nics.disable=yes check:rc==0 cmd:updatenode $$CN -P confignetwork -check:rc==1 +check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output!~11.1.0.100 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 @@ -376,7 +376,7 @@ check:rc==0 cmd:chtab node=$$CN nics.disable=1 check:rc==0 cmd:updatenode $$CN -P confignetwork -check:rc==1 +check:rc==0 cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output!~11.1.0.100 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 From 62d503797525ced1e6e368a30d5e2e0c884dd813 Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 22 Jun 2017 03:47:57 -0400 Subject: [PATCH 064/283] Format the ouput of getadapter result This patch format the result of getadapter command and update the man page to notice that `getadapter` will boot into genesis. Fix-issue: #3046 --- .../references/man1/getadapter.1.rst | 30 ++++++++++++++-- xCAT-client/pods/man1/getadapter.1.pod | 29 +++++++++++----- xCAT-server/lib/xcat/plugins/getadapter.pm | 34 ++++++++++++------- 3 files changed, 69 insertions(+), 24 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/getadapter.1.rst b/docs/source/guides/admin-guides/references/man1/getadapter.1.rst index 982fcd4c3..316f4bcea 100644 --- a/docs/source/guides/admin-guides/references/man1/getadapter.1.rst +++ b/docs/source/guides/admin-guides/references/man1/getadapter.1.rst @@ -31,7 +31,7 @@ DESCRIPTION Traditionally, network interfaces in Linux are enumerated as eth[0123...], but these names do not necessarily correspond to actual labels on the chassis. \ **getadapter**\ help customer to get predictable network device name and some other network adapter information before provision or network configuration. -\ **getadapter**\ use genesis to collect network adapters information, so that mean it need to restart the target node. +\ **Since getadpter uses genesis to collect network adapters information, the target node will be restarted.**\ \ **getadapter**\ For each node within the , follows below scheme: @@ -41,16 +41,42 @@ If user hopes to scan the adapter information for the node but these information \ **getadapter**\ tries to collect more information for the target network device, but doesn't guarantee collect same much information for every network device. -Below are the possible information can be collect up to now: + +****************************** +\ **Collected information:**\ +****************************** + + + \ **name**\ : the consistent name which can be used by confignic directly in operating system which follow the same naming scheme with rhels7 + + + \ **pci**\ : the pci location + + + \ **mac**\ : the MAC address + + + \ **candidatename**\ : All the names which satisfy predictable network device naming scheme. \ *(if xcat enhance confignic command later, user can use these names to configure their network adapter, even customize their name)*\ + + + \ **vender**\ : the vender of network device + + + \ **model**\ : the model of network device + + + \ **linkstate**\ : the link state of network device + + ******* OPTIONS ******* diff --git a/xCAT-client/pods/man1/getadapter.1.pod b/xCAT-client/pods/man1/getadapter.1.pod index d9e43c6e9..0bdb93c42 100644 --- a/xCAT-client/pods/man1/getadapter.1.pod +++ b/xCAT-client/pods/man1/getadapter.1.pod @@ -12,7 +12,7 @@ B [B<-h>|B<--help>|B<-v>|B<--version>|B<-V>] Traditionally, network interfaces in Linux are enumerated as eth[0123...], but these names do not necessarily correspond to actual labels on the chassis. B help customer to get predictable network device name and some other network adapter information before provision or network configuration. -B use genesis to collect network adapters information, so that mean it need to restart the target node. +B B For each node within the , follows below scheme: @@ -22,14 +22,25 @@ If user hopes to scan the adapter information for the node but these information B tries to collect more information for the target network device, but doesn't guarantee collect same much information for every network device. -Below are the possible information can be collect up to now: -B: the consistent name which can be used by confignic directly in operating system which follow the same naming scheme with rhels7 -B: the pci location -B: the MAC address -B: All the names which satisfy predictable network device naming scheme. I<(if xcat enhance confignic command later, user can use these names to configure their network adapter, even customize their name)> -B: the vender of network device -B: the model of network device -B: the link state of network device +=head1 B + +=over 2 + +=item B: the consistent name which can be used by confignic directly in operating system which follow the same naming scheme with rhels7 + +=item B: the pci location + +=item B: the MAC address + +=item B: All the names which satisfy predictable network device naming scheme. I<(if xcat enhance confignic command later, user can use these names to configure their network adapter, even customize their name)> + +=item B: the vender of network device + +=item B: the model of network device + +=item B: the link state of network device + +=back =head1 OPTIONS diff --git a/xCAT-server/lib/xcat/plugins/getadapter.pm b/xCAT-server/lib/xcat/plugins/getadapter.pm index 19edc1817..3cdbe5bff 100644 --- a/xCAT-server/lib/xcat/plugins/getadapter.pm +++ b/xCAT-server/lib/xcat/plugins/getadapter.pm @@ -122,8 +122,8 @@ sub route_request { my $command = $request->{command}->[0]; my $ret = xCAT::State->REQUEST_ERROR; - if (scalar(@{ $request->{node} }) == 0) { - return $ret; + if (!$request->{node}) { + return xCAT::State->REQUEST_WAIT; } my $build_request_message_func = sub { @@ -404,7 +404,7 @@ sub update_adapter_result { $interface_exists = 0; if (exists($msg->{nic}->[$i]->{interface})) { - $output .= $msg->{nic}->[$i]->{interface}; + $output .= $msg->{nic}->[$i]->{interface}."!"; if ($has_nic) { $data .= "," . $msg->{nic}->[$i]->{interface} . "!"; } @@ -414,38 +414,46 @@ sub update_adapter_result { $interface_exists = 1; $has_nic = 1; } + my @nic_attrs = (); + my @output_attrs = (); if (exists($msg->{nic}->[$i]->{mac})) { - $output .= "!mac=" . $msg->{nic}->[$i]->{mac}; + push(@output_attrs, "mac=" . $msg->{nic}->[$i]->{mac}); if ($interface_exists) { - $data .= " mac=" . $msg->{nic}->[$i]->{mac}; + push(@nic_attrs, "mac=" . $msg->{nic}->[$i]->{mac}); } } if (exists($msg->{nic}->[$i]->{pcilocation})) { - $output .= "|pci=" . $msg->{nic}->[$i]->{pcilocation}; + push(@output_attrs, "pci=" . $msg->{nic}->[$i]->{pcilocation}); if ($interface_exists) { - $data .= "pci=" . $msg->{nic}->[$i]->{pcilocation}; + push(@nic_attrs, "pci=" . $msg->{nic}->[$i]->{pcilocation}); } } if (exists($msg->{nic}->[$i]->{predictablename})) { - $output .= "|candidatename=" . $msg->{nic}->[$i]->{predictablename}; + push(@output_attrs, "candidatename=" . $msg->{nic}->[$i]->{predictablename}); } if (exists($msg->{nic}->[$i]->{vendor})) { - $output .= "|vendor=" . $msg->{nic}->[$i]->{vendor}; + $msg->{nic}->[$i]->{vendor} =~ s/^\s+|\s+$//g; + push(@output_attrs, "vendor=" . $msg->{nic}->[$i]->{vendor}); } if (exists($msg->{nic}->[$i]->{model})) { - $output .= "|model=" . $msg->{nic}->[$i]->{model}; + $msg->{nic}->[$i]->{model} =~ s/^\s+|\s+$//g; + push(@output_attrs, "model=" . $msg->{nic}->[$i]->{model}); } if (exists($msg->{nic}->[$i]->{linkstate})) { - $output .= "|linkstate=" . $msg->{nic}->[$i]->{linkstate}; + push(@output_attrs, "linkstate=" . (split(' ', $msg->{nic}->[$i]->{linkstate}))[0]); if ($interface_exists) { - $data .= " linkstate=" . $msg->{nic}->[$i]->{linkstate}; + push(@nic_attrs, "linkstate=". (split(' ', $msg->{nic}->[$i]->{linkstate}))[0]); } } + if (@nic_attrs) { + $data .= join(" ", @nic_attrs); + } + $output .= join("|", @output_attrs); $output .= "\n"; } $callback->({ data => "$output" }); if (!$has_nic) { - $callback->({ data => "$node: nics talbe will not be updated as not any ". + $callback->({ data => "$node: nics table will not be updated as not any ". "useful information could be found with udevadm command." }); return 0; } From 5cd9b632a18faabb540f722fba86488019afe629 Mon Sep 17 00:00:00 2001 From: Yuan Bai Date: Fri, 23 Jun 2017 14:45:13 +0800 Subject: [PATCH 065/283] refine new confignetwork framework to use configeth (#3302) * new confignetwork framework to use configeth, it will be finally to replace confignics. * updated based on comments --- xCAT/postscripts/configeth | 43 +++---- xCAT/postscripts/confignetwork | 218 ++++++++++++++++++++++++++++----- 2 files changed, 209 insertions(+), 52 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index 51631a977..fd53c5dc9 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -6,6 +6,7 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then str_dir_name=`dirname $0` . $str_dir_name/xcatlib.sh + . $str_dir_name/nicutils.sh fi function configipv4(){ @@ -354,16 +355,16 @@ fi logger -t xcat -p local4.err "configeth: os type: $str_os_type" -echo "configeth on $NODE: os type: $str_os_type" +log_info "configeth on $NODE: os type: $str_os_type" if [ "$1" = "-r" ];then if [ $# -ne 2 ];then logger -t xcat -p local4.err "configeth: remove nic, but the nic name is missed" - echo "configeth on $NODE: remove nic, but the nic name is missed" + log_error "configeth on $NODE: remove nic, but the nic name is missed" exit 1 fi str_nic_name=$2 logger -t xcat -p local4.err "configeth: remove nic $str_nic_name" - echo "configeth on $NODE: remove nic $str_nic_name" + log_info "configeth on $NODE: remove nic $str_nic_name" if [ "$str_os_type" = "aix" ];then old_ifs=$IFS @@ -392,7 +393,7 @@ if [ "$1" = "-r" ];then fi done logger -t xcat -p local4.err "configeth run command: chdev -l $str_nic_name -a netaddr='' -a netmask='' -a netaddr6='' -a prefixlen='' -a state=down" - echo "configeth on $NODE run command: chdev -l $str_nic_name -a netaddr='' -a netmask='' -a netaddr6='' -a prefixlen='' -a state=down" + log_info "configeth on $NODE run command: chdev -l $str_nic_name -a netaddr='' -a netmask='' -a netaddr6='' -a prefixlen='' -a state=down" chdev -l $str_nic_name -a netaddr='' -a netmask='' -a netaddr6='' -a prefixlen='' -a state=down else #shut down the nic if it is on @@ -412,7 +413,7 @@ if [ "$1" = "-r" ];then elif [ "$1" = "-s" ];then if [ $# -lt 2 ];then logger -t xcat -p local4.err "configeth: config install nic, but the nic name is missed" - echo "configeth on $NODE: config install nic, but the nic name is missed" + log_error "configeth on $NODE: config install nic, but the nic name is missed" exit 1 fi str_inst_nic=$2 @@ -423,8 +424,8 @@ elif [ "$1" = "-s" ];then if [ "$str_os_type" = "aix" ];then logger -t xcat -p local4.err "configeth: aix does not support -s flag" - echo "configeth on $NODE: aix does not support -s flag" - exit 0 + log_error "configeth on $NODE: aix does not support -s flag" + exit 1 elif [ -f "/etc/debian_version" ];then str_lease_file="/var/lib/dhcp/dhclient."$str_inst_nic".leases" if [ -e "$str_lease_file" ];then @@ -502,7 +503,7 @@ elif [ "$1" = "-s" ];then if [ -z "$str_inst_ip" -o -z "$str_inst_mask" ];then logger -t xcat -p local4.err "configeth: config install nic, can not find the information from lease file, return." - echo "configeth on $NODE: config install nic, can not find information from dhcp lease file, return." + log_info "configeth on $NODE: config install nic, can not find information from dhcp lease file, return." exit 0 fi @@ -648,7 +649,7 @@ fi #3. on linux modify the configuration files if [ $# -ne 3 ];then logger -t xcat -p local4.err "configeth: paramters error currently is $@" - echo "configeth on $NODE: paramters error currently is $@" + log_error "configeth on $NODE: paramters error currently is $@" exit 1 fi str_nic_name=$1 @@ -706,7 +707,7 @@ while [ $num_index -le $NETWORKS_LINES ];do done logger -t xcat -p local4.err "configeth: new configuration" -echo "configeth on $NODE: new configuration" +log_info "configeth on $NODE: new configuration" num_index=0 str_ipv6_gateway='' while [ $num_index -lt ${#array_nic_ips[*]} ];do @@ -715,7 +716,7 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do str_netname=${array_nic_networks[$num_index]} if [ ! $str_netname ];then logger -t xcat -p local4.err "configeth: Network name is not defined on $str_nic_name for $str_ip." - echo "configeth on $NODE: Network name is not defined on $str_nic_name for $str_ip." + log_error "configeth on $NODE: Network name is not defined on $str_nic_name for $str_ip." num_index=$((num_index+1)) continue fi @@ -724,7 +725,7 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do str_line=${array_nic_network_config[$num_index]} if [ ! $str_line ];then logger -t xcat -p local4.err "configeth: Network object $str_netname is not defined." - echo "configeth on $NODE: Network object $str_netname is not defined." + log_error "configeth on $NODE: Network object $str_netname is not defined." num_index=$((num_index+1)) continue fi @@ -737,7 +738,7 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do if [ ! $str_subnet -o ! $str_netmask ];then logger -t xcat -p local4.err "configeth: subnet or netmask is not defined in network object $str_netname." - echo "configeth on $NODE: subnet or netmask is not defined in network object $str_netname." + log_error "configeth on $NODE: subnet or netmask is not defined in network object $str_netname." num_index=$((num_index+1)) continue fi @@ -768,7 +769,7 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do str_ip_mask_pair=$str_ip_mask_pair"${str_ip}_${str_netmask} " else logger -t xcat -p local4.err "configeth: the ipaddress( $str_ip ) for $str_nic_name is invalid." - echo "configeth on $NODE: the ipaddress( $str_ip ) for $str_nic_name is invalid." + log_error "configeth on $NODE: the ipaddress( $str_ip ) for $str_nic_name is invalid." fi num_index=$((num_index+1)) done @@ -788,7 +789,7 @@ if [ "$str_os_type" = "aix" ];then else chdev -l $str_nic_name -a netaddr='' -a netmask='' logger -t xcat -p local4.err "configeth: delete undefined ip address $str_old_ip" - echo "configeth on $NODE: delete undefined ip address $str_old_ip" + log_error "configeth on $NODE: delete undefined ip address $str_old_ip" fi fi @@ -856,7 +857,7 @@ if [ "$str_os_type" = "aix" ];then str_ip_status=$(hashget hash_new_config $str_new_ip) if [ "$str_ip_status" = "new" ];then logger -t xcat -p local4.err "configeth: add $str_new_ip for $str_nic_name temporary." - echo "configeth on $NODE: add $str_new_ip for $str_nic_name temporary." + log_info "configeth on $NODE: add $str_new_ip for $str_nic_name temporary." add_ip_temporary $str_new_ip $str_nic_name fi done @@ -891,7 +892,7 @@ else else bool_modify_flag=1 logger -t xcat -p local4.err "configeth: delete $str_old_ip for $str_nic_name temporary." - echo "configeth on $NODE: delete $str_old_ip for $str_nic_name temporary." + log_info "configeth on $NODE: delete $str_old_ip for $str_nic_name temporary." str_old_ip=`echo $str_old_ip | tr '_' '/'` ip addr del $str_old_ip dev $str_nic_name fi @@ -929,7 +930,7 @@ else bool_modify_flag=1 if [ $bool_restart_flag -eq 0 ];then logger -t xcat -p local4.err "configeth: add $str_new_ip for $str_nic_name temporary." - echo "configeth on $NODE: add $str_new_ip for $str_nic_name temporary." + log_info "configeth on $NODE: add $str_new_ip for $str_nic_name temporary." add_ip_temporary $str_new_ip $str_nic_name fi fi @@ -940,7 +941,7 @@ else ip -6 route | grep default | grep $str_ipv6_gateway if [ $? -ne 0 ];then logger -t xcat -p local4.err "configeth: the default ipv6 route changes to $str_ipv6_gateway." - echo "configeth on $NODE: the default ipv6 route changes to $str_ipv6_gateway." + log_info "configeth on $NODE: the default ipv6 route changes to $str_ipv6_gateway." ip -6 route del default ip -6 route add default $str_ipv6_gateway dev $str_dev_name fi @@ -963,7 +964,7 @@ else done fi logger -t xcat -p local4.err "configeth: $str_nic_name changed, modify the configuration files" - echo "configeth on $NODE: $str_nic_name changed, modify the configuration files" + log_info "configeth on $NODE: $str_nic_name changed, modify the configuration files" num_ipv4_index=0 num_ipv6_index=0 num_index=0 @@ -1020,7 +1021,7 @@ else done else logger -t xcat -p local4.err "configeth: $str_nic_name no changed, return directly." - echo "configeth on $NODE: $str_nic_name no changed, return directly." + log_warn "configeth on $NODE: $str_nic_name no changed, return directly." fi #restart the nic diff --git a/xCAT/postscripts/confignetwork b/xCAT/postscripts/confignetwork index 80ef76c1a..bb0a90cec 100755 --- a/xCAT/postscripts/confignetwork +++ b/xCAT/postscripts/confignetwork @@ -1,12 +1,16 @@ -#!/bin/bash +#!/bin/bash #------------------------------------------------------------------------------- # confignetwork -# Used on Redhat only. Configure bond/vlan/linux bridge/ on the nodes +# Configure Ethernet nic/bond/vlan/bridge/ on the nodes +# Configure Ethernet nic support redhat sles and ubuntu OS, confignetwork use configeth to realize this work. +# Configure bond/vlan/bridge support redhat only. # # You can configure nicdevices,nictypes,nicips,nicnetworks in nics table -# Then you can run the following commands on MN: +# 1. If you want to configure install nic and other nics, you can run the following command on MN: +# updatenode noderange "confignetwork -s" +# 2. If you want to configure nics except install nic, you can run the following command on MN: # updatenode noderange confignetwork -# confignetwork can be used in postscript too. +# 3. confignetwork can be used in postscripts or postbootscripts too. # ############################################################################ @@ -18,13 +22,12 @@ if [ x"$str_os_type" = "xLinux" ];then . $str_dir_name/nicutils.sh else log_error "Does NOT support non-Linux Operating System." - exit -1 + exit 1 fi - ###################################################################### # -# OS support +# OS support checking # Check OS version and get the directory of network configuration file # ##################################################################### @@ -39,18 +42,78 @@ if [ -f "/etc/redhat-release" ];then elif [ -f "/etc/SuSE-release" -o -n "$str_temp" ];then is_sles=1 nwdir="/etc/sysconfig/network" - log_error "Only supports RHEL" - exit -1 elif [ -f "/etc/debian_version" ];then nwdir="/etc/network/interfaces.d" is_debian=1 - log_error "Only supports RHEL" - exit -1 else - log_error "Only supports RHEL" - exit -1 + log_error "Only supports Linux" + exit 1 fi +###################################################################### +# +# get network configuration file content +# +#################################################################### +function get_nic_cfg_file_content { + cfg_dev=$1 + cfg_file='' + if [ $is_redhat -eq 1 ] || [ $is_sles -eq 1 ]; then + cfg_file="$nwdir/ifcfg-${cfg_dev}" + elif [ $is_debian -eq 1 ]; then + cfg_file="$nwdir/${cfg_dev}" + fi + + if [ -f $cfg_file ]; then + echo "['${cfg_file}']" >&2 + cat ${cfg_file}| $sed -e 's/^/ >> /g' | log_lines info + else + log_error "Can not find $cfg_file." + errorcode=1 + fi +} + +###################################################################### +# +# Parser input arguments +# +##################################################################### +boot_install_nic=0 +for arg in "$@" +do + if [ "$arg" = "-s" ];then + boot_install_nic=1 + fi + #TODO: IB support is TBD +done +if [ "$SETINSTALLNIC" = "1" ] || [ "$SETINSTALLNIC" = "yes" ]; then + bool_install_nic=1 +fi + +###################################################################### +# +# Preparation for installnic +# +##################################################################### +function get_installnic { + + tmp_installnic="mac" + [ $INSTALLNIC ] && tmp_installnic=$INSTALLNIC + + instnic='' + if [ "$tmp_installnic" = "mac" ];then + if [ -n "$MACADDRESS" ]; then + instnic=`ip -o link | grep -i "$MACADDRESS" | awk '{print $2;}' | sed s/://` + else + errorcode=1 + fi + elif [ `echo $tmp_installnic | grep -E "e(n|th|m)[0-9a-zA-Z]+"` ];then + instnic=$tmp_installnic + else + errorcode=1 + fi + echo $instnic +} ####################################################################################### # @@ -120,6 +183,19 @@ function find_nic_type { echo $(hashget "nictypes" $nic) } +################################################################ +# +# find nic custom scripts +# +# input : nic +# +# output : niccustomscripts from nics table +# +############################################################### +function find_nic_custom_scripts { + [ $1 ] && echo $(hashget "niccustomscripts" "$1") +} + ################################################################ # @@ -231,14 +307,29 @@ function sort_nics_device_order { while [ $num1 -lt $max1 ]; do alonenic=`echo "$alone_nics"|sed -n "${num1}p"|sed "s/ //g"` + #make sure alonenic does not have base device echo "$nics_list"| grep "$alonenic" >/dev/null if [ $? -ne 0 ]; then - echo $alonenic + #pre-check nicips nictype nicnetworks for alone nic + #nicips nictype and nicnetworks should be configured in nics table for alone nic + alonenicips=`find_nic_ips $alonenic` + alonenictype=`find_nic_type $alonenic` + alonenicnetwork=`query_nicnetworks_net $alonenic` + if [ -n "$alonenicips" ] && [ -n "$alonenictype" ] && [ -n "$alonenicnetwork" ]; then + #if alone nic configure nicips, it is valid + echo $alonenic + else + errorcode=1 + echo "Error: nicips,nictype and nicnetwork should be configured in nics table for $alonenic." + ((num1+=1)) + continue + fi fi ((num1+=1)) done - # - if [ -n "$nics_list" ]; then + + if [ -n "$nics_list" ]; then + if [ $is_redhat -eq 1 ]; then num=1 max=`echo "$nics_list"|wc -l` ((max+=1)) @@ -302,6 +393,9 @@ function sort_nics_device_order { fi ((num+=1)) done + else + log_error "Error: only support configure bond/vlan/bridge on redhat." + fi fi new_order=$eth_slot" "$bond_slot" "$vlan_slot new_order_list="" @@ -336,6 +430,36 @@ function configure_nicdevice { ((max+=1)) while [ $num -lt $max ]; do + nic_dev=`echo "$nics_pair" |sed -n "${num}p"|awk '{print $1}'` + #If install nic is configured, skip to reconfigure it + if [ x"$nic_dev" = x"$installnic" -a $instnic_conf -eq 1 ]; then + log_warn "install nic $nic_dev has been configured, skip to reconfigure it." + ((num+=1)) + continue + fi + #processing custom scripts for nic + customcmd=`find_nic_custom_scripts $nic_dev` + customscript=`echo $customcmd|awk '{print $1}'` + if [ -n "$customscript" ]; then + if [ -f "/install/postscript/$customscript" ]; then + #if there is no custom script in /install/postscript,exit this loop + log_error "/install/postscript/$customscript does not exist." + errorcode=1 + ((num+=1)) + continue + fi + echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + log_info "processing custom scripts:\"$customcmd\" for interface $nic_dev" + $customcmd + if [ $? -ne 0 ]; then + errorcode=1 + fi + + #if custom script is finished, go to configure next nic/nic_pair + ((num+=1)) + continue + fi + #get base nic and its type base_nic_dev=`echo "$nics_pair" |sed -n "${num}p"|awk '{print $2}'` if [ -n "$base_nic_dev" ]; then if echo "$base_nic_dev"|grep "@" >/dev/null; then @@ -347,17 +471,23 @@ function configure_nicdevice { base_nic_type=`find_nic_type "$base_temp_nic" | $utolcmd` fi - nic_dev=`echo "$nics_pair" |sed -n "${num}p"|awk '{print $1}'` nic_dev_type=`find_nic_type "$nic_dev" | $utolcmd` echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" nic_pair=`echo "$nics_pair" |sed -n "${num}p"` echo "configure nic and its device : $nic_pair" + #configure standalone ethernet nic if [ x"$nic_dev_type" = "xethernet" ]; then - - ipaddr=`find_nic_ips $nic_dev|awk -F"|" '{print $1}'` - if [ -n "$ipaddr" ]; then - create_ethernet_interface ifname=$nic_dev _ipaddr=$ipaddr + xcatnet=`query_nicnetworks_net $nic_dev` + ipaddrs=`find_nic_ips $nic_dev` + if [ -n "$ipaddrs" ]; then + log_info "configure $nic_dev" + log_info "call: configeth $nic_dev $ipaddrs $xcatnet" + configeth $nic_dev $ipaddrs $xcatnet + if [ $? -ne 0 ]; then + errorcode=1 + fi + get_nic_cfg_file_content $nic_dev else log_warn "There is no ip for $nic_dev." ((noip+=1)) @@ -367,6 +497,7 @@ function configure_nicdevice { log_error "There is no any ip configured for any nic. Check nicips in nics table first." errorcode=1 fi + #configure bridge #linux bridge type is bridge #openvswitch bridge type is bridge_ovs @@ -387,6 +518,8 @@ function configure_nicdevice { #configure bond elif [ x"$nic_dev_type" = "xbond" ]; then create_bond_interface ifname=$nic_dev slave_ports=$base_nic_for_bond + elif [ x"$nic_dev_type" = "xinfiniband" ]; then + log_error "confignetwork does not support configure IB. " else log_error "Error : please check nictypes for $nic_pair." errorcode=1 @@ -424,10 +557,30 @@ function enable_network_service { ############################################################################ errorcode=0 - #nictypes should support capital letters, for example, Ethernet and ethernet utolcmd="sed -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" +#get for installnic +installnic='' +installnic=`get_installnic` +instnic_conf=0 +if [ $boot_install_nic -eq 1 ];then + if [ -n "$installnic" ]; then + echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + log_info "configure the install nic $installnic. " + instnic_conf=1 + configeth -s $installnic |log_lines info + if [ $? -ne 0 ]; then + errorcode=1 + fi + get_nic_cfg_file_content $installnic + echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + else + log_error "Can not determine proper install nic." + errorcode=1 + fi +fi + #replace | with "@", for example, eth1|eth2 ----> eth1@eth2 nicdevice=`echo "$NICDEVICES" | sed 's/|/@/g'` @@ -440,6 +593,8 @@ parser_nic_attribute "$NICTYPES" "nictypes" #make hash for nicips parser_nic_attribute "$NICIPS" "nicips" +#make hash for niccustomscripts +parser_nic_attribute "$NICCUSTOMSCRIPTS" "niccustomscripts" #get nic and its device pair, for example #eth0.6 eth0 @@ -449,26 +604,27 @@ parser_nic_attribute "$NICIPS" "nicips" new_nicdevice=`find_nic_and_device_list $str_all_nics|sort -g -k1 -g -k2|uniq` if [ -z "$new_nicdevice" ]; then log_info "There is no nic device to configure." - exit + exit $errorcode fi -#enable network service -enable_network_service - #sort nics device pair based on nicdevice type sorted_nicdevice_list=`sort_nics_device_order "$new_nicdevice"` #If there is invalid nics pair, errorcode is 1 invalid_nicdevice_pair=`echo "$sorted_nicdevice_list" | grep "Error"` if [ $? -eq 0 ]; then -log_error $invalid_nicdevice_pair -errorcode=1 + echo "$invalid_nicdevice_pair"|log_lines error + errorcode=1 fi #delete invalid nics device pair based on Error -valid_sorted_nicdevice_list=`echo "$sorted_nicdevice_list" | sed '/Error/d'` -log_info "All valid nics and device list:" -echo "$valid_sorted_nicdevice_list" |log_lines info +valid_sorted_nicdevice_list=`echo "$sorted_nicdevice_list" | sed '/Error/d'` +if [ -n "$valid_sorted_nicdevice_list" ]; then + log_info "All valid nics and device list:" + echo "$valid_sorted_nicdevice_list" |log_lines info +fi +#enable network service +enable_network_service #config nics and ifcfg files configure_nicdevice "$valid_sorted_nicdevice_list" From f5126227ceaf0d4cd03769261b3acb9e5c22208d Mon Sep 17 00:00:00 2001 From: yangsong Date: Fri, 23 Jun 2017 03:18:03 -0500 Subject: [PATCH 066/283] refine the PR 3268:support service node pool (#3323) Fix the issue that grub2 config file is wrong when node.tftpserver="" --- xCAT-server/lib/xcat/plugins/anaconda.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 5b61b8326..fb2a7cd19 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -607,7 +607,7 @@ sub mknetboot $xcatmaster = '!myipfn!'; #allow service nodes to dynamically nominate themselves as a good contact point, this is of limited use in the event that xcat is not the dhcp/tftp server } - if ($ient and $ient->{tftpserver}) + if ($ient and $ient->{tftpserver} and $ient->{tftpserver} ne '') { $imgsrv = $ient->{tftpserver}; } From 4176017b1716ba285ea364948235be3d4361dbf8 Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 25 Jun 2017 23:06:54 -0400 Subject: [PATCH 067/283] Fix issue 3327, check environment of request type in openbmc and bmcdiscover --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 2 ++ xCAT-server/lib/xcat/plugins/openbmc.pm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index fdf03b3b7..c7b3ae80c 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -85,6 +85,8 @@ sub process_request #$::args = $request->{arg}; if (ref($request->{environment}) eq 'ARRAY' and ref($request->{environment}->[0]->{XCAT_DEV_WITHERSPOON}) eq 'ARRAY') { $::XCAT_DEV_WITHERSPOON = $request->{environment}->[0]->{XCAT_DEV_WITHERSPOON}->[0]; + } elsif (ref($request->{environment}) eq 'ARRAY') { + $::XCAT_DEV_WITHERSPOON = $request->{environment}->[0]->{XCAT_DEV_WITHERSPOON}; } else { $::XCAT_DEV_WITHERSPOON = $request->{environment}->{XCAT_DEV_WITHERSPOON}; } diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 3c30b1407..ec95782b5 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -283,6 +283,8 @@ sub preprocess_request { if (ref($request->{environment}) eq 'ARRAY' and ref($request->{environment}->[0]->{XCAT_OPENBMC_DEVEL}) eq 'ARRAY') { $::OPENBMC_DEVEL = $request->{environment}->[0]->{XCAT_OPENBMC_DEVEL}->[0]; + } elsif (ref($request->{environment}) eq 'ARRAY') { + $::OPENBMC_DEVEL = $request->{environment}->[0]->{XCAT_OPENBMC_DEVEL}; } else { $::OPENBMC_DEVEL = $request->{environment}->{XCAT_OPENBMC_DEVEL}; } From b2d434a22fb71b5bf7095922e93e1d1202a87c4a Mon Sep 17 00:00:00 2001 From: bybai Date: Mon, 26 Jun 2017 02:01:47 -0400 Subject: [PATCH 068/283] fix sles11.4 testcase failure --- xCAT-test/autotest/testcase/confignics/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/confignics/cases0 b/xCAT-test/autotest/testcase/confignics/cases0 index c00b7676d..b6f5e92e0 100644 --- a/xCAT-test/autotest/testcase/confignics/cases0 +++ b/xCAT-test/autotest/testcase/confignics/cases0 @@ -173,7 +173,7 @@ check:rc==0 cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~11.1.0.100 check:output!~dhcp -cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi +cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1 ; elif [ "$$OS" = "rhels" ]; then xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1;else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi check:output=~12.1.0.100 check:output!~dhcp cmd:if [ "$$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi From 664f63b8bfac5339fdae03b95eec01ddbd85e137 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 26 Jun 2017 15:19:23 -0400 Subject: [PATCH 069/283] Fix formatting and grammar for sinv man page --- .../admin-guides/references/man1/sinv.1.rst | 95 +++++++++---------- xCAT-client/pods/man1/sinv.1.pod | 95 +++++++++---------- 2 files changed, 90 insertions(+), 100 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/sinv.1.rst b/docs/source/guides/admin-guides/references/man1/sinv.1.rst index 89bf04d4e..11a98a55b 100644 --- a/docs/source/guides/admin-guides/references/man1/sinv.1.rst +++ b/docs/source/guides/admin-guides/references/man1/sinv.1.rst @@ -19,7 +19,7 @@ sinv.1 **************** -\ **sinv**\ [\ **-o**\ \ *output*\ ] [\ **-p**\ \ *template path*\ ] [\ **-t**\ \ *template count*\ ] [\ **-s**\ \ *seed node*\ ] [\ **-i**\ ] [\ **-e**\ ] [\ **-r**\ ] [\ **-V**\ ] [\ **-**\ **-devicetype**\ \ *type_of_device*\ ] [\ **-l**\ \ *userID*\ ] [[\ **-f**\ \ *command file*\ ] | [\ **-c**\ \ *command*\ ]] +\ **sinv**\ [\ **-o**\ \ *output*\ ] \ **-p**\ \ *template path*\ [\ **-t**\ \ *template count*\ ] [\ **-s**\ \ *seed node*\ ] [\ **-i**\ ] [\ **-e**\ ] [\ **-r**\ ] [\ **-V**\ ] [\ **-**\ **-devicetype**\ \ *type_of_device*\ ] [\ **-l**\ \ *userID*\ ] {\ **-f**\ \ *command file*\ | \ **-c**\ \ *command*\ } \ **sinv**\ [\ **-h**\ | \ **-v**\ ] @@ -30,9 +30,9 @@ sinv.1 The \ **sinv**\ command is designed to check the configuration of the nodes in a cluster. -The command takes as input command line flags, and one or more templates which will be compared against the output of the xdsh command, designated to be run by the -c or -f flag, on the nodes in the noderange. +The command takes as input command line flags, and one or more templates which will be compared against the output of the \ **xdsh**\ command, designated to be run by the \ **-c**\ or \ **-f**\ flag, on the nodes in the noderange. -The nodes will then be grouped according to the template they match and a report returned to the administrator in the output file designated by the -o flag, or to stdout. +The nodes will then be grouped according to the template they match and a report returned to the administrator in the output file designated by the \ **-o**\ flag, or to stdout. \ **sinv**\ supports checking the output from the \ **rinv**\ or \ **xdsh**\ command. @@ -40,13 +40,13 @@ The \ **sinv**\ command is an xCAT Distributed Shell Utility. \ **COMMAND**\ \ **SPECIFICATION**\ : -The xdsh or rinv command to execute on the remote targets is specified by the \ **-c**\ flag, or by the \ **-f**\ flag +The \ **xdsh**\ or \ **rinv**\ command to execute on the remote targets is specified by the \ **-c**\ flag, or by the \ **-f**\ flag which is followed by the fully qualified path to a file containing the command. -Note: do not add | xdshcoll to the command on the command line or in the -command file, it is automatically added by sinv. +Note: do not add \ **| xdshcoll**\ to the command on the command line or in the +command file, it is automatically added by \ **sinv**\ . -The syntax for the \ **-c**\ \ **sinv**\ parameter is as follows: +The syntax for the \ **-c**\ parameter is as follows: "\ *command*\ [; \ *command*\ ]..." @@ -60,9 +60,9 @@ those that read from standard input. \ **REMOTE**\ \ **SHELL**\ \ **COMMAND**\ : -For xdsh, support is explicitly provided -for AIX Remote Shell and OpenSSH, but any secure remote command that -conforms to the IETF (Internet Engineering Task Force) Secure Remote +For \ **xdsh**\ , support is explicitly provided +for AIX Remote Shell and OpenSSH, but any secure remote command that +conforms to the IETF (Internet Engineering Task Force) Secure Remote Command Protocol can be used. See man \ **xdsh**\ for more details. @@ -74,32 +74,28 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. \ **-o | -**\ **-output**\ \ *report output file*\ - Optional output file. This is the location of the file that will contain the report of the nodes that match, and do not match, the input templates. - If the flag is not used, the output will go to stdout. + Optional output file. This is the location of the file that will contain the report of the nodes that match, and do not match, the input templates. If the flag is not used, the output will go to stdout. \ **-p | -**\ **-tp**\ \ *template path*\ This is the path to the template file. The template contains the output - of xdsh command, that has been run against a "seed" node, a node - that contains the configuration that you would like - all nodes in your noderange to match. + of \ **xdsh**\ or \ **rinv**\ command, that has been run against a "seed" node, a node + that contains the configuration that you would like all nodes in your noderange to match. - The admin can create the template by running the xdsh command on - the seed node, pipe to xdshcoll ( required) and store the output + The admin can create the template by running the \ **xdsh**\ or \ **rinv**\ command on + the seed node, pipe to \ **xdshcoll**\ (required) and store the output in the template path. See examples. - \ **Note:**\ The admin can also edit the - template to remove any lines that they do not want checked. + \ **Note:**\ The admin can also edit the template to remove any lines that they do not want checked. An alternative method is to use the [\ **-s**\ \ *seed node*\ ] parameter, which will automatically build the template for you from the seed node named. - If a template path file does not exist, and a seed node is not input, - then sinv will automatically use the one node in the noderange as - the seed node and build the template. + If a a seed node is not provided, then command will automatically use the first node in the noderange as + the seed node. @@ -107,7 +103,7 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. This count is the number of templates that the command will use to check for nodes matches. If the template in the template path does not - match a node, the \ **sinv**\ will check additional templates up + match a node, the \ **sinv**\ will check additional templates up to the template count. For each node, it will compare the node against each template to see if @@ -127,9 +123,8 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. that is stored in template path. You can use this parameter instead of running the command yourself to build the template. - \ **Note:**\ If the template path file does not exist, and no seed node is - supplied, the seed node automatically is one node in the - noderange. + \ **Note:**\ If no seed node is supplied, the first node in the noderange is automatically + selected as a seed node. @@ -147,9 +142,9 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. This requires the check of node output against template to be an exact match. If this flag is not set, \ **sinv**\ checks to see if the return from the - xdsh command to the nodes contain a match for each line in the input + \ **xdsh**\ or \ **rinv**\ command to the nodes contain a match for each line in the input template (except for xdshcoll header and comments). If not in exactmatch mode, - there can exist more lines in the xdsh return from the nodes. + there can be more lines in the \ **xdsh**\ or \ **rinv**\ return from the nodes. For example, if running a "rpm -qa | grep xCAT" command, without exactmatch set, if the node contains more xCAT rpms that listed in the template, @@ -185,21 +180,21 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. \ **-c | -**\ **-command**\ - The xdsh or rinv command that will be run. The command should be enclosed in - double quotes to insure correct shell interpretation. This parameter must only contain, the node range or the image path (Linux) or spot name for AIX. It cannot be used to set additional input flags to xdsh or rinv (for example -s,-T,-e). See examples below. + The \ **xdsh**\ or \ **rinv**\ command that will be run. The command should be enclosed in + double quotes to insure correct shell interpretation. This parameter must only contain, the node range or the image path (Linux) or spot name for AIX. It cannot be used to set additional input flags to \ **xdsh**\ or \ **rinv**\ (for example \ **-s**\ ,\ **-T**\ ,\ **-e**\ ). See examples below. - \ **Note:**\ do not add the | xdshcoll to the command, - it is automatically added by sinv. sinv also automatically sets the -v flag for xdsh. + \ **Note:**\ do not add the \ **| xdshcoll**\ to the command, + it is automatically added by \ **sinv**\ . \ **sinv**\ also automatically sets the \ **-v**\ flag for \ **xdsh**\ . \ **-f | -**\ **-file**\ - The file containing the xdsh or rinv command that will be run. + The file containing the \ **xdsh**\ or \ **rinv**\ command that will be run. This should be the fully qualified name of the file. - \ **Note:**\ do not add the | xdshcoll to the command in the file, - it is automatically added by sinv. + \ **Note:**\ do not add the \ **| xdshcoll**\ to the command in the file, + it is automatically added by \ **sinv**\ . @@ -208,11 +203,11 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. This flag indicates that generated templates should be removed at the at the end of the \ **sinv**\ command execution. - If the flag is input, then all templates that are generated by the \ **sinv**\ + If the flag is specified, then all templates that are generated by the \ **sinv**\ command, will be removed. If the first template is created by the admin, it will not be removed. - If the flag is not input, no + If the flag is not specified, no templates will be removed. It is up to the admin to cleanup templates. @@ -242,7 +237,7 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. -1. To setup sinv.template (name optional) for input to the \ **sinv**\ command , enter: +1. To setup sinv.template (name optional) for input to the \ **sinv**\ command, enter: .. code-block:: perl @@ -250,7 +245,7 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. xdsh node1,node2 "rpm -qa | grep ssh " | xdshcoll > /tmp/sinv.template - Note: when setting up the template the output of xdsh must be piped to xdshcoll, sinv processing depends on it. + Note: when setting up the template the output of \ **xdsh**\ must be piped to \ **xdshcoll**\ , \ **sinv**\ processing depends on it. @@ -262,12 +257,12 @@ Command Protocol can be used. See man \ **xdsh**\ for more details. rinv node1-node2 serial | xdshcoll > /tmp/rinv.template - Note: when setting up the template the output of rinv must be piped to xdshcoll, sinv processing depends on it. + Note: when setting up the template the output of \ **rinv**\ must be piped to \ **xdshcoll**\ , \ **sinv**\ processing depends on it. 3. To execute \ **sinv**\ using the sinv.template generated above -on the nodegroup, \ **testnodes**\ ,possibly generating up to two +on the nodegroup, \ *testnodes*\ ,possibly generating up to two new templates, and removing all generated templates in the end, and writing output report to /tmp/sinv.output, enter: @@ -277,12 +272,12 @@ output report to /tmp/sinv.output, enter: sinv -c "xdsh testnodes rpm -qa | grep ssh" -p /tmp/sinv.template -t 2 -r -o /tmp/sinv.output - Note: do not add the pipe to xdshcoll on the -c flag, it is automatically added by the sinv routine. + Note: do not add the pipe to \ **xdshcoll**\ on the \ **-c**\ flag, it is automatically added by the \ **sinv**\ . -4. To execute \ **sinv**\ on noderange, node1-node4, using the seed node, node8, -to generate the first template, using the xdsh command (-c), +4. To execute \ **sinv**\ on noderange, \ *node1-node4*\ , using the seed node, \ *node8*\ , +to generate the first template, using the \ **xdsh**\ command (\ **-c**\ ), possibly generating up to two additional templates and not removing any templates at the end, enter: @@ -294,8 +289,8 @@ templates and not removing any templates at the end, enter: -5. To execute \ **sinv**\ on noderange, node1-node4, using the seed node, node8, -to generate the first template, using the rinv command (-c), +5. To execute \ **sinv**\ on noderange, \ *node1-node4*\ , using the seed node, \ *node8*\ , +to generate the first template, using the \ **rinv**\ command (\ **-c**\ ), possibly generating up to two additional templates and removing any generated templates at the end, enter: @@ -307,8 +302,8 @@ templates and removing any generated templates at the end, enter: -6. To execute \ **sinv**\ on noderange, node1-node4, using node1 as -the seed node, to generate the sinv.template from the xdsh command (-c), +6. To execute \ **sinv**\ on noderange, \ *node1-node4*\ , using \ *node1*\ as +the seed node, to generate the sinv.template from the \ **xdsh**\ command (\ **-c**\ ), using the exact match option, generating no additional templates, enter: @@ -322,14 +317,14 @@ using the exact match option, generating no additional templates, enter: -7. To execute \ **sinv**\ on the Linux osimage defined for cn1. First build a template from the /etc/hosts on the node. Then run sinv to compare. +7. To execute \ **sinv**\ on the Linux osimage defined for cn1. First build a template from the /etc/hosts on the node. Then run \ **sinv**\ to compare. .. code-block:: perl xdsh cn1 "cat /etc/hosts" | xdshcoll > /tmp/sinv2/template" - sinv -c "xdsh -i /install/netboot/rhels6/ppc64/test_ramdisk_statelite/rootimg cat /etc/hosts" -e -t1 -p /tmp/sinv.template -o /tmp/sinv.output + sinv -c "xdsh -i /install/netboot/rhels6/ppc64/test_ramdisk_statelite/rootimg cat /etc/hosts" -e -t 1 -p /tmp/sinv.template -o /tmp/sinv.output diff --git a/xCAT-client/pods/man1/sinv.1.pod b/xCAT-client/pods/man1/sinv.1.pod index b81db7b57..1d6dfa3d5 100644 --- a/xCAT-client/pods/man1/sinv.1.pod +++ b/xCAT-client/pods/man1/sinv.1.pod @@ -4,7 +4,7 @@ B - Checks the software configuration of the nodes in the cluster. =head1 B -B [B<-o> I] [B<-p> I