Debian: Sensor group create fails due to sysinv api text to db bool conversion

Bug #1977517 reported by Heitor Matsui
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
Heitor Matsui

Bug Description

Brief Description
-----------------
System inventory is rejecting all attempts to create a sensor group.

The hardware monitor sends the suppress member of the group as a boolean string "False | True". In CentOS this was fine. However the Debian version of sqlalchemy's type filters have gotten stricter and is now rejecting sysinv's attempt to pass a "False" string into the database's 'suppress' bool field.

See logs below.

Severity
--------
Critical/Major: Hardware Monitoring feature cannot be used

Steps to Reproduce
------------------
Provision a BMC

Expected Behavior
------------------
Sensor groups get created and monitored

Actual Behavior
----------------
Sensor groups fail to create

Reproducibility
---------------
100% reproducible

System Configuration
--------------------
Any system with provisionable BMCs

Branch/Pull Time/Commit
-----------------------
master 2022-06-02

Last Pass
---------
N/A

Timestamp/Logs
--------------
sysinv.log

sysinv 2022-05-29 20:27:14.006 77450 WARNING oslo_db.sqlalchemy.exc_filters [-] DB exception wrapped.: TypeError: Not a boolean value: 'False'
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters Traceback (most recent call last):
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1204, in _execute_context
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters context = constructor(dialect, self, conn, *args)
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 874, in _init_compiled
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters param = dict(
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 877, in <genexpr>
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters processors[key](compiled_params[key])
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/lib/python3/dist-packages/sqlalchemy/sql/sqltypes.py", line 1841, in process
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters value = _strict_as_bool(value)
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters File "/usr/lib/python3/dist-packages/sqlalchemy/sql/sqltypes.py", line 1816, in _strict_as_bool
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters raise TypeError("Not a boolean value: %r" % value)
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters TypeError: Not a boolean value: 'False'
2022-05-29 20:27:14.006 77450 ERROR oslo_db.sqlalchemy.exc_filters

Test Activity
-------------
Debian Integration Testing

Workaround
----------
Exclude the suppress key/value member from sensor and group creation requests.
A code change workaround. https://review.opendev.org/c/starlingx/metal/+/843139

Changed in starlingx:
assignee: nobody → Heitor Matsui (heitormatsui)
Changed in starlingx:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to config (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/starlingx/config/+/848026

Ghada Khalil (gkhalil)
tags: added: stx.config stx.debian
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to config (master)

Reviewed: https://review.opendev.org/c/starlingx/config/+/848026
Committed: https://opendev.org/starlingx/config/commit/ebd16cc31b096b41e3e08d1bb1a2f4cbd93f7774
Submitter: "Zuul (22348)"
Branch: master

commit ebd16cc31b096b41e3e08d1bb1a2f4cbd93f7774
Author: Heitor Matsui <email address hidden>
Date: Tue Jun 28 17:35:17 2022 -0300

    Align API types with database types

    In more recent versions of SQLAlchemy library the datatypes
    filters are stricter and now rejects strings with boolean values
    such as "True"/"False" to a field mapped as boolean in the
    underlying database.

    This commit:

    1. Aligns fields with API types mapped as string but with its
    database counterparts mapped as boolean, also changing places
    where the value was being compared as a string

    2. Fixes the bool_or_none function used to parse boolean types,
    as it was returning True when strings like 'false', 'n' and 'no'
    were passed as parameter

    3. Removes code from sensor and sensorgroup API that was checking
    the now boolean field against string values (confirmed that there
    are no references to force-action in hwmon code on metal repo)

    Test Plan:
    PASS: install/bootstrap/unlock host
    PASS: test cgtsclient system commands for changed attributes:
          - host: ttys_dcd
            (verified manifest apply msg on logs)
          - memory: hugepages_configured, vm_pending_as_percentage,
                    vm_hugepages_use_1G
            (executed "grep Huge /proc/meminfo" after host-unlock)
          - sensor: suppress
            (verified suppress/unsuppress msgs on logs)
          - sensorgroup: suppress
            (verified suppress/unsuppress msgs on logs)
            (verified propagated suppress/suppress msgs on logs)
    PASS: run AIO-SX upgrade successfully
    PASS: all of the above on Debian (except upgrade)

    Closes-bug: 1977517
    Change-Id: Ie78f98b1b6141dc7ea5e4a125c64d50e1993f582
    Signed-off-by: Heitor Matsui <email address hidden>

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Medium
tags: added: stx.7.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.