2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-11-20 01:06:02 +00:00

Merge pull request #5393 from xcat2/master

Merge master to 2.14 branch for 2.14.2 release(2)
This commit is contained in:
zet809
2018-07-11 17:28:04 +08:00
committed by GitHub
6 changed files with 38 additions and 17 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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)) {
@@ -2040,6 +2041,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});
@@ -2105,13 +2107,28 @@ 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 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 (($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");
# 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 (!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

View File

@@ -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

View File

@@ -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

View File

@@ -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