Bug 637154

Summary: SAPInstance and SAPDatabase fail to start/stop/status if /u exists
Product: Red Hat Enterprise Linux 5 Reporter: Alfredo Moralejo <amoralej>
Component: rgmanagerAssignee: Lon Hohberger <lhh>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.5CC: clasohm, cluster-maint, djansa, edamato, fdanapfe, jentrena, linux, rdoty, tscherf, tvvcox
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rgmanager-2.0.52-13.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 639252 (view as bug list) Environment:
Last Closed: 2011-07-21 10:46:47 UTC Type: ---
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: 639252    
Attachments:
Description Flags
cluster.conf for SAP cluster
none
Fix none

Description Alfredo Moralejo 2010-09-24 13:45:58 UTC
Description of problem:


Version-Release number of selected component (if applicable):



How reproducible:

Always

Steps to Reproduce:

1.Build a cluster using current packages versions and create services using at least a resource of type SAPInstance and SAPDatabase.

2. Create directory /u

3. Try to start SAP resources
  
Actual results:

Resources fail to start / stop / status.

Following message is found in logs file for SAPDatabase:

Sep 23 00:08:53 srv00201 clurgmgrd: [12875]: <err> Oracle Listener LISTENER_EPC start failed: su: user ora does not exist
Sep 23 00:08:53 srv00201 clurgmgrd: [12875]: <err> SAP database EPC start failed: This account is currently not available.

Similar messages for SAPInstance resources.

Expected results:

SAP Resources are successfully started.

Additional info:

The problem is related with "tr [:upper:] [:lower:]" commands found in SAPInstance and SAPDatabase resources. These commands fail when a file or directory exist named with one of the characters in "upper" or "lower" as it's not properly interpreted by shell, i.e.:

[amoralej@faemino tmp]$ echo TEST| tr [:upper:] [:lower:]
test
[amoralej@faemino tmp]$ touch u
[amoralej@faemino tmp]$ echo TEST| tr [:upper:] [:lower:]
tr: misaligned [:upper:] and/or [:lower:] construct
[amoralej@faemino tmp]$ rm u
[amoralej@faemino tmp]$ echo TEST| tr [:upper:] [:lower:]
test
[amoralej@faemino tmp]$ touch o
[amoralej@faemino tmp]$ echo TEST| tr [:upper:] [:lower:]
oooo
[amoralej@faemino tmp]$ rm o
[amoralej@faemino tmp]$ echo TEST| tr [:upper:] [:lower:]
test
[amoralej@faemino tmp]$ 

This can be fixed by escaping or using quotes:

[amoralej@faemino tmp]$ echo TEST| tr [:upper:] [:lower:]
tr: misaligned [:upper:] and/or [:lower:] construct
[amoralej@faemino tmp]$ echo TEST| tr [\:upper:\] [\:lower:\]
test
[amoralej@faemino tmp]$ echo TEST| tr '[:upper:]' '[:lower:]'
test
[amoralej@faemino tmp]$ 



I tested it works fine by modifying resource files as follows:




[root@srv00200 cluster]# diff SAPInstance  /etc/cluster/22-sept-2010-backup/SAPInstance.ori-redhat 
571c571 
< sidadm="`echo $SID | tr [\:upper:\] [:lower:]`adm" 
--- 
> sidadm="`echo $SID | tr [:upper:] [:lower:]`adm"  




[root@srv00200 cluster]# diff SAPDatabase  /etc/cluster/22-sept-2010-backup/SAPDatabase.ori-redhat 
191c191 
<   orasid="ora`echo $SID | tr [\:upper:\] [:lower:]`" 
--- 
>   orasid="ora`echo $SID | tr [:upper:] [:lower:]`" 
209c209 
<   orasid="ora`echo $SID | tr [\:upper:\] [:lower:]`" 
--- 
>   orasid="ora`echo $SID | tr [:upper:] [:lower:]`" 
233c233 
<   orasid="ora`echo $SID | tr [\:upper:\] [:lower:]`" 
--- 
>   orasid="ora`echo $SID | tr [:upper:] [:lower:]`" 
492c492 
<   db2sid="db2`echo $SID | tr [\:upper:\] [:lower:]`" 
--- 
>   db2sid="db2`echo $SID | tr [:upper:] [:lower:]`" 
742c742 
<          SUSER="ora`echo $SID | tr [\:upper:\] [:lower:]`" 
--- 
>          SUSER="ora`echo $SID | tr [:upper:] [:lower:]`" 
746c746 
<          SUSER="db2`echo $SID | tr [\:upper:\] [:lower:]`" 
--- 
>          SUSER="db2`echo $SID | tr [:upper:] [:lower:]`" 
982c982 
< sidadm="`echo $SID | tr [\:upper:\] [:lower:]`adm" 
--- 
> sidadm="`echo $SID | tr [:upper:] [:lower:]`adm"

