Bug 1670460

Summary: fence_rhevm is limited to ASCII content only, throwing stack-trace on UTF-8 characters
Product: Red Hat Enterprise Linux 7 Reporter: Andreas Bleischwitz <ableisch>
Component: fence-agentsAssignee: Oyvind Albrigtsen <oalbrigt>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.6CC: bugzilla-redhat, cfeist, cluster-maint, dmoppert, michele.sandro.emma, mjuricek, nhostako, rbeyel
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: fence-agents-4.2.1-21.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1712263 (view as bug list) Environment:
Last Closed: 2019-08-06 12:34:23 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: 1712263, 1716704    

Description Andreas Bleischwitz 2019-01-29 15:10:29 UTC
Description of problem:
When using "fence_rhevm" for fencing of virtual machines in RHV, neither the "Comment", nor the "Description" field of said vm must contain non ASCII-characters

Version-Release number of selected component (if applicable):
fence-agents-rhevm-4.2.1-11.el7_6.1.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create VM "test" in RHV, Comment = "ÄÖÜ"
2. Invoke fence_rhevm -o status ... test
3.

Actual results:
Stack-trace:
Traceback (most recent call last):
  File "/usr/sbin/fence_rhevm_old", line 200, in <module>
    main()
  File "/usr/sbin/fence_rhevm_old", line 195, in main
    result = fence_action(None, options, set_power_status, get_power_status, get_list)
  File "/usr/share/fence/fencing.py", line 884, in fence_action
    status = get_multi_power_fn(connection, options, get_power_fn)
  File "/usr/share/fence/fencing.py", line 752, in get_multi_power_fn
    plug_status = get_power_fn(connection, options)
  File "/usr/sbin/fence_rhevm_old", line 19, in get_power_status
    res = send_command(options, "vms/?search=name%3D" + options["--plug"])
  File "/usr/sbin/fence_rhevm_old", line 131, in send_command
    result = web_buffer.getvalue().decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2459: ordinal not in range(128)


Expected results:
Status: ON|OFF

Additional info:

Comment 2 Andreas Bleischwitz 2019-01-29 15:15:32 UTC
There is a pull request which at least solves the status issue, there still seem to be an issue when using "-v" and non ASCII-characters:

# fence_rhevm -o status -v --ssl --ssl-insecure -a <rhev-ip> --username <user@domain> --password=<password> --disable-http-filter --ipport 443 -n <vm-name>

2019-01-29 16:08:15,198 DEBUG: vms/?search=name%3Dtest

Traceback (most recent call last):
  File "/usr/sbin/fence_rhevm", line 202, in <module>
    main()
  File "/usr/sbin/fence_rhevm", line 197, in main
    result = fence_action(None, options, set_power_status, get_power_status, get_list)
  File "/usr/share/fence/fencing.py", line 884, in fence_action
    status = get_multi_power_fn(connection, options, get_power_fn)
  File "/usr/share/fence/fencing.py", line 752, in get_multi_power_fn
    plug_status = get_power_fn(connection, options)
  File "/usr/sbin/fence_rhevm", line 19, in get_power_status
    res = send_command(options, "vms/?search=name%3D" + options["--plug"])
  File "/usr/sbin/fence_rhevm", line 136, in send_command
    logging.debug("%s\n", result)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1619, in debug
    root.debug(msg, *args, **kwargs)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1137, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1268, in _log
    self.handle(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1278, in handle
    self.callHandlers(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1318, in callHandlers
    hdlr.handle(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 749, in handle
    self.emit(record)
  File "/usr/share/fence/fencing.py", line 1074, in emit
    syslog.syslog(syslog_level, msg.replace("\x00", "\n"))
TypeError: [priority,] message string

Comment 3 Sandro 2019-01-30 08:57:47 UTC
Info: PR got merged

Comment 5 Sandro 2019-02-13 12:40:57 UTC
Is there a plan when this will get packaged and shipped to the rhn channels ?

Comment 6 Chris Feist 2019-02-13 20:50:54 UTC
Sandro,

Unfortunately we don't have an exact date as to when this will be available in Red Hat, however, if you contact your Red Hat support team they can escalate the request and help us to prioritize to get this fix out sooner.

Thanks,
Chris

Comment 21 Doran Moppert 2019-06-04 01:07:37 UTC
This issue was assigned CVE-2019-10153:  bug 1716286.

Comment 23 errata-xmlrpc 2019-08-06 12:34:23 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://access.redhat.com/errata/RHSA-2019:2037