From 40ecdec4d4748412ce30bda11db06a5aef9507cf Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 27 Jun 2018 12:48:48 -0400 Subject: [PATCH 1/8] rflash for ipmi machines enhancements --- xCAT-server/lib/xcat/plugins/ipmi.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 3e7171c35..2d208bd5a 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2040,6 +2040,7 @@ sub do_firmware_update { $exit_with_error_func->($sessdata->{node}, $callback, "At least one update file (.bin or .pnor) needs to be in data directory $pUpdate_directory."); } + # All checks are done, run pUpdate utility on each of the update files found in # the specified data directory xCAT::SvrUtils::sendmsg("rflash started, Please wait...", $callback, $sessdata->{node}); @@ -2107,11 +2108,16 @@ sub do_firmware_update { $exit_with_success_func->($sessdata->{node}, $callback, "Firmware updated, powering chassis on to populate FRU information..."); } + # If we get here, the target machine is *NOT* IBM Power S822LC for Big Data (Supermicro) + # Only .hpm files is supported for such machine, no directory option is supported + if (defined $directory_name) { + $exit_with_error_func->($sessdata->{node}, $callback, "Directory option is not supported for target machine: \n$output"); + } if (($hpm_data_hash{deviceID} ne $sessdata->{device_id}) || ($hpm_data_hash{productID} ne $sessdata->{prod_id}) || ($hpm_data_hash{manufactureID} ne $sessdata->{mfg_id})) { $exit_with_error_func->($sessdata->{node}, $callback, - "The image file doesn't match this machine"); + "The image file doesn't match target machine: \n$output"); } # check for 8335-GTB Firmware above 1610A release. If below, exit From 9f629c5176ceff0c83aa739ccdd235056d99ec73 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 27 Jun 2018 15:34:44 -0400 Subject: [PATCH 2/8] Improvement from review --- xCAT-server/lib/xcat/plugins/ipmi.pm | 35 +++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 2d208bd5a..9207bd4b4 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -50,6 +50,7 @@ my $xcatdebugmode = 0; my $IPMIXCAT = "/opt/xcat/bin/ipmitool-xcat"; my $NON_BLOCK = 1; +my $BIG_DATA_MACHINE_MODELS = "8001-22C|9006-22C|5104-22C|8001-12C|9006-12C"; use constant RFLASH_LOG_DIR => "/var/log/xcat/rflash"; if (-d RFLASH_LOG_DIR) { chmod 0700, RFLASH_LOG_DIR; @@ -1978,7 +1979,7 @@ sub do_firmware_update { # P9 Boston (9006-22C, 9006-12C, 5104-22C) or P8 Briggs (8001-22C) # firmware update is done using pUpdate utility expected to be in the # specified data directory along with the update files .bin for BMC or .pnor for Host - if ($output =~ /8001-22C|9006-22C|5104-22C|8001-12C|9006-12C/) { + if ($output =~ /$BIG_DATA_MACHINE_MODELS/) { # Verify valid data directory was specified if (defined $directory_name) { unless (File::Spec->file_name_is_absolute($directory_name)) { @@ -2106,18 +2107,30 @@ sub do_firmware_update { } $exit_with_success_func->($sessdata->{node}, $callback, "Firmware updated, powering chassis on to populate FRU information..."); + } else { + + # The target machine is *NOT* IBM Power S822LC for Big Data (Supermicro) + # Only .hpm files is supported for such machine, no directory option is supported + if (defined $directory_name) { + my ($part1, $part2) = split(/Chassis Part Number :/, $output); + my ($part3, $model) = split(/\s+/, $part2); + $exit_with_error_func->($sessdata->{node}, $callback, "Flashing of $model is not supported with pUpdate, supported Model Types: $BIG_DATA_MACHINE_MODELS"); + } } - # If we get here, the target machine is *NOT* IBM Power S822LC for Big Data (Supermicro) - # Only .hpm files is supported for such machine, no directory option is supported - if (defined $directory_name) { - $exit_with_error_func->($sessdata->{node}, $callback, "Directory option is not supported for target machine: \n$output"); - } - if (($hpm_data_hash{deviceID} ne $sessdata->{device_id}) || - ($hpm_data_hash{productID} ne $sessdata->{prod_id}) || - ($hpm_data_hash{manufactureID} ne $sessdata->{mfg_id})) { - $exit_with_error_func->($sessdata->{node}, $callback, - "The image file doesn't match target machine: \n$output"); + # If we fall through here, it is *NOT* IBM Power S822LC for Big Data (Supermicro) and we expact some data in hpm_data_hash. + # Verify hpm_data_hash has some values + if ((defined $hpm_data_hash{deviceID}) || + (defined $hpm_data_hash{productID}) || + (defined $hpm_data_hash{manufactureID})) { + + if (($hpm_data_hash{deviceID} ne $sessdata->{device_id}) || + ($hpm_data_hash{productID} ne $sessdata->{prod_id}) || + ($hpm_data_hash{manufactureID} ne $sessdata->{mfg_id})) { + $exit_with_error_func->($sessdata->{node}, $callback, "The image file doesn't match target machine: \n$output"); + } + } else { + $exit_with_error_func->($sessdata->{node}, $callback, "No data was extracted from .hpm update file"); } # check for 8335-GTB Firmware above 1610A release. If below, exit From a75baf82154aa55c039205509f18cafdc17d747c Mon Sep 17 00:00:00 2001 From: Ryan Bowen Date: Tue, 10 Jul 2018 12:14:08 -0400 Subject: [PATCH 3/8] Add check for leading zeroes in ip address when running makedns This adds a check for the presence of leading zeroes in any octet of IPv4 addresses for which DNS entries will be created. --- xCAT-server/lib/xcat/plugins/ddns.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 2b6a1b2e3..f7d575a38 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -437,6 +437,10 @@ sub process_request { xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback); next; } + if ($addr =~ /(?:^|\.)0+(?=\d)/ and $addr !~ /^[abcdef0123456789:]+$/) { + xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, ip address octets can not contain leading zeroes.", $callback); + next; + } unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) { xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback); next; From d3e73fb4359ee3d1a42034ea0aefe316e934aeb9 Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 11 Jul 2018 01:43:23 -0400 Subject: [PATCH 4/8] fix check for leading zeroes in ip address when running makehosts --- perl-xCAT/xCAT/NetworkUtils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index e3871e3f4..514e39f8a 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -2156,7 +2156,7 @@ sub isIpaddr return 0; } - if ($1 > 255 || $1 == 0 || $2 > 255 || $3 > 255 || $4 > 255) + if ($1 > 255 || $1 =~ /^0/ || $2 > 255 || $2 =~ /^0+(\d)/ || $3 > 255 || $3 =~ /^0+(\d)/ || $4 > 255 || $4 =~ /^0+(\d)/) { return 0; } From cc7ad619ccbc5ce03eba605f7b69457ebcc80a04 Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 11 Jul 2018 01:58:31 -0400 Subject: [PATCH 5/8] add new UT and polished --- perl-xCAT/xCAT/NetworkUtils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 514e39f8a..7dba4a965 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -2156,7 +2156,7 @@ sub isIpaddr return 0; } - if ($1 > 255 || $1 =~ /^0/ || $2 > 255 || $2 =~ /^0+(\d)/ || $3 > 255 || $3 =~ /^0+(\d)/ || $4 > 255 || $4 =~ /^0+(\d)/) + if ($1 > 255 || $1 =~ /^0/ || $2 > 255 || $2 =~ /^0\d/ || $3 > 255 || $3 =~ /^0\d/ || $4 > 255 || $4 =~ /^0\d/) { return 0; } From c4517075c39df877a266a75ce7633a0462c5c36d Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Wed, 11 Jul 2018 16:24:33 +0800 Subject: [PATCH 6/8] Modify xcattest cases for bug 5382 (#5392) --- xCAT-test/autotest/testcase/makeconservercf/cases0 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/makeconservercf/cases0 b/xCAT-test/autotest/testcase/makeconservercf/cases0 index 963dbb695..219778d81 100644 --- a/xCAT-test/autotest/testcase/makeconservercf/cases0 +++ b/xCAT-test/autotest/testcase/makeconservercf/cases0 @@ -3,9 +3,9 @@ cmd:chdef -t node -o testnodetmp cons=hmc groups=all cmd:makeconservercf testnodetmp check:rc==0 cmd:cat /etc/conserver.cf -check:output=~console testnodetmp { +check:output=~console testnodetmp \{ check:output=~ /opt/xcat/share/xcat/cons/hmc testnodetmp; -check:output=~} +check:output=~\} cmd:rmdef -t node testnodetmp end @@ -14,9 +14,9 @@ cmd:chdef -t node -o testnodetmp cons=hmc groups=all cmd:makeconservercf testnodetmp check:rc==0 cmd:cat /etc/conserver.cf -check:output=~console testnodetmp { +check:output=~console testnodetmp \{ check:output=~ /opt/xcat/share/xcat/cons/hmc testnodetmp; -check:output=~} +check:output=~\} cmd:rmdef -t node testnodetmp end From 677f5f0c1ec47cabe4678801acd8f4abd2384039 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 11 Jul 2018 16:23:58 +0800 Subject: [PATCH 7/8] Update Ubuntu 18.04 bionic repositories for test case install_xCAT_on_ubuntu --- .../autotest/testcase/go-xcat/bionic-ppc64el.sources.list | 6 +++--- .../autotest/testcase/go-xcat/bionic-x86_64.sources.list | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/go-xcat/bionic-ppc64el.sources.list b/xCAT-test/autotest/testcase/go-xcat/bionic-ppc64el.sources.list index 8e1b779ec..e29184320 100644 --- a/xCAT-test/autotest/testcase/go-xcat/bionic-ppc64el.sources.list +++ b/xCAT-test/autotest/testcase/go-xcat/bionic-ppc64el.sources.list @@ -1,3 +1,3 @@ -deb http://ports.ubuntu.com/ubuntu-ports bionic main restricted -deb http://ports.ubuntu.com/ubuntu-ports bionic-updates main restricted -deb http://ports.ubuntu.com/ubuntu-ports bionic-security main restricted +deb http://ports.ubuntu.com/ubuntu-ports bionic main restricted universe +deb http://ports.ubuntu.com/ubuntu-ports bionic-updates main restricted universe +deb http://ports.ubuntu.com/ubuntu-ports bionic-security main restricted universe diff --git a/xCAT-test/autotest/testcase/go-xcat/bionic-x86_64.sources.list b/xCAT-test/autotest/testcase/go-xcat/bionic-x86_64.sources.list index f61a6dcf0..1af261f7a 100644 --- a/xCAT-test/autotest/testcase/go-xcat/bionic-x86_64.sources.list +++ b/xCAT-test/autotest/testcase/go-xcat/bionic-x86_64.sources.list @@ -1,3 +1,3 @@ -deb http://archive.ubuntu.com/ubuntu bionic main restricted -deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted -deb http://archive.ubuntu.com/ubuntu bionic-security main restricted +deb http://archive.ubuntu.com/ubuntu bionic main restricted universe +deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe +deb http://archive.ubuntu.com/ubuntu bionic-security main restricted universe From a89b4b6fd4bf1db27964b4693d8bd1540ee757aa Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 11 Jul 2018 16:56:53 +0800 Subject: [PATCH 8/8] Small modification about rflash ipmi enhance in PR #5346 --- xCAT-server/lib/xcat/plugins/ipmi.pm | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 9207bd4b4..cfba7e458 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2111,26 +2111,24 @@ sub do_firmware_update { # The target machine is *NOT* IBM Power S822LC for Big Data (Supermicro) # Only .hpm files is supported for such machine, no directory option is supported - if (defined $directory_name) { - my ($part1, $part2) = split(/Chassis Part Number :/, $output); - my ($part3, $model) = split(/\s+/, $part2); + if (defined $directory_name and $output =~ /Chassis Part Number\s*:\s*(\S*)/) { + my $model = $1; $exit_with_error_func->($sessdata->{node}, $callback, "Flashing of $model is not supported with pUpdate, supported Model Types: $BIG_DATA_MACHINE_MODELS"); } } # If we fall through here, it is *NOT* IBM Power S822LC for Big Data (Supermicro) and we expact some data in hpm_data_hash. # Verify hpm_data_hash has some values - if ((defined $hpm_data_hash{deviceID}) || - (defined $hpm_data_hash{productID}) || - (defined $hpm_data_hash{manufactureID})) { - if (($hpm_data_hash{deviceID} ne $sessdata->{device_id}) || - ($hpm_data_hash{productID} ne $sessdata->{prod_id}) || - ($hpm_data_hash{manufactureID} ne $sessdata->{mfg_id})) { - $exit_with_error_func->($sessdata->{node}, $callback, "The image file doesn't match target machine: \n$output"); - } - } else { - $exit_with_error_func->($sessdata->{node}, $callback, "No data was extracted from .hpm update file"); + + if (!exists($hpm_data_hash{deviceID}) + || !exists($hpm_data_hash{manufactureID}) + || !exists($hpm_data_hash{productID})) { + $exit_with_error_func->($sessdata->{node}, $callback, "Extract data from .hpm update file failed, no deviceID, productID or manufactureID got"); + } elsif (($hpm_data_hash{deviceID} ne $sessdata->{device_id}) || + ($hpm_data_hash{productID} ne $sessdata->{prod_id}) || + ($hpm_data_hash{manufactureID} ne $sessdata->{mfg_id})) { + $exit_with_error_func->($sessdata->{node}, $callback, "The image file doesn't match target machine: \n$output"); } # check for 8335-GTB Firmware above 1610A release. If below, exit