[openstack-dev] [Openstack] [Nova] How to confirm I have the right database schema when checkout to another branch?

Vishvananda Ishaya vishvananda at gmail.com
Fri Jun 20 15:22:17 UTC 2014


You need to remove the old .pyc files in the migrate_repo/versions directory. I have an alias in my .gitconfig to allow me to checkout a branch and delete pycs in one command:

[alias]
    cc = !"TOP=$(git rev-parse --show-toplevel); find $TOP -name '*.pyc' -delete; git-checkout”

so i can do:

git cc some-branch

Vish

On Jun 11, 2014, at 7:54 PM, 严超 <yanchao727 at gmail.com> wrote:

> Hi, All:
>         When I checkout nova to another branch. how to confirm I have the right database schema ?
>         When I run "nova-manage db sync", I've got below error:
> 
> 2014-06-11 22:53:27.977 CRITICAL nova [-] KeyError: <VerNum(242)>
> 
> 2014-06-11 22:53:27.977 TRACE nova Traceback (most recent call last):
> 2014-06-11 22:53:27.977 TRACE nova   File "/usr/local/bin/nova-manage", line 10, in <module>
> 2014-06-11 22:53:27.977 TRACE nova     sys.exit(main())
> 2014-06-11 22:53:27.977 TRACE nova   File "/opt/stack/nova/nova/cmd/manage.py", line 1376, in main
> 2014-06-11 22:53:27.977 TRACE nova     ret = fn(*fn_args, **fn_kwargs)
> 2014-06-11 22:53:27.977 TRACE nova   File "/opt/stack/nova/nova/cmd/manage.py", line 885, in sync
> 2014-06-11 22:53:27.977 TRACE nova     return migration.db_sync(version)
> 2014-06-11 22:53:27.977 TRACE nova   File "/opt/stack/nova/nova/db/migration.py", line 32, in db_sync
> 2014-06-11 22:53:27.977 TRACE nova     return IMPL.db_sync(version=version)
> 2014-06-11 22:53:27.977 TRACE nova   File "/opt/stack/nova/nova/db/sqlalchemy/migration.py", line 44, in db_sync
> 2014-06-11 22:53:27.977 TRACE nova     return versioning_api.upgrade(get_engine(), repository, version)
> 2014-06-11 22:53:27.977 TRACE nova   File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/api.py", line 186, in upgrade
> 2014-06-11 22:53:27.977 TRACE nova     return _migrate(url, repository, version, upgrade=True, err=err, **opts)
> 2014-06-11 22:53:27.977 TRACE nova   File "<string>", line 2, in _migrate
> 2014-06-11 22:53:27.977 TRACE nova   File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/util/__init__.py", line 160, in with_engine
> 2014-06-11 22:53:27.977 TRACE nova     return f(*a, **kw)
> 2014-06-11 22:53:27.977 TRACE nova   File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/api.py", line 345, in _migrate
> 2014-06-11 22:53:27.977 TRACE nova     changeset = schema.changeset(version)
> 2014-06-11 22:53:27.977 TRACE nova   File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 82, in changeset
> 2014-06-11 22:53:27.977 TRACE nova     changeset = self.repository.changeset(database, start_ver, version)
> 2014-06-11 22:53:27.977 TRACE nova   File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/repository.py", line 225, in changeset
> 2014-06-11 22:53:27.977 TRACE nova     changes = [self.version(v).script(database, op) for v in versions]
> 2014-06-11 22:53:27.977 TRACE nova   File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/repository.py", line 189, in version
> 2014-06-11 22:53:27.977 TRACE nova     return self.versions.version(*p, **k)
> 2014-06-11 22:53:27.977 TRACE nova   File "/usr/local/lib/python2.7/dist-packages/migrate/versioning/version.py", line 173, in version
> 2014-06-11 22:53:27.977 TRACE nova     return self.versions[VerNum(vernum)]
> 2014-06-11 22:53:27.977 TRACE nova KeyError: <VerNum(242)>
> 2014-06-11 22:53:27.977 TRACE nova 
> 
> 
> Best Regards!
> Chao Yan
> --------------
> My twitter:Andy Yan @yanchao727
> My Weibo:http://weibo.com/herewearenow
> --------------
> _______________________________________________
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to     : openstack at lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140620/c30c9bfc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140620/c30c9bfc/attachment.pgp>


More information about the OpenStack-dev mailing list