Bug 492294

Summary: fence_apc: user outlet not supported - Connection timeout
Product: Red Hat Enterprise Linux 5 Reporter: Gaetan QUENTIN <gaetan.quentin>
Component: cmanAssignee: Marek Grac <mgrac>
Status: CLOSED NOTABUG QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: low    
Version: 5.2.zCC: cluster-maint, edamato
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-03-27 11:47:22 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:

Description Gaetan QUENTIN 2009-03-26 11:16:39 UTC
Description of problem:

When using fence_apc agent to controle an APC AP7921, we are obliged to use the dm user or the administrator user. When using outlets users - more secure because they see only the associated outlets - the script fails.

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

cman-2.0.94-1.el

How reproducible:


Steps to Reproduce:
1.Declare outlet user in the powerswitch, enable it, and give him an outlet 
2.Use fence_apc :
/sbin/fence_apc2 -o on -a $IP -l $outletuser -p $outletuserpasswd -n $OutletNumber -v

  
Actual results:

Connection Timeout

Expected results:

...
     <ESC>- Main Menu, <ENTER>- Refresh
>Success: [Already] ON  / OFF


Additional info:

The reason is simple:

When the powerswitch show the list of Outlets, with user dm or administrator, we see the whole list:
     1- Outlet 1                 ON
     2- Outlet 2                 ON
...

fence_apc search for this expression in get_power_status:

status = re.compile("\s*"+options["-n"]+"-.*(ON|OFF)", re.IGNORECASE).search(result).group(1)

so it searchs for "$OutletNumber- ... ON|OFF"

It works if there is the whole list since this number is the outlet number too.
But when using the outlet user, list is not ordonned like that. For example:

1- Outlet 2                 ON
2- Outlet 4                 ON


We must change the regex like that:

status = re.compile("\s*"+"Outlet "+options["-n"]+".*(ON|OFF)", re.IGNORECASE).search(result).group(1)



Regards,
Gaetan.

Comment 1 Marek Grac 2009-03-27 11:47:22 UTC
I understand your problem but this is not a bug. Your patch can work for you but quite a lot of users uses aliases so there is no such thing as 'Outlet 2'. On APC these aliases does not have to be unique. Only unique number is one that we are parsing. 

Currently we are extending our fence agent to support option '-o list' which will show you 'outlet number -> alias' mapping. Then using conga you will be able to select proper outlet number much more easier.