2011.3 upgrade to 2012.1~e3

Asked by smallma on 2012-02-20

Hello all,
I stored some images in the glance 2011.3 and I wanna upgrade to glance 2012.1~e3. How could I keep these images after upgraded? Thanks.


Question information

English Edit question
Glance Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Jay Pipes (jaypipes) said : #1

Well, to be safe, you will want to back up your image files and Glance registry database before doing anything.

After that, you should just be able to do a standard upgrade (whatever method you use in your operating system) and then do a glance-manage db_sync



smallma (s-rain) said : #2

Jay, Thanks.

When I upgraded to glance 2012.1~e3 and executed glance-manage db_sync, it occurred a error below. Please help me out. Thanks.

root@ubuntu:/mnt# glance-manage db_sync
Traceback (most recent call last):
  File "/usr/bin/glance-manage", line 128, in <module>
  File "/usr/bin/glance-manage", line 124, in main
    dispatch_cmd(conf, args)
  File "/usr/bin/glance-manage", line 99, in dispatch_cmd
    cmd_func(conf, args)
  File "/usr/bin/glance-manage", line 87, in do_db_sync
    glance.registry.db.migration.db_sync(conf, version=db_version)
  File "/usr/lib/pymodules/python2.7/glance/registry/db/migration.py", line 123, in db_sync
    upgrade(conf, version=version)
  File "/usr/lib/pymodules/python2.7/glance/registry/db/migration.py", line 66, 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
  File "/usr/lib/pymodules/python2.7/glance/registry/db/migrate_repo/versions/001_add_images_table.py", line 49, in upgrade
  File "/usr/lib/pymodules/python2.7/glance/registry/db/migrate_repo/schema.py", line 97, in create_tables
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 477, in create
    bind.create(self, checkfirst=checkfirst)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1698, in create
    connection=connection, **kwargs)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1740, in _run_visitor
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/sql/visitors.py", line 86, in traverse_single
    return meth(obj, **kw)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/ddl.py", line 58, in visit_table
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1191, in execute
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1244, in _execute_ddl
    return self.__execute_context(context)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1302, in __execute_context
    context.parameters[0], context=context)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1401, in _cursor_execute
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1394, in _cursor_execute
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 299, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib/pymodules/python2.7/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
sqlalchemy.exc.OperationalError: (OperationalError) (1050, "Table 'images' already exists") '\nCREATE TABLE images (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tname VARCHAR(255), \n\ttype VARCHAR(30), \n\tsize INTEGER, \n\tstatus VARCHAR(30) NOT NULL, \n\tis_public BOOL NOT NULL, \n\tlocation TEXT, \n\tcreated_at DATETIME NOT NULL, \n\tupdated_at DATETIME, \n\tdeleted_at DATETIME, \n\tdeleted BOOL NOT NULL, \n\tPRIMARY KEY (id), \n\tCHECK (is_public IN (0, 1)), \n\tCHECK (deleted IN (0, 1))\n)ENGINE=InnoDB\n\n' ()

smallma (s-rain) said : #3

I know where the problem is.

We should execute "glance-manage db_sync" before setting up glance 2011.3 for the first time.

After that, we can upgrade to glance 2012.1~e3 and execute glance-manage db_sync again. The metadata can be shared with the latest glance.

Jay, Thanks.