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)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Marek Grac
cluster-qe@redhat.com
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-07 10:08 EDT by Ondrej Faměra
Modified: 2017-10-03 04:52 EDT (History)
3 users (show)

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


Attachments (Terms of Use)

  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):
fence-agents-eaton-snmp-4.0.11-47.el7_3.5.x86_64

=== How reproducible:
Always.

=== 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' '.1.3.6.1.2.1.1.2.0'

.1.3.6.1.2.1.1.2.0 .1.3.6.1.4.1.534.6.6.7

Traceback (most recent call last):
  File "/usr/sbin/fence_eaton_snmp", line 235, in <module>
    main()
  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
    eaton_set_device(conn)
  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.