db_sync error

Asked by smallma on 2012-04-18

Hello all,

When I install glance-registry, it occurred a error as below.

Setting up glance-registry (2012.1-0ubuntu2) ...
Traceback (most recent call last):
  File "/usr/bin/glance-manage", line 122, in <module>
    main()
  File "/usr/bin/glance-manage", line 118, in main
    dispatch_cmd(conf, args)
  File "/usr/bin/glance-manage", line 93, in dispatch_cmd
    cmd_func(conf, args)
  File "/usr/bin/glance-manage", line 81, in do_db_sync
    glance.registry.db.migration.db_sync(conf, version, current_version)
  File "/usr/lib/python2.7/dist-packages/glance/registry/db/migration.py", line 141, in db_sync
    upgrade(conf, version=version)
  File "/usr/lib/python2.7/dist-packages/glance/registry/db/migration.py", line 67, in upgrade
    return versioning_api.upgrade(sql_connection, repo_path, version)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 186, in upgrade
    return _migrate(url, repository, version, upgrade=True, err=err, **opts)
  File "<string>", line 2, in _migrate
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/util/__init__.py", line 159, in with_engine
    return f(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 365, in _migrate
    schema.runchange(ver, change, changeset.step)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 91, in runchange
    change.run(self.engine, step)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/script/py.py", line 145, in run
    script_func(engine)
  File "/usr/lib/python2.7/dist-packages/glance/registry/db/migrate_repo/versions/001_add_images_table.py", line 48, in upgrade
    tables = [define_images_table(meta)]
  File "/usr/lib/python2.7/dist-packages/glance/registry/db/migrate_repo/versions/001_add_images_table.py", line 40, in define_images_table
    extend_existing=True)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 210, in __new__
    table._init(name, metadata, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 256, in _init
    self._extra_kwargs(**kwargs)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 312, in _extra_kwargs
    "Invalid argument(s) for Table: %r" % kwargs.keys())
TypeError: Invalid argument(s) for Table: ['extend_existing', 'mysql_engine']
dpkg: error processing glance-registry (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Processing triggers for python-support ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 glance-registry
E: Sub-process /usr/bin/dpkg returned an error code (1)

I check DB and found there was no tables except migrate_version. and migrate_version is 0. So I execute glance-manage db_sync again, it occurred the same error as below.

root@ubuntu:/var/lib/glance# glance-manage db_sync
Traceback (most recent call last):
  File "/usr/bin/glance-manage", line 122, in <module>t-packages/sqlalchemy/schem
    main()
  File "/usr/bin/glance-manage", line 118, in main/dist-packages/sqlalchemy/schem
    dispatch_cmd(conf, args)
  File "/usr/bin/glance-manage", line 93, in dispatch_cmd
    cmd_func(conf, args)
  File "/usr/bin/glance-manage", line 81, in do_db_sync
    glance.registry.db.migration.db_sync(conf, version, current_version)
  File "/usr/lib/python2.7/dist-packages/glance/registry/db/migration.py", line 141, in db_sync
    upgrade(conf, version=version)
  File "/usr/lib/python2.7/dist-packages/glance/registry/db/migration.py", line 67, in upgrade
    return versioning_api.upgrade(sql_connection, repo_path, version)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 186, in upgrade
    return _migrate(url, repository, version, upgrade=True, err=err, **opts)
  File "<string>", line 2, in _migrate
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/util/__init__.py", line 159, in with_engine
    return f(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 365, in _migrate
    schema.runchange(ver, change, changeset.step)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 91, in runchange
    change.run(self.engine, step)
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/script/py.py", line 145, in run
    script_func(engine)
  File "/usr/lib/python2.7/dist-packages/glance/registry/db/migrate_repo/versions/001_add_images_table.py", line 49, in upgrade
    tables = [define_images_table(meta)]
  File "/usr/lib/python2.7/dist-packages/glance/registry/db/migrate_repo/versions/001_add_images_table.py", line 41, in define_images_table
    extend_existing=True)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 210, in __new__
    table._init(name, metadata, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 256, in _init
    self._extra_kwargs(**kwargs)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 313, in _extra_kwargs
    "Invalid argument(s) for Table: %r" % kwargs.keys())
TypeError: Invalid argument(s) for Table: ['extend_existing', 'mysql_engine']

Maybe the db_sync function got some problems when migrate_version is 0. Please help to clarify. Thanks.

BTW, I check glance-registry.postinst and found the following script. Why glance2012.1 needs to do version-control first when DB does not exist?

if [ ! -e /var/lib/glance/glance.sqlite ] ; then
       su -s /bin/sh -c 'glance-manage version_control 0' glance
fi

Thanks,

Rain

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
smallma
Solved:
2012-05-14
Last query:
2012-05-14
Last reply:
smallma (s-rain) said : #1

Because the following sqlalchemy version is too old, so that it occurred this problem.

Build-Depends-Indep:
python-sqlalchemy-ext | python-sqlalchemy (<< 0.6.3-2),

Pleasee correct the sqlalchemy version in control file. Thanks.

smallma (s-rain) said : #2

Jay, Thanks.