Bug 1265527

Summary: sap_redhat_cluster_connector does not work correctly with hostnames of SAP instances containing "-"
Product: Red Hat Enterprise Linux 7 Reporter: Matthieu <matthieu>
Component: resource-agentsAssignee: Oyvind Albrigtsen <oalbrigt>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.1CC: abeekhof, agk, cfeist, cluster-maint, fdanapfe, fdinitto, ichute, jkortus, matthieu, mnovacek, oalbrigt, rmccabe
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: resource-agents-3.9.5-67.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1269897 (view as bug list) Environment:
Last Closed: 2016-11-03 23:58:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1018952, 1289025, 1364088    
Attachments:
Description Flags
Patch bug #1265527 none

Description Matthieu 2015-09-23 07:14:14 UTC
Description of problem:


Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 7.1 (Maipo)
pacemaker-1.1.12-22.el7_1.2.x86_64
resource-agents-sap-3.9.5-40.el7_1.6.x86_64

How reproducible:
The virtual name of the SAP instance must contain a "-"

Steps to Reproduce:
Install RHEL 7 with pacemaker cluster and resource-agents-sap to manage SAP

Profile name for SAP are :
  - PE1_ASCS00_pe1-ascs  
  - PE1_D02_pe1-d02  
  - PE1_DVEBMGS01_pe1-d01  
  - PE1_ERS11_pe1-aers

Actual results:
/usr/sbin/sap_redhat_cluster_connector lsr --out /root/mfa.txt --sid PE1 --ino 11
Aug 24 17:32:42 frbsluxc07 sap_redhat_cluster_connector[9129]: lsr call (out=/tmp/sapha-tmp-mlAz6p,sid=PE1,ino=11)
Aug 24 17:32:42 frbsluxc07 sap_redhat_cluster_connector[9129]: lsr result: empty
Aug 24 17:32:42 frbsluxc07 sap_redhat_cluster_connector[9129]: TEST END

Expected results:
/usr/sbin/sap_redhat_cluster_connector lsr --out /root/mfa.txt --sid PE1 --ino 11
Aug 24 17:46:21 frbsluxc07 sap_redhat_cluster_connector[28388]: lsr call (out=/root/mfa.txt,sid=PE1,ino=11)
Aug 24 17:46:21 frbsluxc07 sap_redhat_cluster_connector[28388]: lsr result: PE1:11:p_SAP_ascs00:ms_PE1_ASCS_AERS:-
Aug 24 17:46:21 frbsluxc07 sap_redhat_cluster_connector[28388]: TEST END


Additional info:

I apply this patch, and now it works for me :

