2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-21 18:50:28 +00:00

Create a function to obtain varables from xCAT tables, transparent on probe functions

This commit is contained in:
Victor Hu
2018-06-25 12:04:43 -04:00
parent 187c972d32
commit 214d0bd5f4

View File

@@ -1134,42 +1134,47 @@ sub check_network_parameter {
return ($rst, $rst_type);
}
sub get_attribute_value {
my $table = shift;
my $attr = shift;
my $cmd_value = "";
my $command_info = `lsdef -t $table -i $attr -c 2>&1`;
if ($command_info =~ /$attr=(\d+)/) {
$cmd_value = $1
}
print_check_result("Checking $table table attribute... $attr=$cmd_value", 0, 0, \@error);
return $cmd_value
}
sub check_daemon_attributes {
my $checkpoint_ref = shift;
my $error_ref = shift;
my $rst = 0;
$rst_type = "w";
my $node_limit = 500;
$$checkpoint_ref = "Checking xCAT daemon attributes configuration...";
@$error_ref = ();
my $node_num = `nodels 2>&1 | wc -l`;
chomp($node_num);
my $xcatmaxconnections = 64;
my $xcatmaxconnections_site = 64;
my $xcatmaxbatchconnections = 50;
my $xcatmaxbatchconnections_site = 50;
my @site_max_info = `lsdef -t site -i xcatmaxconnections,xcatmaxbatchconnections -c 2>&1`;
foreach my $site_max (@site_max_info) {
if ($site_max =~ /xcatmaxconnections=(\d+)/) {
$xcatmaxconnections_site = $1;
}
if ($site_max =~ /xcatmaxbatchconnections=(\d+)/) {
$xcatmaxbatchconnections_site = $1;
my $xcatmaxconnections_site = get_attribute_value("site","xcatmaxconnections");
my $xcatmaxbatchconnections_site = get_attribute_value("site","xcatmaxbatchconnections");
if ($xcatmaxconnections_site != "" and $xcatmaxbatchconnections_site != "") {
if ($xcatmaxbatchconnections_site > $xcatmaxconnections_site) {
push @$error_ref, "Error: xcatmaxbatchconnections > xcatmaxconnections";
$rst = 1;
$rst_type = "f";
} elsif ($xcatmaxconnections_site < $xcatmaxconnections or
$xcatmaxbatchconnections_site < $xcatmaxbatchconnections and
$node_num >= $node_limit) {
push @$error_ref, "Detected >= $node_limnit nodes, refer to xCAT documentation for xCAT daemon tuning recommendations.";
$rst = 1;
}
}
if ($xcatmaxconnections_site <= $xcatmaxbatchconnections_site) {
push @$error_ref, "Attribute xcatmaxbatchconnections must be less than xcatmaxconnections.";
$rst = 1;
$rst_type = "f";
} elsif ($xcatmaxconnections_site < $xcatmaxconnections or
$xcatmaxbatchconnections_site < $xcatmaxbatchconnections and
$node_num >= 500) {
push @$error_ref, "Management nodes are more than 500, please tuning xCAT daemon attributes as document";
$rst = 1;
}
return ($rst, $rst_type);
}