Glance-manage db sync error

Asked by t-yamazaki

Please tell me how to fix an error on glance-manage db sync.

------------------------
~$ glance-manage db sync
2014-12-05 06:39:03.639 9187 CRITICAL glance [-] ValueError: Invalid target type: None
2014-12-05 06:39:03.639 9187 TRACE glance Traceback (most recent call last):
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/bin/glance-manage", line 10, in <module>
2014-12-05 06:39:03.639 9187 TRACE glance sys.exit(main())
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/glance/cmd/manage.py", line 290, in main
2014-12-05 06:39:03.639 9187 TRACE glance return CONF.command.action_fn(*func_args, **func_kwargs)
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/glance/cmd/manage.py", line 113, in sync
2014-12-05 06:39:03.639 9187 TRACE glance migration.db_sync(db_api.get_engine(),
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/glance/db/sqlalchemy/api.py", line 92, in get_engine
2014-12-05 06:39:03.639 9187 TRACE glance facade = _create_facade_lazily()
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/glance/db/sqlalchemy/api.py", line 82, in _create_facade_lazily
2014-12-05 06:39:03.639 9187 TRACE glance _FACADE = session.EngineFacade.from_config(CONF)
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/oslo/db/sqlalchemy/session.py", line 795, in from_config
2014-12-05 06:39:03.639 9187 TRACE glance retry_interval=conf.database.retry_interval)
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/oslo/db/sqlalchemy/session.py", line 711, in __init__
2014-12-05 06:39:03.639 9187 TRACE glance **engine_kwargs)
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/oslo/db/sqlalchemy/session.py", line 375, in create_engine
2014-12-05 06:39:03.639 9187 TRACE glance pool_timeout=pool_timeout
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/oslo/db/sqlalchemy/utils.py", line 890, in __call__
2014-12-05 06:39:03.639 9187 TRACE glance self._url_from_target(target), target, arg, kw)
2014-12-05 06:39:03.639 9187 TRACE glance File "/usr/lib/python2.7/dist-packages/oslo/db/sqlalchemy/utils.py", line 904, in _url_from_target
2014-12-05 06:39:03.639 9187 TRACE glance raise ValueError("Invalid target type: %r" % target)
2014-12-05 06:39:03.639 9187 TRACE glance ValueError: Invalid target type: None
2014-12-05 06:39:03.639 9187 TRACE glance

Question information

Language:
English Edit question
Status:
Answered
For:
Glance Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
tobe (chendihao) said :
#2

I got the same error with sqlite.

Revision history for this message
Nikhil Komawar (nikhil-komawar) said :
#3

Please file a bug for this under https://bugs.launchpad.net/glance . Please also include the following information:

1. What is/are the DB type(s) and the their resp. schema.
2. How old is that DB and on what version?
3. Is there any data?
4. What version of glance are you running eg. (stable/RC/master) -- Juno, Kilo, glance/master ?
5. Is this an upgrade and if so from what version of glance to which?

More questions may be posed on launchpad bug as necessary.

Revision history for this message
Nikhil Komawar (nikhil-komawar) said :
#4

Same as above.

Revision history for this message
tobe (chendihao) said :
#5

Thanks @nikhil to reopen this. I think it's the problem we should fix ASAP.

1. I use SQLite with the default configuration.

2. It fails to init database and has no version.

3. It fails to init database and has no database file or data.

4. I'm running the latest code in master branch(e16f50f22060ba8a795d593f66587df9f6ad09fe).

5. It's not an update and I start from scratch.

Anyone can simply re-produce this issue easily. Clone the latest code, install it locally, don't edit the configuration file and try the command "glance-manage db_sync". Here's the error I got.

```
root@94f1efbc3a99:/glance# glance-manage db_sync
2015-05-20 03:44:23.817 19 CRITICAL glance [-] ValueError: Invalid target type: None
2015-05-20 03:44:23.817 19 TRACE glance Traceback (most recent call last):
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/bin/glance-manage", line 10, in <module>
2015-05-20 03:44:23.817 19 TRACE glance sys.exit(main())
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/glance/cmd/manage.py", line 316, in main
2015-05-20 03:44:23.817 19 TRACE glance return CONF.command.action_fn()
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/glance/cmd/manage.py", line 172, in sync
2015-05-20 03:44:23.817 19 TRACE glance CONF.command.current_version)
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/glance/cmd/manage.py", line 115, in sync
2015-05-20 03:44:23.817 19 TRACE glance migration.db_sync(db_api.get_engine(),
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/glance/db/sqlalchemy/api.py", line 97, in get_engine
2015-05-20 03:44:23.817 19 TRACE glance facade = _create_facade_lazily()
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/glance/db/sqlalchemy/api.py", line 87, in _create_facade_lazily
2015-05-20 03:44:23.817 19 TRACE glance _FACADE = session.EngineFacade.from_config(CONF)
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/session.py", line 902, in from_config
2015-05-20 03:44:23.817 19 TRACE glance retry_interval=conf.database.retry_interval)
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/session.py", line 818, in __init__
2015-05-20 03:44:23.817 19 TRACE glance **engine_kwargs)
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/session.py", line 393, in create_engine
2015-05-20 03:44:23.817 19 TRACE glance pool_timeout=pool_timeout
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/utils.py", line 918, in __call__
2015-05-20 03:44:23.817 19 TRACE glance self._url_from_target(target), target, arg, kw)
2015-05-20 03:44:23.817 19 TRACE glance File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/utils.py", line 932, in _url_from_target
2015-05-20 03:44:23.817 19 TRACE glance raise ValueError("Invalid target type: %r" % target)
2015-05-20 03:44:23.817 19 TRACE glance ValueError: Invalid target type: None
2015-05-20 03:44:23.817 19 TRACE glance
```

Revision history for this message
Nikhil Komawar (nikhil-komawar) said :
#6

Ok.

Please file a bug for this under https://bugs.launchpad.net/glance as we need to be able to work on it as a bug and verify and test it there. This forum is for general questions. I can verify and raise the critically level as appropriate.

P.S. We use sqllite DB in glance in-tree functional tests and are not seeing this error. So, it would be good to triage this.

Thanks.

Revision history for this message
Daryl Banttari (dbanttari) said :
#7

Had this error; it was caused by glance-registry.conf not having the proper database connection string. (Glance was using mysql, but glance-registry was still trying to use sqlite)

Can you help with this problem?

Provide an answer of your own, or ask t-yamazaki for more information if necessary.

To post a message you must log in.