--- /usr/sbin/sap_redhat_cluster_connector.orig	2015-08-24 17:26:10.000000000 +0200
+++ /usr/sbin/sap_redhat_cluster_connector	2015-08-24 17:26:28.000000000 +0200
@@ -242,7 +242,7 @@ sub list_sap_resources {

 	$ENV{'PATH'} = $ENV{'PATH'} . ":/usr/sbin:/sbin";
 	#printf "LSR\n";
-	printf "PARAMS: (out, sid, ino) = ( %s, %s, %s)\n", $out, $sid, $ino ;
+	#printf "PARAMS: (out, sid, ino) = ( %s, %s, %s)\n", $out, $sid, $ino ;
 	#printf "ARGV: %s", join(" ", @ARGV);

 	my ($fclass, $fprovider, $fra, $fname, $fgname) = ("","","","","");
@@ -251,13 +251,13 @@ sub list_sap_resources {
 	open CRMOUT, "$cmd_cibadmin --local -Q --xpath '//primitive[\@type=\"$sra\"]' --node-path 2>/dev/null |" || die "could not open cibadmin output";
 	while (<CRMOUT>) {
 		my $line = $_;
-		if ($line =~ /primitive..id='([a-zA-Z0-9_]+)'/) {
+		if ($line =~ /primitive..id='([a-zA-Z0-9_-]+)'/) {
 			($fname) = ($1);
 		} else {
 			next;
 		}

-		if ( $line =~ /[group|master|clone]..id='([a-zA-Z0-9_]+)'/) {
+		if ( $line =~ /[group|master|clone]..id='([a-zA-Z0-9_-]+)'/) {
 			($fgname) = ($1);
 		}

@@ -265,7 +265,7 @@ sub list_sap_resources {
 			open RESOURCE1_OUT, "$cmd_cibadmin -Q --xpath \"//primitive[\@id='$fname']//nvpair[\@name='$sparam']\"  2>/dev/null |" || die "could not open cibadmin output";
 			while (<RESOURCE1_OUT>) {
 				my $result = $_;
-				if ($result =~ /value="([a-zA-Z0-9_]+)"/) {
+				if ($result =~ /value="([a-zA-Z0-9_-]+)"/) {
 					my $finstance=$1;
 					if ( $1 =~ /^${sid}_[a-zA-Z0-9]+${ino}_[a-zA-Z0-9_-]+$/ ) {
 						$foundRes=1;
@@ -279,7 +279,7 @@ sub list_sap_resources {
 			open RESOURCE2_OUT, "$cmd_cibadmin -Q --xpath \"//primitive[\@id='$fname']//nvpair[\@name='$sparam2']\"  2>/dev/null |" || die "could not open cibadmin output";
 			while (<RESOURCE2_OUT>) {
 				my $result = $_;
-				if ($result =~ /value="([a-zA-Z0-9_]+)"/) {
+				if ($result =~ /value="([a-zA-Z0-9_-]+)"/) {
 					my $finstance=$1;
 					if ( $1 =~ /^${sid}_[a-zA-Z0-9]+${ino}_[a-zA-Z0-9_-]+$/ ) {
 						$foundRes=1;
@@ -306,6 +306,7 @@ sub list_sap_resources {
 		}
 	}

+	printf $foundRes;
 	if ($foundRes==1) {
 		if ($out eq "") {
 			printf "%s:%s:%s\n", $fname, $fgname, "-";
@@ -488,7 +489,6 @@ if  ($cmd eq "init")  {
 	                   "ino=s" => \$ino,
 	                   "out=s" => \$out,
 		 ) &&
-
 	checkavail(($sid, $ino, $out)) || paramproblem();
 	syslog("LOG_INFO", "lsr call (out=%s,sid=%s,ino=%s)", $out, $sid, $ino);
 	$return_code=list_sap_resources($out, $sid, $ino);

Comment 2 Frank Danapfel 2015-09-23 13:07:25 UTC
Updated bug title to make it match hte description of the issue.

qMatthieu: thank you fro reporting this issue and providing a patch. We'll have a look at it and try to fix it in one of the next releases.

Could you please add the patch as an attachment to this bugzilla?

Comment 3 Matthieu 2015-09-24 13:24:00 UTC
Created attachment 1076548 [details]
Patch bug #1265527

Comment 4 Frank Danapfel 2015-10-01 13:24:32 UTC
I've tested the patch and did not find any issues with it. I'll now start working on getting it integrated upstream so that it can be added in RHEL as well.

@Matthieu: is there a specific reason why you added the "printf $foundRes;", or was that just for debugging purposes?

Comment 5 Matthieu 2015-10-02 07:28:56 UTC
(In reply to Frank Danapfel from comment #4)
> @Matthieu: is there a specific reason why you added the "printf $foundRes;",
> or was that just for debugging purposes?

Yes, just to help me to debug.

Comment 6 Frank Danapfel 2015-11-18 13:03:54 UTC
Patch has been tested and integrated upstream:
https://github.com/ClusterLabs/sap_cluster_connector/commit/8847d398f72ad1211de1cd50ffbbcc658977d274

Comment 10 errata-xmlrpc 2016-11-03 23:58:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2174.html