in Tools&Framework/azsapsca/patterns/AZSAP/totem.pl [59:99]
sub checkTotemConfiguration {
SDP::Core::printDebug('> checkTotemConfiguration', 'BEGIN');
my $RCODE = 0;
my $FILE_OPEN = 'ha.txt';
my $SECTION = 'corosync.conf';
my @CONTENT = ();
my $RRP_MODE = 'none';
my $RRP_RINGS = 0;
if ( SDP::Core::getSection($FILE_OPEN, $SECTION, \@CONTENT) ) {
foreach $_ (@CONTENT) {
next if ( m/^\s*$/ ); # Skip blank lines
if ( /^\s*rrp_mode:\s+(.*)/ ) {
$RRP_MODE = $1;
} elsif ( /\sringnumber:/ ) {
$RRP_RINGS++;
}
}
if ( $RRP_RINGS > 1 ) {
if ( $RRP_MODE =~ m/active/ ) {
SDP::Core::updateStatus(STATUS_ERROR, "Valid: rrp_mode=$RRP_MODE for $RRP_RINGS rings");
} elsif ( $RRP_MODE =~ m/passive/ ) {
SDP::Core::updateStatus(STATUS_ERROR, "Valid: rrp_mode=$RRP_MODE for $RRP_RINGS rings");
} else {
SDP::Core::updateStatus(STATUS_WARNING, "Invalid: rrp_mode=$RRP_MODE for $RRP_RINGS rings, should be rrp_mode=active/passive");
}
} elsif ( $RRP_RINGS == 1 ) {
if ( $RRP_MODE =~ m/none/ ) {
SDP::Core::updateStatus(STATUS_ERROR, "Valid: rrp_mode=$RRP_MODE for $RRP_RINGS ring");
} else {
SDP::Core::updateStatus(STATUS_WARNING, "Invalid: rrp_mode=$RRP_MODE for $RRP_RINGS ring, should be rrp_mode=none");
}
} else {
SDP::Core::updateStatus(STATUS_ERROR, "No rrp rings found");
}
} else {
SDP::Core::updateStatus(STATUS_ERROR, "ERROR: checkTotemConfiguration(): Cannot find \"$SECTION\" section in $FILE_OPEN");
}
SDP::Core::printDebug("< checkTotemConfiguration", "Returns: $RCODE");
return $RCODE;
}