Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1588406

Summary: gnocchi with ceph backend and cradox 1.3.2 hits AttributeError when accesing rados.InvalidArgumentError
Product: Red Hat OpenStack Reporter: Pavel Sedlák <psedlak>
Component: gnocchiAssignee: Mehdi ABAAKOUK <mabaakou>
Status: CLOSED DUPLICATE QA Contact: Sasha Smolyak <ssmolyak>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 13.0 (Queens)CC: apevec, jjoyce, jschluet, lhh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-07 12:59:30 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:
Attachments:
Description Flags
gnocchi-upgrade-out.log
none
gnocchi-upgrade-out.log none

Description Pavel Sedlák 2018-06-07 08:57:10 UTC
Created attachment 1448650 [details]
gnocchi-upgrade-out.log

At least gnocchi-upgrade command, gnocchi db sync, can hit issue in handling exceptions,
when using cradox inside ceph storage backend code,
such that cradox (in code aliased as 'rados') does not have InvalidArgumentError class

> 2018-06-06 08:05:23,307 [21] INFO     gnocchi.cli.manage: Upgrading indexer SQLAlchemyIndexer: mysql+pymysql://gnocchi:VzYR8Qsf34X4Rr8HsnCmEHkjD.1.19/gnocchi?read_default_group=tripleo&read_default_file=/etc/my.cnf.d/tripleo.cnf
> 2018-06-06 08:05:23,585 [21] INFO     gnocchi.common.ceph: Ceph storage backend use 'cradox' python library
> 2018-06-06 08:05:23,633 [21] ERROR    gnocchi.utils: Unable to initialize storage driver
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/tenacity/__init__.py", line 298, in call
>     result = fn(*args, **kwargs)
>   File "/usr/lib/python2.7/site-packages/gnocchi/storage/__init__.py", line 117, in get_driver
>     conf.storage, coord)
>   File "/usr/lib/python2.7/site-packages/gnocchi/storage/ceph.py", line 48, in __init__
>     self.rados, self.ioctx = ceph.create_rados_connection(conf)
>   File "/usr/lib/python2.7/site-packages/gnocchi/common/ceph.py", line 70, in create_rados_connection
>     except rados.InvalidArgumentError:
> AttributeError: 'module' object has no attribute 'InvalidArgumentError'
> 2018-06-06 08:05:24,636 [21] INFO     gnocchi.common.ceph: Ceph storage backend use 'cradox' python library
> 2018-06-06 08:05:24,668 [21] ERROR    gnocchi.utils: Unable to initialize storage driver
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/tenacity/__init__.py", line 298, in call
>     result = fn(*args, **kwargs)
>   File "/usr/lib/python2.7/site-packages/gnocchi/storage/__init__.py", line 117, in get_driver
>     conf.storage, coord)
>   File "/usr/lib/python2.7/site-packages/gnocchi/storage/ceph.py", line 48, in __init__
>     self.rados, self.ioctx = ceph.create_rados_connection(conf)
>   File "/usr/lib/python2.7/site-packages/gnocchi/common/ceph.py", line 70, in create_rados_connection
>     except rados.InvalidArgumentError:
> AttributeError: 'module' object has no attribute 'InvalidArgumentError'
> 2018-06-06 08:05:26,671 [21] INFO     gnocchi.common.ceph: Ceph storage backend use 'cradox' python library

// Other thing would be that even such internal code bug seems to keep gnocchi-upgrade cli in a loop ... but maybe there is some other reason for it?

Seems that this was modified in cradox already,
it's InvalidArgument class was renamed to InvalidArgumentError about a year ago
in https://github.com/sileht/pycradox/commit/2677c9ce907240b2bb4587cc80b3b87e4efb14b4#diff-a6287cd9d3fe6b277b02b08dd09a0c37L310
based on github ui seems it's tagged in 2.0(.7) versions.

But in gnocchi currently set minimal version is cradox>=1.2.0
https://github.com/gnocchixyz/gnocchi/blob/c43eac1ff19f6ae4a08b7386f9eeb5e41d4a448d/setup.cfg#L78

Possibly, solutions could be to in gnochhi bump required cradox version >2,
or add extra handling of possible miscompatibilities (at least alias InvalidArgument as InvalidArgumentError?),
or also backport of this renaming in cradox itself (but i have no idea about policies for such thing neither the scope of it)?

Observed with Red Hat OSP (13), when another bug caused missing keyring files.
> python-gnocchi-4.2.3-3.el7ost.noarch
> python-cradox-1.3.2-2.el7ost.x86_64.rpm

Comment 1 Pavel Sedlák 2018-06-07 09:00:24 UTC
Created attachment 1448651 [details]
gnocchi-upgrade-out.log

Comment 2 Mehdi ABAAKOUK 2018-06-07 12:59:30 UTC

*** This bug has been marked as a duplicate of bug 1573878 ***