Bug 1459586 - RFE: Improve handling of unknown devices by fence_eaton_snmp
RFE: Improve handling of unknown devices by fence_eaton_snmp
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: fence-agents (Show other bugs)
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Marek Grac
: FutureFeature
Depends On:
  Show dependency treegraph
Reported: 2017-06-07 10:08 EDT by Ondrej Faměra
Modified: 2018-04-02 07:55 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3397261 None None None 2018-04-02 07:55 EDT

  None (edit)
Description Ondrej Faměra 2017-06-07 10:08:36 EDT
=== Description of problem:
When the fence_eaton_snmp is used against device not supported
by it as seen from the source code of the agent it crashes with python
traceback. A simple listing of supported devices would be a better output 
so we can distinguish between "potentially broken fence agent" and "unsupported device".
From the code it looks that we would just need to check if the supported OIDs are present.

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

=== How reproducible:

=== Steps to Reproduce:
1. Run command below against unsupported EATON device
fence_eaton_snmp --ip=192.168.X.X --community=public --username=admin --password=admin --plug=1 --action=status --verbose

=== Actual results:
/usr/bin/snmpwalk -m '' -Oeqn  -v '1' -c 'public' '192.168.X.X:161' '.'

. .

Traceback (most recent call last):
  File "/usr/sbin/fence_eaton_snmp", line 235, in <module>
  File "/usr/sbin/fence_eaton_snmp", line 231, in main
    result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
  File "/usr/share/fence/fencing.py", line 974, in fence_action
    status = get_multi_power_fn(tn, options, get_power_fn)
  File "/usr/share/fence/fencing.py", line 880, in get_multi_power_fn
    plug_status = get_power_fn(tn, options)
  File "/usr/sbin/fence_eaton_snmp", line 128, in get_power_status
    eaton_resolv_port_id(conn, options)
  File "/usr/sbin/fence_eaton_snmp", line 91, in eaton_resolv_port_id
  File "/usr/sbin/fence_eaton_snmp", line 83, in eaton_set_device
    device = agents_dir[eaton_type[0][1]]
KeyError: None

=== Expected results:
Message in below style:
The device that you are trying to connect doesn't look to be supported by this fencing agent. 

Following devices were tested with this agentto work:
 - Eaton ePDU Managed - SNMP v1
   EATON | Powerware ePDU model: Managed ePDU (PW104MA0UB99), firmware: 01.01.01
 - Eaton ePDU Switched - SNMP v1
   EATON | Powerware ePDU model: Switched ePDU (IPV3600), firmware: 2.0.K

=== Additional info:
The list of tested devices is from the fencing agent itself.

Note You need to log in before you can comment on or make changes to this bug.