gnocchi upgrade from newton to ocata fails

Bug #1684246 reported by Pradeep Kilambi
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
Undecided
Julien Danjou

Bug Description

 upgrade from newton to ocata fails with this error

2017-04-19 17:37:00.603 1009402 INFO alembic.runtime.migration [-] Running upgrade aba5a217ca9b -> 397987e38570, Remove slashes from original resource IDs, recompute their id with creator
2017-04-19 17:37:01.851 1009402 CRITICAL gnocchi [-] AttributeError: 'NoneType' object has no attribute 'encode'
2017-04-19 17:37:01.851 1009402 ERROR gnocchi Traceback (most recent call last):
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/bin/gnocchi-upgrade", line 10, in <module>
2017-04-19 17:37:01.851 1009402 ERROR gnocchi sys.exit(upgrade())
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/cli.py", line 68, in upgrade
2017-04-19 17:37:01.851 1009402 ERROR gnocchi create_legacy_resource_types=conf.create_legacy_resource_types)
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/indexer/sqlalchemy.py", line 329, in upgrade
2017-04-19 17:37:01.851 1009402 ERROR gnocchi command.upgrade(cfg, "head")
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/command.py", line 174, in upgrade
2017-04-19 17:37:01.851 1009402 ERROR gnocchi script.run_env()
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/script/base.py", line 407, in run_env
2017-04-19 17:37:01.851 1009402 ERROR gnocchi util.load_python_file(self.dir, 'env.py')
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
2017-04-19 17:37:01.851 1009402 ERROR gnocchi module = load_module_py(module_id, path)
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/util/compat.py", line 79, in load_module_py
2017-04-19 17:37:01.851 1009402 ERROR gnocchi mod = imp.load_source(module_id, path, fp)
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/indexer/alembic/env.py", line 90, in <module>
2017-04-19 17:37:01.851 1009402 ERROR gnocchi run_migrations_online()
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/indexer/alembic/env.py", line 78, in run_migrations_online
2017-04-19 17:37:01.851 1009402 ERROR gnocchi context.run_migrations()
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "<string>", line 8, in run_migrations
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/runtime/environment.py", line 797, in run_migrations
2017-04-19 17:37:01.851 1009402 ERROR gnocchi self.get_context().run_migrations(**kw)
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/runtime/migration.py", line 312, in run_migrations
2017-04-19 17:37:01.851 1009402 ERROR gnocchi step.migration_fn(**kw)
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/indexer/alembic/versions/397987e38570_no_more_slash_and_reencode.py", line 124, in upgrade
2017-04-19 17:37:01.851 1009402 ERROR gnocchi new_original_resource_id, resource.creator)),
2017-04-19 17:37:01.851 1009402 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/utils.py", line 55, in ResourceUUID
2017-04-19 17:37:01.851 1009402 ERROR gnocchi creator = creator.encode('utf-8')
2017-04-19 17:37:01.851 1009402 ERROR gnocchi AttributeError: 'NoneType' object has no attribute 'encode'
2017-04-19 17:37:01.851 1009402 ERROR gnocchi

Revision history for this message
Pradeep Kilambi (pkilambi) wrote :
Download full text (8.6 KiB)

There are multiple tracebacks in the logs:

