From 2acd4365f0bce03407fb07eccaea6efecdf30b48 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 25 Jan 2018 13:34:37 -0500 Subject: [PATCH 001/100] Support hostname and network setting changes for IRPDU --- docs/source/advanced/pdu/irpdu.rst | 8 + docs/source/advanced/pdu/pdu.rst | 2 +- xCAT-server/lib/xcat/plugins/pdu.pm | 179 ++++++++++++++++-- .../lib/xcat/plugins/switchdiscover.pm | 53 +++--- 4 files changed, 206 insertions(+), 36 deletions(-) diff --git a/docs/source/advanced/pdu/irpdu.rst b/docs/source/advanced/pdu/irpdu.rst index c7a557ed7..dccaf049a 100644 --- a/docs/source/advanced/pdu/irpdu.rst +++ b/docs/source/advanced/pdu/irpdu.rst @@ -47,6 +47,14 @@ The following commands are supported against a compute node: The following commands are supported against a PDU: + * To change hostname of IR PDU: :: + + # rspconfig f5pdu3 hosname=f5pdu3 + + * To change ip address of IR PDU: :: + + # rsconfig f5pdu3 ip=x.x.x.x netmaks=255.x.x.x + * Check the status of the full PDU: :: # rpower f5pdu3 stat diff --git a/docs/source/advanced/pdu/pdu.rst b/docs/source/advanced/pdu/pdu.rst index 0157ee8da..6e0ca6862 100644 --- a/docs/source/advanced/pdu/pdu.rst +++ b/docs/source/advanced/pdu/pdu.rst @@ -20,7 +20,7 @@ xCAT uses snmp scan method to discover PDU. Make sure net-snmp-utils package is -x XML formatted output. -z Stanza formatted output. -w Writes output to xCAT database. - --setup Process switch-based pdu discovery and configure the PDUs(it included passwordless , change ip address from dhcp to static and snmp configuration). It required predefined PDU node definition with switch name and switch port attributes for mapping. (Notes: only support for crpdu for now for this options) + --setup Process switch-based pdu discovery and configure the PDUs. For crpdu, --setup options will configure passwordless , change ip address from dhcp to static, hostname changes and snmp v3 configuration. For irpdu, it will configure ip address and hostname. It required predefined PDU node definition with switch name and switch port attributes for mapping. Define PDU Objects diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index eca4553bf..f62121089 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -76,20 +76,21 @@ sub pdu_usage my ($callback, $command) = @_; my $usagemsg = "Usage: + The following commands support both type of PDUs : pdudiscover [|--range ipranges] [-r|-x|-z] [-w] [-V|--verbose] [--setup] rpower pdunodes [off|on|stat|reset] + rinv pdunodes + rvitals pdunodes - The following command supports IR PDU with pdutype=irpdu : - rpower CN [pduoff|pduon|pdustat|pdustatus|pdureset] + The following commands support IR PDU with pdutype=irpdu : + rpower computenodes [pduoff|pduon|pdustat|pdustatus|pdureset] + rspconfig irpdunode [hostname=|ip=|gateway=|mask=] The following commands support CR PDU with pdutype=crpdu : rpower pdunodes relay=[1|2|3] [on|off] - rinv pdunodes - rvitals pdunodes rspconfig pdunodes sshcfg rspconfig pdunodes snmpcfg rspconfig pdunode [hostname=|ip=|mask=] - \n"; if ($callback) @@ -214,7 +215,7 @@ sub process_request process_sshcfg($noderange, $subcmd, $callback); }elsif ($subcmd eq 'snmpcfg') { process_snmpcfg($noderange, $subcmd, $callback); - }elsif ($subcmd =~ /ip|netmask|hostname/) { + }elsif ($subcmd =~ /ip|gateway|netmask|hostname/) { process_netcfg($request, $subreq, $subcmd, $callback); } else { $callback->({ errorcode => [1],error => "The input $command $subcmd is not support for pdu"}); @@ -628,17 +629,19 @@ sub process_netcfg { my $pdutab = xCAT::Table->new('pdu'); my $pduhash = $pdutab->getNodesAttribs($nodes, ['pdutype']); - unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") { - xCAT::SvrUtils::sendmsg("This command only supports CONSTELLATION PDU with pdutype=crpdu", $callback,$pdu); - return; - } my $nodetab = xCAT::Table->new('hosts'); my $nodehash = $nodetab->getNodesAttribs($nodes,['ip','otherinterfaces']); - - # connect to PDU my $static_ip = $nodehash->{$pdu}->[0]->{ip}; my $discover_ip = $nodehash->{$pdu}->[0]->{otherinterfaces}; + + unless ($pduhash->{$pdu}->[0]->{pdutype} eq "crpdu") { + netcfg_for_irpdu($pdu, $static_ip, $discover_ip, $request, $subreq, $callback); + return; + } + + + # connect to PDU ($exp, $errstr) = session_connect($static_ip, $discover_ip); if (defined $errstr) { xCAT::SvrUtils::sendmsg("Failed to connect", $callback,$pdu); @@ -1361,6 +1364,158 @@ sub process_snmpcfg { } } +#------------------------------------------------------- + +=head3 netcfg_for_irpdu + + change hostname and network setting for IR PDU. + +=cut +#------------------------------------------------------- +sub netcfg_for_irpdu { + my $pdu = shift; + my $static_ip = shift; + my $discover_ip = shift; + my $request = shift; + my $subreq = shift; + my $callback = shift; + my $hostname; + my $ip; + my $gateway; + my $netmask; + + my $extrargs = $request->{arg}; + my @exargs = ($request->{arg}); + if (ref($extrargs)) { + @exargs = @$extrargs; + } + + #default password for irpdu + my $passwd = "1001"; + my $username = "ADMIN"; + my $timeout = 20; + my $send_change = "N"; + + my $login_ip; + + # somehow, only system command works for checking if irpdu is pingable + # Net::Ping Module and xCAT::NetworkUtils::isPingable both are not working + if (system("ping -c 2 $static_ip") == 0 ) { + $login_ip = $static_ip; + } elsif (system("ping -c 2 $discover_ip") == 0) { + $login_ip = $discover_ip; + } else { + xCAT::SvrUtils::sendmsg(" is not reachable", $callback,$pdu); + } + + foreach my $cmd (@exargs) { + my ($key, $value) = split(/=/, $cmd); + if ($key =~ /hostname/) { + $hostname = $value; + xCAT::SvrUtils::sendmsg("change pdu hostname to $hostname", $callback); + } + if ($key =~ /ip/) { + $ip = $value; + $send_change = "Y"; + xCAT::SvrUtils::sendmsg("change ip address for $pdu to $ip", $callback); + } + if ($key =~ /gateway/) { + $gateway = $value; + $send_change = "Y"; + xCAT::SvrUtils::sendmsg("change gateway for $pdu to $gateway", $callback); + } + if ($key =~ /netmask/) { + $netmask = $value; + $send_change = "Y"; + xCAT::SvrUtils::sendmsg("change netmask for $pdu to $netmask", $callback); + } + + } + + my $login_cmd = "telnet $login_ip\r"; + my $user_prompt = " Login: "; + my $pwd_prompt = "Password: "; + my $pdu_prompt = "Please Enter Your Selection => "; + my $send_zero = 0; + my $send_one = 1; + my $send_two = 2; + + my $mypdu = new Expect; + + $mypdu->log_stdout(1); # suppress stdout output.. + $mypdu->slave->stty(qw(sane -echo)); + + unless ($mypdu->spawn($login_cmd)) + { + $mypdu->soft_close(); + xCAT::SvrUtils::sendmsg("Unable to run $login_cmd", $callback); + return; + } + my @result = $mypdu->expect( + $timeout, + [ + $user_prompt, + sub { + $mypdu->clear_accum(); + $mypdu->send("$username\r"); + $mypdu->clear_accum(); + $mypdu->exp_continue(); + } + ], + [ + $pwd_prompt, + sub { + $mypdu->clear_accum(); + $mypdu->send("$passwd\r"); + $mypdu->clear_accum(); + $mypdu->exp_continue(); + } + ], + [ + $pdu_prompt, + sub { + $mypdu->clear_accum(); + $mypdu->send("$send_one\r"); + $mypdu->send("$send_one\r"); + #change hostname + $mypdu->send("$send_one\r"); + $mypdu->send("$hostname\r"); + $mypdu->send("$send_zero\r"); + #change network setting + $mypdu->send("$send_two\r"); + $mypdu->send("$send_one\r"); + $mypdu->send("$ip\r"); + $mypdu->send("$gateway\r"); + $mypdu->send("$netmask\r"); + $mypdu->send("$send_change\r"); + # go back Previous Menu + $mypdu->send("$send_zero\r"); + $mypdu->send("$send_zero\r"); + } + ], + ); + + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mypdu->soft_close(); + xCAT::SvrUtils::sendmsg("Failed expect command $errmsg", $callback); + return; + } + $mypdu->soft_close(); + + xCAT::SvrUtils::sendmsg("hostname or network setting changed, update node definition ", $callback); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"otherinterfaces="] }, $subreq, 0, 1); + if ( (defined $ip) and ($static_ip ne $ip) ) { + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"ip=$ip",'status=configured'] }, $subreq, 0, 1); + xCAT::Utils->runxcmd({ command => ['makehosts'], node => [$pdu] }, $subreq, 0, 1); + } + + return; +} + + + 1; diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 7c3277154..630727af7 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1440,31 +1440,38 @@ sub switchsetup { @nets = $nettab->getAllAttribs('net','mask'); } foreach my $mytype (keys %$nodes_to_config) { - if ( $mytype eq "irpdu" ) { - send_msg($request, 0, "the setup options for irpdu is not support yet\n"); - } elsif ( $mytype eq "crpdu" ) { - my $nodetab = xCAT::Table->new('hosts'); - my $nodehash = $nodetab->getNodesAttribs(\@{${nodes_to_config}->{$mytype}},['ip','otherinterfaces']); - foreach my $pdu(@{${nodes_to_config}->{$mytype}}) { - my $cmd = "rspconfig $pdu sshcfg"; - xCAT::Utils->runcmd($cmd, 0); - my $ip = $nodehash->{$pdu}->[0]->{ip}; - my $mask; - foreach my $net (@nets) { - if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { - $mask=$net->{'mask'}; - } - } - $cmd = "rspconfig $pdu hostname=$pdu ip=$ip netmask=$mask"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC == 0) { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,"ip=$ip","otherinterfaces="] }, $sub_req, 0, 1); - } else { - send_msg($request, 0, "Failed to run rspconfig command to set ip/netmask\n"); + my $nodetab = xCAT::Table->new('hosts'); + my $nodehash = $nodetab->getNodesAttribs(\@{${nodes_to_config}->{$mytype}},['ip','otherinterfaces']); + foreach my $pdu(@{${nodes_to_config}->{$mytype}}) { + my $ip = $nodehash->{$pdu}->[0]->{ip}; + my $mask; + foreach my $net (@nets) { + if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { + $mask=$net->{'mask'}; } } - } else { - send_msg($request, 0, "the pdu type $mytype is not support\n"); + my $cmd; + my $rc = 0; + if ( $mytype eq "crpdu" ) { + $cmd = "rspconfig $pdu sshcfg"; + send_msg($request, 0, "process command: $cmd\n"); + $rc = xCAT::Utils->runcmd($cmd, 0); + $cmd = "rspconfig $pdu hostname=$pdu ip=$ip netmask=$mask"; + send_msg($request, 0, "process command: $cmd\n"); + $rc = xCAT::Utils->runcmd($cmd, 0); + } elsif ( $mytype eq "irpdu" ) { + $cmd = "rspconfig $pdu hostname=$pdu ip=$ip netmask=$mask"; + send_msg($request, 0, "process command: $cmd\n"); + $rc = xCAT::Utils->runcmd($cmd, 0); + } else { + send_msg($request, 0, "the pdu type $mytype is not support\n"); + $rc = 1; + } + if ($rc == 0) { + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$pdu,'status=configured',"ip=$ip","otherinterfaces="] }, $sub_req, 0, 1); + } else { + send_msg($request, 0, "Failed to run rspconfig command to set ip/netmask\n"); + } } } return; From e98e2701e0d19b4fcae5dc616657f53816b45ebd Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Fri, 26 Jan 2018 15:49:04 +0800 Subject: [PATCH 002/100] Update Version --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index 3caff04ae..3c5ed7828 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.13.10 +2.13.11 From 231d9347329cdaddad00f7c29390d543acbd008b Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 23 Jan 2018 17:42:43 +0800 Subject: [PATCH 003/100] Define some attributes as array type in rest api ver 1.0 Split attribute with comma is not a standard way, this commit bumped REST version to 1.0 to deal with these attributes in array type. ``` curl -X GET -k 'http://10.5.101.10/xcatws/nodes/restnode1?userName=root&userPW=cluster' {"restnode1":{"serialspeed":"115200","nicips.ib1":"10.0.0.100|fd55::214:5eff:fe15:849b","nicnetworks.ib0":"IB00","nicnetworks.ib1":"IB01","cons":"ipmi","postscripts":"syslog,remoteshell,syncfiles,hello,world2","nicips.ib0":"10.10.100.9","groups":"conpute,staticconsolegroup","postbootscripts":"otherpkgs","nictypes.ib0":"Infiniband","nicips.ib2":"10.0.0.103|10.0.0.104"}} curl -X GET -k 'http://10.5.101.10/xcatws/nodes/restnode1?userName=root&userPW=cluster&ver=1.0' {"restnode1":{"nicnetworks.ib0":"IB00","nicnetworks.ib1":"IB01","cons":"ipmi","postscripts":["syslog","remoteshell","syncfiles","hello","world2"],"nicips.ib0":["10.10.100.9"],"nicips.ib2":["10.0.0.103","10.0.0.104"],"groups":["conpute","staticconsolegroup"],"postbootscripts":["otherpkgs"],"serialspeed":"115200","nicips.ib1":["10.0.0.100","fd55::214:5eff:fe15:849b"],"nictypes.ib0":"Infiniband"}} ``` --- xCAT-server/xCAT-wsapi/xcatws.cgi | 50 +++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index a5e8c39dd..5fbea07ca 100644 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -45,6 +45,12 @@ my %usagemsg = ( non_getreturn => "No output when execution is successfull. Otherwise output the error information in the Standard Error Format: {error:[msg1,msg2...],errocode:errornum}." ); +# ver(1.0): Use array type instread of string split by '|' or ',' +# ver(1.0): Specify the version number as 'ver=1.0' which is a url parameter +# ver(1.0): Example: curl -X GET -k 'http://hostname/xcatws/nodes/restnode1?userName=root&userPW=cluster&ver=1.0' +my @ARRAY_ATTRS = ('groups', 'members', 'postscripts', 'postbootscripts'); +my $NICS_ATTR = 'nicips'; + my %URIdef = ( #### definition for node resources nodes => { @@ -1387,14 +1393,19 @@ if ($ARGV[0] eq "-h") { $pathInfo = $ARGV[1]; unless ($pathInfo) { dbgusage(); exit 1; } - - if ($ARGV[2] =~ /(.*):(.*)/) { - $ENV{userName} = $1; - $ENV{password} = $2; - } else { + # userName:userPW:version + my @params = split(':', $ARGV[2]); + if (@params < 2) { dbgusage(); exit 0; } + if(@params >= 2) { + $ENV{userName} = $params[0]; + $ENV{password} = $params[1]; + } + if(@params == 3) { + $ENV{ver} = $params[2]; + } $dbgdata = $ARGV[3] if defined($ARGV[3]); } elsif (defined($ARGV[0])) { dbgusage(); @@ -1626,6 +1637,23 @@ sub defout { if (!$nodename) { error('improperly formatted lsdef output from xcatd', $STATUS_TEAPOT); } my ($attr, $val) = $l =~ /^\s*(\S+?)=(.*)$/; if (!defined($attr)) { error('improperly formatted lsdef output from xcatd', $STATUS_TEAPOT); } + if ((defined($generalparams->{ver}) && $generalparams->{ver} eq '1.0') || + (defined($ENV{ver}) && $ENV{ver} eq '1.0')) { + # ver(1.0): Return array type directly instead of string split by '|' or ',' + if (grep(/^$attr$/, @ARRAY_ATTRS)) { + my @vals = split(',', $val); + if (@vals) { + $json->{$nodename}->{$attr} = \@vals; + } + next; + } elsif ($attr =~ /^$NICS_ATTR.+/) { + my @vals = split('\|', $val); + if (@vals) { + $json->{$nodename}->{$attr} = \@vals; + } + next; + } + } $json->{$nodename}->{$attr} = $val; } } @@ -1971,6 +1999,16 @@ sub defhdl { push @args, $opt_val if $opt_val; } next; + } elsif (ref($paramhash->{$k}) eq "ARRAY") { + # ver(1.0): Accept array type for the attributes split by ',' or '|' + my $val; + if (grep(/^$k$/, @ARRAY_ATTRS)) { + $val = join(',', @{$paramhash->{$k}}); + } elsif ($k =~ /^$NICS_ATTR.+/) { + $val = join('|', @{$paramhash->{$k}}); + } + push(@args, "$k=$val") if $val; + next; } push @args, "$k=$paramhash->{$k}" if $paramhash->{$k}; } @@ -3302,7 +3340,7 @@ sub sendRequest { # 1st output param - The params which are listed in @generalparamlis as a general parameters like 'debug=1, pretty=1' # 2nd output param - All the params from url params and 'PUTDATA'/'POSTDATA' except the ones in @generalparamlis sub fetchParameters { - my @generalparamlist = qw(userName userPW pretty debug xcoll); + my @generalparamlist = qw(userName userPW pretty debug xcoll ver); # 1st check for put/post data and put that in the hash my $pdata; From e944582a65051144d9d73eec1132fdb549011eb0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 29 Jan 2018 11:14:34 -0500 Subject: [PATCH 004/100] Detect invalid dump id --- xCAT-server/lib/xcat/plugins/openbmc.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 658dee13c..bf0cb75a7 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -3926,12 +3926,7 @@ sub dump_download_process { return 1; } if ($h->{message} eq $::RESPONSE_OK) { - if ($::RSPCONFIG_DUMP_DOWNLOAD_ALL_REQUESTED) { - # Slightly different message if downloading dumps as part of "download all" processing - xCAT::SvrUtils::sendmsg("Downloading dump $dump_id to $file_name", $callback, $node); - } else { - xCAT::SvrUtils::sendmsg("Dump $dump_id generated. Downloading to $file_name", $callback, $node); - } + xCAT::SvrUtils::sendmsg("Downloading dump $dump_id to $file_name", $callback, $node); my $curl_dwld_result = `$curl_dwld_cmd -s`; if (!$curl_dwld_result) { if ($xcatdebugmode) { @@ -3941,7 +3936,17 @@ sub dump_download_process { `$curl_logout_cmd -s`; # Verify the file actually got downloaded if (-e $file_name) { - xCAT::SvrUtils::sendmsg("Downloaded dump $dump_id to $file_name", $callback, $node) if ($::VERBOSE); + # Check inside downloaded file, if there is a "Path not found" -> invalid ID + my $grep_cmd = "/usr/bin/grep -a"; + my $path_not_found = "Path not found"; + my $grep_for_path = `$grep_cmd $path_not_found $file_name`; + if ($grep_for_path) { + xCAT::SvrUtils::sendmsg([1, "Invalid dump $dump_id was specified. Use -l option to list."], $callback, $node); + # Remove downloaded file, nothing useful inside of it + unlink $file_name; + } else { + xCAT::SvrUtils::sendmsg("Downloaded dump $dump_id to $file_name", $callback, $node) if ($::VERBOSE); + } } else { xCAT::SvrUtils::sendmsg([1, "Failed to download dump $dump_id to $file_name. Verify destination directory exists and has correct access permissions."], $callback, $node); From 86d8c4749e1b01ac74d035b077157d6b53a0ca5a Mon Sep 17 00:00:00 2001 From: cxhong Date: Mon, 29 Jan 2018 21:12:53 -0500 Subject: [PATCH 005/100] Remove not existing table fields in PDU table (#4750) --- perl-xCAT/xCAT/Schema.pm | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 49bbd68f7..2639cba81 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -4245,22 +4245,7 @@ push(@{ $defspec{group}->{'attrs'} }, @nodeattrs); tabentry => 'pdu.outlet', access_tabentry => 'pdu.node=attr:node', }, - { attr_name => 'machinetype', - only_if => 'nodetype=pdu', - tabentry => 'pdu.machinetype', - access_tabentry => 'pdu.node=attr:node', - }, - { attr_name => 'modelnum', - only_if => 'nodetype=pdu', - tabentry => 'pdu.modelnum', - access_tabentry => 'pdu.node=attr:node', - }, - { attr_name => 'serialnum', - only_if => 'nodetype=pdu', - tabentry => 'pdu.serialnum', - access_tabentry => 'pdu.node=attr:node', - }, -); + ); From 08ffa002fb15bf0058a69e2743771395a5a026c6 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 30 Jan 2018 00:21:27 -0500 Subject: [PATCH 006/100] fix issue 4652: extra warning message for bmcdiscover --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index c4f1e2d5c..4674205df 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -1130,8 +1130,6 @@ sub bmcdiscovery_ipmi { } display_output($opz,$opw,$mtms_node,$mac_node,$node_data,"ipmi",$request_command); - } else { - store_fd({data=>0}, $fd); } } @@ -1156,6 +1154,7 @@ sub bmcdiscovery_openbmc{ my $mtms_node = ""; my $mac_node = ""; + store_fd({data=>1}, $fd); print "$ip: Detected openbmc, attempting to obtain system information...\n"; my $http_protocol="https"; my $openbmc_project_url = "xyz/openbmc_project"; From df3a89c6a9a82f761cfd81c081f2c604b24247be Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Tue, 30 Jan 2018 17:56:14 -0800 Subject: [PATCH 007/100] dodiscovery: FRU info may be present may incomplete. Check the contents of MTM obtained from FRU and fallback to DMI if it's empty. --- xCAT-genesis-scripts/usr/bin/dodiscovery | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/usr/bin/dodiscovery b/xCAT-genesis-scripts/usr/bin/dodiscovery index c23f99fae..b83759ecf 100755 --- a/xCAT-genesis-scripts/usr/bin/dodiscovery +++ b/xCAT-genesis-scripts/usr/bin/dodiscovery @@ -95,7 +95,8 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 FRU=`ipmitool fru print 0` if [ $? -eq 0 ]; then MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name|Product Part Number/ {if (n==""||n=="NONE") {n=$2}} END {print m":"n}'` - else + fi + if [ -z "$MTM" -o "$MTM" == ":" ]; then logger -s -t $log_label -p local4.warning "Couldn't find MTM information in FRU, falling back to DMI (MTMS-based discovery may fail)" m=`cat /sys/devices/virtual/dmi/id/sys_vendor` n=`cat /sys/devices/virtual/dmi/id/product_name` From 601df797293e993ee06e191144c269d45e53ea11 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 31 Jan 2018 00:42:56 -0500 Subject: [PATCH 008/100] modify error msg for rflash unsupported option --- xCAT-server/lib/xcat/plugins/openbmc2.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index 766791242..3f8855527 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -163,6 +163,11 @@ sub parse_args { if ($option_num >= 2) { return ([ 1, "Multiple options are not supported."]); } elsif ($option_num == 0) { + for my $arg (@ARGV) { + if ($arg =~ /^-/) { + return ([ 1, "Unsupported command: $command $arg" ]); + } + } return ([ 1, "No options specified."]); } if ($activate or $check or $delete or $upload) { From 8d06fe119545b0b1f69b32f8b73ea3238a616b66 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 31 Jan 2018 13:58:39 +0800 Subject: [PATCH 009/100] Add package dependency dependency for goconserver --- xCAT/debian/control | 2 +- xCAT/xCAT.spec | 4 ++++ xCATsn/debian/control | 2 +- xCATsn/xCATsn.spec | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT/debian/control b/xCAT/debian/control index e0cb0b97b..24649a905 100644 --- a/xCAT/debian/control +++ b/xCAT/debian/control @@ -10,7 +10,7 @@ Homepage: https://xcat.org/ Package: xcat Architecture: amd64 ppc64el Depends: ${perl:Depends}, xcat-server (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, libxml-parser-perl, xinetd, rsync, tftpd-hpa, conserver-xcat, libnet-telnet-perl, xcat-genesis-scripts-ppc64 (>= 2.13-snap000000000000), xcat-genesis-scripts-amd64 (>= 2.13-snap000000000000) -Recommends: bind9, nmap, tftp-hpa, ipmitool-xcat (>= 1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, elilo-xcat, xcat-buildkit (>= 2.13-snap000000000000), xcat-probe (>= 2.13-snap000000000000) +Recommends: bind9, nmap, tftp-hpa, ipmitool-xcat (>= 1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, elilo-xcat, xcat-buildkit (>= 2.13-snap000000000000), xcat-probe (>= 2.13-snap000000000000), goconserver Suggests: yaboot-xcat Description: Metapackage for a common, default xCAT setup xCAT is Extreme Cluster/Cloud Administration Toolkit. xCAT offers complete diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index e62ae73dd..1f67b1d78 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -73,6 +73,10 @@ Requires: conserver-xcat %endif %endif +%ifos linux +Recommends: goconserver +%endif + #support mixed cluster %if %nots390x Requires: elilo-xcat xnba-undi diff --git a/xCATsn/debian/control b/xCATsn/debian/control index 4f2b6f223..ca494800e 100644 --- a/xCATsn/debian/control +++ b/xCATsn/debian/control @@ -9,7 +9,7 @@ Homepage: https://xcat.org/ Package: xcatsn Architecture: amd64 ppc64el Depends: ${perl:Depends}, xcat-server (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, conserver-xcat, libnet-telnet-perl, isc-dhcp-server, apache2, nfs-kernel-server, xcat-genesis-scripts-ppc64 (>= 2.13-snap000000000000), xcat-genesis-scripts-amd64 (>= 2.13-snap000000000000) -Recommends: bind9, nmap, tftp-hpa, ipmitool-xcat (>= 1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, elilo-xcat, xcat-buildkit (>= 2.13-snap000000000000), xcat-probe (>= 2.13-snap000000000000) +Recommends: bind9, nmap, tftp-hpa, ipmitool-xcat (>= 1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, elilo-xcat, xcat-buildkit (>= 2.13-snap000000000000), xcat-probe (>= 2.13-snap000000000000), goconserver Suggests: yaboot-xcat Description: Metapackage for a common, default xCAT service node setup xCATsn is a service node management package intended for at-scale diff --git a/xCATsn/xCATsn.spec b/xCATsn/xCATsn.spec index 07dde086c..26baaa439 100644 --- a/xCATsn/xCATsn.spec +++ b/xCATsn/xCATsn.spec @@ -56,6 +56,10 @@ Requires: conserver-xcat %endif %endif +%ifos linux +Recommends: goconserver +%endif + #support mixed cluster %ifnarch s390x Requires: elilo-xcat xnba-undi From 9b04b8483c3bd3b580209be5bd877ba3cd0362a4 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 30 Jan 2018 20:25:53 -0500 Subject: [PATCH 010/100] fix issue 4758, add '-V' in rflash Usage and manpage --- .../guides/admin-guides/references/man1/rflash.1.rst | 8 ++++---- perl-xCAT/xCAT/Usage.pm | 10 +++++----- xCAT-client/pods/man1/rflash.1.pod | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rflash.1.rst b/docs/source/guides/admin-guides/references/man1/rflash.1.rst index 4eb48fa80..5e833a139 100644 --- a/docs/source/guides/admin-guides/references/man1/rflash.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rflash.1.rst @@ -19,15 +19,15 @@ Name **************** -\ **rflash**\ [\ **-h | -**\ **-help**\ | \ **-v | -**\ **-version**\ ] +\ **rflash**\ [\ **-h | -**\ **-help**\ | \ **-v | -**\ **-version**\ | \ **-V | -**\ **-verbose**\ ] PPC (with HMC) specific: ======================== -\ **rflash**\ \ *noderange*\ \ **-p**\ \ *directory*\ [\ **-**\ **-activate**\ {\ **concurrent | disruptive**\ }] [\ **-V | -**\ **-verbose**\ ] +\ **rflash**\ \ *noderange*\ \ **-p**\ \ *directory*\ [\ **-**\ **-activate**\ {\ **concurrent | disruptive**\ }] -\ **rflash**\ \ *noderange*\ {\ **-**\ **-commit | -**\ **-recover**\ } [\ **-V | -**\ **-verbose**\ ] +\ **rflash**\ \ *noderange*\ {\ **-**\ **-commit | -**\ **-recover**\ } PPC (without HMC, using Direct FSP Management) specific: @@ -50,7 +50,7 @@ OpenPOWER BMC specific (using IPMI): ==================================== -\ **rflash**\ \ *noderange*\ [\ *hpm_file_path*\ | \ **-d**\ \ *data_directory*\ ] [\ **-c | -**\ **-check**\ ] [\ **-**\ **-retry=**\ \ *count*\ ] [\ **-V**\ ] +\ **rflash**\ \ *noderange*\ [\ *hpm_file_path*\ | \ **-d**\ \ *data_directory*\ ] [\ **-c | -**\ **-check**\ ] [\ **-**\ **-retry=**\ \ *count*\ ] \ **rflash**\ \ *noderange*\ \ **-**\ **-recover**\ \ *bmc_file_path*\ diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 40e510247..70a0646b9 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -351,16 +351,16 @@ my %usage = ( makentp [-a|--all] [-V|--verbose]", "rflash" => "Usage: - rflash [ -h|--help|-v|--version] + rflash [ -h|--help|-v|--version|-V|--verbose] PPC (with HMC) specific: - rflash -p [--activate {concurrent | disruptive}] [-V|--verbose] - rflash {--commit | --recover} [-V|--verbose] + rflash -p [--activate {concurrent | disruptive}] + rflash {--commit | --recover} PPC (using Direct FSP Management) specific: rflash -p [--activate {disruptive|deferred}] [-d ] - rflash [--commit | --recover] [-V|--verbose] + rflash [--commit | --recover] rflash [--bpa_acdl] OpenPOWER BMC specific (using IPMI): - rflash [|-d ] [-c|--check] [--retry=] [-V] + rflash [|-d ] [-c|--check] [--retry=] rflash --recover OpenPOWER OpenBMC specific: rflash {[-c|--check] | [-l|--list]} diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index f6985b970..94d0db3bc 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -4,13 +4,13 @@ B - Performs Licensed Internal Code (LIC) update or firmware update on s =head1 B -B [B<-h>|B<--help> | B<-v>|B<--version>] +B [B<-h>|B<--help> | B<-v>|B<--version> | B<-V>|B<--verbose>] =head2 PPC (with HMC) specific: -B I B<-p> I [B<--activate> {B|B}] [B<-V>|B<--verbose>] +B I B<-p> I [B<--activate> {B|B}] -B I {B<--commit>|B<--recover>} [B<-V>|B<--verbose>] +B I {B<--commit>|B<--recover>} =head2 PPC (without HMC, using Direct FSP Management) specific: @@ -24,7 +24,7 @@ B I I =head2 OpenPOWER BMC specific (using IPMI): -B I [I | B<-d> I] [B<-c>|B<--check>] [B<--retry=>I] [B<-V>] +B I [I | B<-d> I] [B<-c>|B<--check>] [B<--retry=>I] B I B<--recover> I From 3e4d70383a28e781f1d2afec42f12c22a49cff7e Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 31 Jan 2018 12:11:08 -0500 Subject: [PATCH 011/100] return sub routine if ip is not reachable --- xCAT-server/lib/xcat/plugins/pdu.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index f62121089..d2a94ca3f 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -1406,6 +1406,7 @@ sub netcfg_for_irpdu { $login_ip = $discover_ip; } else { xCAT::SvrUtils::sendmsg(" is not reachable", $callback,$pdu); + return; } foreach my $cmd (@exargs) { From 31c47c303434ffac3961ad2a9d888f9595ef2849 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 31 Jan 2018 15:38:43 -0500 Subject: [PATCH 012/100] Add code to support timesyncmethod for OpenBMC using rspconfig --- .../references/man1/rspconfig.1.rst | 32 ++++++++++++------- xCAT-client/pods/man1/rspconfig.1.pod | 30 ++++++++++------- xCAT-server/lib/xcat/plugins/openbmc.pm | 13 ++++++++ 3 files changed, 53 insertions(+), 22 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst index 118a39de1..a31d08533 100644 --- a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst @@ -49,6 +49,14 @@ OpenBMC specific: \ **rspconfig**\ \ *noderange*\ {\ **ipsrc | ip | netmask | gateway | hostname | vlan | sshcfg**\ } +\ **rspconfig**\ \ *noderange*\ \ **autoreboot**\ + +\ **rspconfig**\ \ *noderange*\ \ **autoreboot={0|1}**\ + +\ **rspconfig**\ \ *noderange*\ \ **bootmode**\ + +\ **rspconfig**\ \ *noderange*\ \ **bootmode={safe|regular|setup}**\ + \ **rspconfig**\ \ *noderange*\ \ **dump**\ [\ **-l | -**\ **-list**\ ] [\ **-g | -**\ **-generate**\ ] [\ **-c | -**\ **-clear**\ {\ *id*\ | \ **all**\ }] [\ **-d | -**\ **-download**\ {\ *id*\ | \ **all**\ }] \ **rspconfig**\ \ *noderange*\ \ **powerrestorepolicy**\ @@ -59,13 +67,9 @@ OpenBMC specific: \ **rspconfig**\ \ *noderange*\ \ **powersupplyredundancy={disabled|enabled}**\ -\ **rspconfig**\ \ *noderange*\ \ **autoreboot**\ +\ **rspconfig**\ \ *noderange*\ \ **timesyncmethod**\ -\ **rspconfig**\ \ *noderange*\ \ **autoreboot={0|1}**\ - -\ **rspconfig**\ \ *noderange*\ \ **bootmode**\ - -\ **rspconfig**\ \ *noderange*\ \ **bootmode={safe|regular|setup}**\ +\ **rspconfig**\ \ *noderange*\ \ **timesyncmethod={manual|ntp}**\ MPA specific: @@ -450,31 +454,31 @@ OPTIONS \ **powerrestorepolicy**\ - Display or control BMC Power Restore Policy attribute setting. + Display or control BMC Power Restore Policy attribute setting. [OpenBMC] \ **powersupplyredundancy**\ - Display or control BMC Power Supply Redundancy attribute setting. + Display or control BMC Power Supply Redundancy attribute setting. [OpenBMC] \ **autoreboot**\ - Display or control BMC Auto Reboot attribute setting. + Display or control BMC Auto Reboot attribute setting. [OpenBMC] \ **bootmode**\ - Display or control BMC Boot Mode attribute setting. + Display or control BMC Boot Mode attribute setting. [OpenBMC] \ **dump**\ - Manage OpenBMC system dumps. If no sub-option is provided, will generate, wait, and download the dump. + Generate BMC system dump. If no sub-option is provided, will generate, wait, and download the dump. [OpenBMC] \ **-c**\ will clear a single specified dump, or use 'all' to clear all dumps on the BMC. @@ -495,6 +499,12 @@ OPTIONS +\ **timesyncmethod**\ + + Set the method for time synchronization on the BMC. [OpenBMC] + + + \ **network**\ ={[\ *ip*\ ],[\ *host*\ ],[\ *gateway*\ ],[\ *netmask*\ ]|\*} For MPA: get or set the MPA network parameters. If '\*' is specified, all parameters are read from the xCAT database. diff --git a/xCAT-client/pods/man1/rspconfig.1.pod b/xCAT-client/pods/man1/rspconfig.1.pod index c75d8dae7..d87900134 100644 --- a/xCAT-client/pods/man1/rspconfig.1.pod +++ b/xCAT-client/pods/man1/rspconfig.1.pod @@ -26,6 +26,14 @@ B I B=I