diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index b4df1e5f4..f1d66c2a2 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -348,20 +348,21 @@ sub is_http_ready { sub is_tftp_ready { my $mnip = shift; $mnip = shift if (($mnip) && ($mnip =~ /probe_utils/)); - - rename("/tftpboot/tftptestt.tmp", "/tftpboot/tftptestt.tmp.old") if (-e "/tftpboot/tftptestt.tmp"); + my $tftpdir = shift; + + rename("/$tftpdir/tftptestt.tmp", "/$tftpdir/tftptestt.tmp.old") if (-e "/$tftpdir/tftptestt.tmp"); rename("./tftptestt.tmp", "./tftptestt.tmp.old") if (-e "./tftptestt.tmp"); - system("touch /tftpboot/tftptestt.tmp"); + system("touch /$tftpdir/tftptestt.tmp"); my $output = `tftp -4 -v $mnip -c get tftptestt.tmp`; if ((!$?) && (-e "./tftptestt.tmp")) { unlink("./tftptestt.tmp"); rename("./tftptestt.tmp.old", "./tftptestt.tmp") if (-e "./tftptestt.tmp.old"); - rename("/tftpboot/tftptestt.tmp.old", "/tftpboot/tftptestt.tmp") if (-e "/tftpboot/tftptestt.tmp.old"); + rename("/$tftpdir/tftptestt.tmp.old", "/$tftpdir/tftptestt.tmp") if (-e "/$tftpdir/tftptestt.tmp.old"); return 1; } else { rename("./tftptestt.tmp.old", "./tftptestt.tmp") if (-e "./tftptestt.tmp.old"); - rename("/tftpboot/tftptestt.tmp.old", "/tftpboot/tftptestt.tmp") if (-e "/tftpboot/tftptestt.tmp.old"); + rename("/$tftpdir/tftptestt.tmp.old", "/$tftpdir/tftptestt.tmp") if (-e "/$tftpdir/tftptestt.tmp.old"); return 0; } } diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 9a1c212e5..16caf25d9 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -90,43 +90,45 @@ sub do_main_job { $rc |= $rst; #check important directory - $checkpoint = "Important directory is configured correctly"; - $rst = check_directory(\%sitetable, \@error); + my @dir_list = ("installdir", "tftpdir"); + my $dir_list_str = join(",",@dir_list); + $checkpoint = "Important directory ($dir_list_str) is configured correctly"; + $rst = check_directory(\@dir_list, \%sitetable,\@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check if SElinux is disabled - $checkpoint = "SELinux is disabled on current server"; + $checkpoint = "SELinux is disabled"; $rst = check_selinux(\@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check http service - $checkpoint = "HTTP service works well"; + $checkpoint = "HTTP service is configured well"; $rst = check_http_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check tftp service - $checkpoint = "TFTP service works well"; + $checkpoint = "TFTP service is configured well"; $rst = check_tftp_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check DNS service - $checkpoint = "DNS service works well"; + $checkpoint = "DNS service is configured well"; $rst = check_dns_service(\%sitetable, $installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check DHCP service - $checkpoint = "DHCP service works well"; + $checkpoint = "DHCP service is configured well"; $rst = check_dhcp_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check NTP service - $checkpoint = "NTP service works well"; + $checkpoint = "NTP service is configured well"; $rst = check_ntp_service(\@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; @@ -134,14 +136,19 @@ sub do_main_job { #Below are the 'warning` level check points #check if firewall is close - $checkpoint = "Firewall is closed on current server"; + $checkpoint = "Firewall is disabled"; $rst = check_firewall(\@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; #check disk space - $checkpoint = "The disk space is enough for xCAT to work"; - $rst = check_disk(\@error); + my %dir_expectedspace_list = ("/var" => 1, "/tmp" => 1, "/install" => 10); + my $disk_str="at least "; + foreach (keys %dir_expectedspace_list){ + $disk_str.="$_ needs $dir_expectedspace_list{$_}G. "; + } + $checkpoint = "The disk space is enough for xCAT to work, $disk_str"; + $rst = check_disk(\%dir_expectedspace_list, \@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; @@ -150,7 +157,7 @@ sub do_main_job { if (!$is_sn) { #check if server ip is a static ip in MN - $checkpoint = "The IP of master is a static IP address"; + $checkpoint = "The xCAT management node IP: <$installnicip> is configured to static"; $rst = check_server_ip_static($installnicip, \@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; @@ -454,19 +461,20 @@ sub check_server_ip_static { sub check_directory { + my $dir_list_ref = shift; my $sitetable_ref = shift; my $error_ref = shift; my $rst = 0; @$error_ref = (); my @dir_list = ("installdir", "tftpdir"); - foreach my $dir (@dir_list) { + foreach my $dir (@{$dir_list_ref}) { if ($sitetable_ref->{$dir} eq "") { push @$error_ref, "There isn't '$dir' definition in 'site' table"; $rst = 1; } else { if (!-e "$sitetable_ref->{$dir}") { - push @$error_ref, "There isn't '$sitetable_ref->{$dir}' directory on current server"; + push @$error_ref, "There isn't '$sitetable_ref->{$dir}' directory on current server, there is something wrong during xCAT installation"; $rst = 1; } else { if ($is_sn) { @@ -484,7 +492,7 @@ sub check_directory { } if ($mountip ne $sitetable_ref->{master}) { - push @$error_ref, "$dir '$sitetable_ref->{$dir}' isn't mounted from the management node"; + push @$error_ref, "$dir '$sitetable_ref->{$dir}' isn't mounted from the management node,please check SN's configuration"; $rst = 1; } } @@ -497,19 +505,19 @@ sub check_directory { sub check_disk { + my $dir_expectedspace_list_ref = shift; my $error_ref = shift; my $rst = 0; @$error_ref = (); - my %dir_expectedspace_list = ("/var" => 1, "/tmp" => 1, "/install" => 10); my %mountpointinfo; - foreach my $dir (keys %dir_expectedspace_list) { + foreach my $dir (keys %{$dir_expectedspace_list_ref}) { my $output = `df --block-size=1G $dir|tail -n 1`; chomp($output); my @splitoutput = split(" ", $output); $mountpointinfo{ $splitoutput[5] }{available} = $splitoutput[3]; - $mountpointinfo{ $splitoutput[5] }{need} += $dir_expectedspace_list{$dir}; + $mountpointinfo{ $splitoutput[5] }{need} += $dir_expectedspace_list_ref->{$dir}; push @{ $mountpointinfo{ $splitoutput[5] }{mount} }, $dir; } @@ -517,7 +525,7 @@ sub check_disk { foreach $mountpoint (keys %mountpointinfo) { if ($mountpointinfo{$mountpoint}{need} > $mountpointinfo{$mountpoint}{available}) { foreach (@{ $mountpointinfo{$mountpoint}{mount} }) { - $msg .= "'$_' needs $dir_expectedspace_list{$_} GiB disk space. "; + $msg .= "'$_' needs $dir_expectedspace_list_ref->{$_} GiB disk space. "; } my $mountmun = $#{$mountpointinfo{$mountpoint}{mount}} +1 ; if($mountmun >1){ @@ -606,9 +614,21 @@ sub check_tftp_service { $rst = 1; } else { $msg = "TFTP service is ready on $serverip"; - if (!probe_utils->is_tftp_ready("$serverip")) { - push @$error_ref, "TFTP service isn't ready on $serverip"; + my $tftpdir = `lsdef -t site -i tftpdir -c | awk -F'=' '{print \$2}'`; + chomp($tftpdir); + if($tftpdir eq ""){ + push @$error_ref, "TFTP work path isn't configured in 'sit' table"; $rst = 1; + }else{ + if(! -d "$tftpdir"){ + push @$error_ref, "There isn't '/tftpboot' directory on current server"; + $rst = 1; + }else{ + if (!probe_utils->is_tftp_ready("$serverip", $tftpdir)) { + push @$error_ref, "TFTP service isn't ready on $serverip"; + $rst = 1; + } + } } } } else {