2017-04-19 17:56:49.085 1033672 INFO alembic.runtime.migration [-] Running upgrade aba5a217ca9b -> 397987e38570, Remove slashes from original resource IDs, recompute their id with creator
2017-04-19 17:56:49.154 1033672 CRITICAL gnocchi [-] DBNonExistentConstraint: (pymysql.err.InternalError) (1025, u"Error on rename of './gnocchi/metric' to './gnocchi/#sql2-cc072-1b9f' (errno: 152)") [SQL: u'ALTER TABLE metric DROP FOREIGN KEY fk_metric_resource_id_resource_id']
2017-04-19 17:56:49.154 1033672 ERROR gnocchi Traceback (most recent call last):
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/bin/gnocchi-upgrade", line 10, in <module>
2017-04-19 17:56:49.154 1033672 ERROR gnocchi sys.exit(upgrade())
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/cli.py", line 68, in upgrade
2017-04-19 17:56:49.154 1033672 ERROR gnocchi create_legacy_resource_types=conf.create_legacy_resource_types)
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/indexer/sqlalchemy.py", line 329, in upgrade
2017-04-19 17:56:49.154 1033672 ERROR gnocchi command.upgrade(cfg, "head")
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/command.py", line 174, in upgrade
2017-04-19 17:56:49.154 1033672 ERROR gnocchi script.run_env()
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/script/base.py", line 407, in run_env
2017-04-19 17:56:49.154 1033672 ERROR gnocchi util.load_python_file(self.dir, 'env.py')
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
2017-04-19 17:56:49.154 1033672 ERROR gnocchi module = load_module_py(module_id, path)
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/util/compat.py", line 79, in load_module_py
2017-04-19 17:56:49.154 1033672 ERROR gnocchi mod = imp.load_source(module_id, path, fp)
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/indexer/alembic/env.py", line 90, in <module>
2017-04-19 17:56:49.154 1033672 ERROR gnocchi run_migrations_online()
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/indexer/alembic/env.py", line 78, in run_migrations_online
2017-04-19 17:56:49.154 1033672 ERROR gnocchi context.run_migrations()
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "<string>", line 8, in run_migrations
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/runtime/environment.py", line 797, in run_migrations
2017-04-19 17:56:49.154 1033672 ERROR gnocchi self.get_context().run_migrations(**kw)
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/alembic/runtime/migration.py", line 312, in run_migrations
2017-04-19 17:56:49.154 1033672 ERROR gnocchi step.migration_fn(**kw)
2017-04-19 17:56:49.154 1033672 ERROR gnocchi File "/usr/lib/python2.7/site-packages/gnocchi/indexer/...

Read more...

Revision history for this message
Pradeep Kilambi (pkilambi) wrote :

Note this is a multi upgrade scenario Mitaka -> Newton -> Ocata. So not sure if we havent dropped some constraints?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (master)

Fix proposed to branch: master
Review: https://review.openstack.org/458355

Changed in gnocchi:
assignee: nobody → Julien Danjou (jdanjou)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (master)

Reviewed: https://review.openstack.org/458355
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=75e420673159fcf4a383f130e1652243fccc2b75
Submitter: Jenkins
Branch: master

commit 75e420673159fcf4a383f130e1652243fccc2b75
Author: Julien Danjou <email address hidden>
Date: Thu Apr 20 08:45:14 2017 +0200

    Use NULL as creator in ResourceUUID conversion

    In older versions of Gnocchi, the creator could be null. It's unlikely now as
    all auth helper returns a string as creator, but it's still possible in theory.
    This patch uses the NULL string as the creator is it's None (so NULL in SQL).

    Change-Id: Id1faa16512b995fa2cd24ca4bed7912934cb5aad
    Closes-Bug: #1684246

Changed in gnocchi:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (stable/3.1)

Fix proposed to branch: stable/3.1
Review: https://review.openstack.org/458744

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (stable/3.1)

Reviewed: https://review.openstack.org/458744
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=89c9170731de528015c10a3426ea53f188c99705
Submitter: Jenkins
Branch: stable/3.1

commit 89c9170731de528015c10a3426ea53f188c99705
Author: Julien Danjou <email address hidden>
Date: Thu Apr 20 08:45:14 2017 +0200

    Use NULL as creator in ResourceUUID conversion

    In older versions of Gnocchi, the creator could be null. It's unlikely now as
    all auth helper returns a string as creator, but it's still possible in theory.
    This patch uses the NULL string as the creator is it's None (so NULL in SQL).

    Change-Id: Id1faa16512b995fa2cd24ca4bed7912934cb5aad
    Closes-Bug: #1684246
    (cherry picked from commit 75e420673159fcf4a383f130e1652243fccc2b75)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/gnocchi 3.1.3

This issue was fixed in the openstack/gnocchi 3.1.3 release.

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.