gnocchixyz / gnocchi

Timeseries database
Apache License 2.0
299 stars 85 forks source link

Updated protobuf module fails Gnocchi installation in devstack #1267

Closed yadneshk closed 2 years ago

yadneshk commented 2 years ago

Gnocchi uses protobuf pip module which is listed as one of the dependencies in global requirements repository. Recently this package and several others were updated.

During devstack installation, when ceilometer_upgrade is executed, gnocchi reports this error and

Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]:   File "/opt/stack/gnocchi/gnocchi/rest/api.py", line 51, in <module>
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]:     from gnocchi.rest.prometheus import remote_pb2
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]:   File "/opt/stack/gnocchi/gnocchi/rest/prometheus/remote_pb2.py", line 33, in <module>
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]:     _descriptor.EnumValueDescriptor(
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]:   File "/opt/stack/.local/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 755, in __new__
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]:     _message.Message._CheckCalledFromGeneratedFile()
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]: TypeError: Descriptors cannot not be created directly.
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]: If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]: If you cannot immediately regenerate your protos, some other possible workarounds are:
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]:  1. Downgrade the protobuf package to 3.20.x or lower.
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]:  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]: More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
Aug 05 08:39:03 devstack devstack@gnocchi-api.service[248241]: unable to load app 0 (mountpoint='') (callable not found or import error)

This commit updates protobuf from 3.20 to 4.21

Regenerating remote_pb2.py with updated protobuf-compiler-3.19.0 fixes this issue.

Which version of Gnocchi are you using

4.4.1.dev180+g5b5bb1ca.d20220805

How to reproduce your problem

Deploy ceilometer + gnocchi using devstack

What is the result that you get

ceilometer_upgrade fails to execute

What is result that you expected

ceilometer_upgrade should complete successfully

yadneshk commented 2 years ago

Changes in protobuf 4.21 https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates