Today I tried upgrading to the current trunk (129 I think) and I get a bit fail on the apt-get upgrade. Here is the error message:
Setting up glance (2011.3~bzr129-0ubuntu0ppa1~maverick2) ...
Traceback (most recent call last):
File "/usr/bin/glance-manage", line 141, in <module>
main()
File "/usr/bin/glance-manage", line 137, in main
dispatch_cmd(options, args)
File "/usr/bin/glance-manage", line 109, in dispatch_cmd
cmd_func(options, args)
File "/usr/bin/glance-manage", line 97, in do_db_sync
glance.registry.db.migration.db_sync(options, version=db_version)
File "/usr/lib/pymodules/python2.6/glance/registry/db/migration.py", line 117, in db_sync
upgrade(options, version=version)
File "/usr/lib/pymodules/python2.6/glance/registry/db/migration.py", line 64, in upgrade
return versioning_api.upgrade(sql_connection, repo_path, version)
File "/usr/lib/pymodules/python2.6/migrate/versioning/api.py", line 185, in upgrade
return _migrate(url, repository, version, upgrade=True, err=err, **opts)
File "<string>", line 2, in _migrate
File "/usr/lib/pymodules/python2.6/migrate/versioning/util/__init__.py", line 160, in with_engine
return f(*a, **kw)
File "/usr/lib/pymodules/python2.6/migrate/versioning/api.py", line 364, in _migrate
schema.runchange(ver, change, changeset.step)
File "/usr/lib/pymodules/python2.6/migrate/versioning/schema.py", line 83, in runchange
change.run(self.engine, step)
File "/usr/lib/pymodules/python2.6/migrate/versioning/script/py.py", line 140, in run
script_func(engine)
File "/usr/lib/pymodules/python2.6/glance/registry/db/migrate_repo/versions/001_add_images_table.py", line 49, in upgrade
create_tables(tables)
File "/usr/lib/pymodules/python2.6/glance/registry/db/migrate_repo/schema.py", line 97, in create_tables
table.create()
File "/usr/lib/python2.6/dist-packages/sqlalchemy/schema.py", line 439, in create
bind.create(self, checkfirst=checkfirst)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1647, in create
connection=connection, **kwargs)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1682, in _run_visitor
**kwargs).traverse_single(element)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/sql/visitors.py", line 77, in traverse_single
return meth(obj, **kw)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/ddl.py", line 58, in visit_table
self.connection.execute(schema.CreateTable(table))
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1157, in execute
params)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1210, in _execute_ddl
return self.__execute_context(context)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1268, in __execute_context
context.parameters[0], context=context)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1367, in _cursor_execute
context)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1360, in _cursor_execute
context)
File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/default.py", line 288, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) table images already exists u'\nCREATE TABLE images (\n\tid INTEGER NOT NULL, \n\tname VARCHAR(255), \n\ttype VARCHAR(30), \n\tsize INTEGER, \n\tstatus VARCHAR(30) NOT NULL, \n\tis_public BOOLEAN NOT NULL, \n\tlocation TEXT, \n\tcreated_at DATETIME NOT NULL, \n\tupdated_at DATETIME, \n\tdeleted_at DATETIME, \n\tdeleted BOOLEAN NOT NULL, \n\tPRIMARY KEY (id), \n\tCHECK (is_public IN (0, 1)), \n\tCHECK (deleted IN (0, 1))\n)\n\n' ()
dpkg: error processing glance (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-nova (2011.3~bzr1058-0ubuntu0ppa1~maverick1) ...
Setting up nova-common (2011.3~bzr1058-0ubuntu0ppa1~maverick1) ...
Installing new version of config file /etc/sudoers.d/nova_sudoers ...
Setting up nova-objectstore (2011.3~bzr1058-0ubuntu0ppa1~maverick1) ...
Installing new version of config file /etc/logrotate.d/nova-objectstore ...
nova-objectstore start/running, process 14301
Setting up nova-api (2011.3~bzr1058-0ubuntu0ppa1~maverick1) ...
nova-api start/running, process 14319
Setting up nova-scheduler (2011.3~bzr1058-0ubuntu0ppa1~maverick1) ...
nova-scheduler start/running, process 14335
Setting up nova-network (2011.3~bzr1058-0ubuntu0ppa1~maverick1) ...
nova-network start/running, process 14351
Processing triggers for python-support ...
Errors were encountered while processing:
glance
E: Sub-process /usr/bin/dpkg returned an error code (1)
It looks like a sqlalchemy call is failing because the table IMAGES already exists (which it does since I have been running glance for a bit already). What should I do?
Thanks,
Graham
Hi Graham, thanks for the bug report!
It looks like we're trying to erroneously re-migrate your database from the beginning. AFAIK, this only happens when the target DB is missing the `migrate_version` table which keeps track of which version of the database schema we're using.
Out of curiosity:
* Could you paste in what value you have for `sql_connection` in `/etc/glance/ glance. conf`?
* Is there a `migrate_version` table present in the `glance` database?
* If the `migrate_version` table is present, can you paste in the results of a `SELECT * FROM migrate_version;`
* How was the `glance` database originally created? Was the database created by installing the glance package, or was glance originally installed from source and `glance-manage db_sync` run?
Thanks,
-Rick