Created attachment 351634 [details] fence scsi minimum node check Description of problem: fence_scsi does not check for a minimum node count, which in turn customers will configure two node clusters with a fence_scsi agent. The attached proposed patch does just that. I will parse the /proc/cluster/status file for node count and if it is less than or equal to two, it will exit out. Version-Release number of selected component (if applicable): RHEL4 and RHEL5 How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: --- /sbin/fence_scsi_test 2009-04-22 13:38:58.000000000 -0400 +++ fence_scsi_test.new 2009-07-14 16:40:30.000000000 -0400 @@ -14,6 +14,21 @@ $REDHAT_COPYRIGHT=("Copyright (C) Red Ha $BUILD_DATE="(built Wed Apr 22 13:38:56 EDT 2009)"; #END_VERSION_GENERATION +sub node_check +{ +# This will check the number of nodes and restrict the completion +# of setup if the requirement is not meet. +# (nodes >= 3) + open(FH, "/proc/cluster/status") or die "can't open status file: $!\n"; + + while(<FH>){ + my @pars = split(":"); + print "The minimum node count does not meet the requirement (3+nodes).\n" if ($pars[0] eq "Nodes" && $pars[1] <= 2); + } + close(FH); + exit 0; +} + sub get_scsi_block_devices { my $block_dir = "/sys/block"; @@ -189,6 +204,8 @@ sub print_usage ### MAIN ####################################################################### +node_check; + if (getopts("cdhst:v") == 0) { print_usage;
this need some rethinking....