Comment 1 Alfredo Moralejo 2010-09-24 13:57:53 UTC
I only escaped :upper: (in my case the file name was /u), however to fix it completely I should have applied it to lower too:

tr [\:upper:\] [\:lower:\]

Best regards,

Alfredo

Comment 2 Lon Hohberger 2011-01-12 17:09:18 UTC
Can you post a cluster.conf which exhibits this problem?

Comment 3 Alfredo Moralejo 2011-01-12 19:23:51 UTC
Created attachment 473112 [details]
cluster.conf for SAP cluster

I'm attaching cluster.conf for a SAP cluster that exhibits the behavior explained in this bug.

Alfredo

Comment 4 Lon Hohberger 2011-01-12 22:13:04 UTC
Thanks!

Comment 5 Lon Hohberger 2011-01-12 22:31:10 UTC
[lhh@ayanami ~]$ foo="`echo TEST | tr [:upper:] [:lower:]`"
[lhh@ayanami ~]$ echo $foo
test
[lhh@ayanami ~]$ mkdir u
[lhh@ayanami ~]$ foo="`echo TEST | tr [:upper:] [:lower:]`"
tr: misaligned [:upper:] and/or [:lower:] construct
[lhh@ayanami ~]$ foo="`echo TEST | tr \[:upper:\] \[:lower:\]`"
[lhh@ayanami ~]$ echo $foo
test
[lhh@localhost ~]$ orasid="ora`echo $SID | tr [:upper:] [:lower:]`"
[lhh@localhost ~]$ echo $orasid
oraepc
[lhh@localhost ~]$ orasid="ora`echo $SID | tr [:upper:] [:lower:]`"
tr: misaligned [:upper:] and/or [:lower:] construct
[lhh@localhost ~]$ echo $orasid
ora

Note that the escaping is done at different points than in your patch; I'm not quite sure how your patch would work (it seems to escape colons some of the time).

Also, I think I prefer this, since at least one of the existing calls to 'tr' uses single-quotes and none use literal-escapes:

[lhh@localhost ~]$ orasid="ora`echo $SID | tr '[:upper:]' '[:lower:]'`"
[lhh@localhost ~]$ echo $orasid
oraepc

Comment 6 Lon Hohberger 2011-01-12 22:32:27 UTC
Created attachment 473154 [details]
Fix

Comment 8 Frank Danapfel 2011-04-19 12:01:20 UTC
I was now able to verify that the patch for rgmanager fixes this issue:

# rpm -qa|grep -i rgmanager
rgmanager-2.0.52-13.el5
# clustat
Cluster Status for rh_vali @ Tue Apr 19 13:43:14 2011
Member Status: Quorate

 Member Name                                                     ID   Status
 ------ ----                                                     ---- ------
 clusv1                                                              1 Online, Local, RG-Master
 clusv2                                                              2 Online, RG-Worker

 Service Name                                                     Owner (Last)                                                     State         
 ------- ----                                                     ----- ------                                                     -----         
 service:svc_cor_database                                         (none)                                                           disabled      
 service:svc_cor_ers01                                            (none)                                                           disabled      
 service:svc_cor_jc02                                             (none)                                                           stopped       
 service:svc_cor_scs00                                            (none)                                                           stopped

# cd /
# mkdir u
# ll -d /u
drwxr-xr-x 2 root root 4096 Apr 19 13:44 /u

# clusvcadm -e svc_cor_database
Local machine trying to enable service:svc_cor_database...Success
service:svc_cor_database is now running on clusv1
[root@ls3110 /]# clustat
Cluster Status for rh_vali @ Tue Apr 19 13:45:25 2011
Member Status: Quorate

 Member Name                                                     ID   Status
 ------ ----                                                     ---- ------
 clusv1                                                              1 Online, Local, RG-Master
 clusv2                                                              2 Online, RG-Worker

 Service Name                                                     Owner (Last)                                                     State         
 ------- ----                                                     ----- ------                                                     -----         
 service:svc_cor_database                                         clusv1                                                           started       
 service:svc_cor_ers01                                            (none)                                                           disabled      
 service:svc_cor_jc02                                             (none)                                                           stopped       
 service:svc_cor_scs00                                            (none)                                                           stopped

No errors are logged for the SAPDatabase and SAPInstance resource agents. So I think this bug can be moved to verified.

Comment 11 errata-xmlrpc 2011-07-21 10:46:47 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-1000.html