[Bug 1713059] Re: nova db sync is executed when the 'connection' is not defined
Corey Bryant
corey.bryant at canonical.com
Mon Aug 28 18:56:51 UTC 2017
That may be what was meant to do. Let me sync with James when he gets
back to get the historical context.
--
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to nova in Ubuntu.
https://bugs.launchpad.net/bugs/1713059
Title:
nova db sync is executed when the 'connection' is not defined
Status in nova package in Ubuntu:
New
Bug description:
When the 'connection' configuration key is NOT defined in
/etc/nova/nova.conf the nova-common.postinst script still tries to run
'nova-manage db sync'
root at juju-b24bc9-mno-18:~# grep connection /etc/nova/nova.conf
root at juju-b24bc9-mno-18:~# dpkg-reconfigure nova-common
Option "logdir" from group "DEFAULT" is deprecated. Use option "log-dir" from group "DEFAULT".
Option "verbose" from group "DEFAULT" is deprecated for removal. Its value may be silently ignored in the future.
ERROR: could not access cell mapping database - has api db been created?
An error has occurred:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nova/cmd/manage.py", line 1602, in main
ret = fn(*fn_args, **fn_kwargs)
File "/usr/lib/python2.7/dist-packages/nova/cmd/manage.py", line 645, in sync
return migration.db_sync(version)
File "/usr/lib/python2.7/dist-packages/nova/db/migration.py", line 26, in db_sync
return IMPL.db_sync(version=version, database=database, context=context)
File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migration.py", line 57, in db_sync
repository, 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 "<decorator-gen-15>", line 2, in _migrate
File "/usr/lib/python2.7/dist-packages/migrate/versioning/util/__init__.py", line 160, in with_engine
return f(*a, **kw)
File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 366, in _migrate
schema.runchange(ver, change, changeset.step)
File "/usr/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 93, in runchange
change.run(self.engine, step)
File "/usr/lib/python2.7/dist-packages/migrate/versioning/script/py.py", line 148, in run
script_func(engine)
File "/usr/lib/python2.7/dist-packages/nova/db/sqlalchemy/migrate_repo/versions/345_require_online_migration_completion.py", line 44, in upgrade
raise exception.ValidationError(detail=msg)
ValidationError: Migration cannot continue until all these have been migrated to the api database. Please run `nova-manage db online_migrations' on Newton code before continuing.There are still 5 unmigrated flavors.
Running the postinst script manually with -x
root at juju-b24bc9-mno-18:~# bash -ex /var/lib/dpkg/info/nova-common.postinst configure
+ '[' configure = configure ']'
+ getent group nova
+ getent passwd nova
+ '[' -z '' ']'
+ chown -R nova:nova /var/lib/nova/
+ chown -R nova:nova /etc/nova
+ chown -R nova:adm /var/log/nova
+ '[' -z '' ']'
+ chown -R nova:nova /var/lib/nova/
+ chmod 0640 /etc/nova/nova.conf
+ chmod 0640 /etc/nova/api-paste.ini
+ chmod 0750 /etc/nova
+ chmod 0750 /var/log/nova
+ chown root:root /etc/nova/rootwrap.conf
+ chown root:root /etc/nova/rootwrap.d
+ chmod 0755 /etc/nova/rootwrap.d
+ grep -qE '^(sql_)?connection( )?=.*' /etc/nova/nova.conf
+ su -s /bin/sh -c 'nova-manage db sync' nova
Option "logdir" from group "DEFAULT" is deprecated. Use option "log-dir" from group "DEFAULT".
Option "verbose" from group "DEFAULT" is deprecated for removal. Its value may be silently ignored in the future.
ERROR: could not access cell mapping database - has api db been created?
An error has occurred:
Traceback (most recent call last):
...
ValidationError: Migration cannot continue until all these have been migrated to the api database. Please run `nova-manage db online_migrations' on Newton code before continuing.There are still 5 unmigrated flavors.
The condition to run the sync operation should be that the connection config key is defined in nova.conf
# diff -u /var/lib/dpkg/info/nova-common.postinst ./nova-common.postinst
--- /var/lib/dpkg/info/nova-common.postinst 2017-06-19 08:12:49.000000000 +0000
+++ ./nova-common.postinst 2017-08-25 13:08:48.852744427 +0000
@@ -47,8 +47,8 @@
chown root:root /etc/nova/rootwrap.d
chmod 0755 /etc/nova/rootwrap.d
- if ! grep -qE "^(sql_)?connection( )?=.*" /etc/nova/nova.conf || \
- grep -qE "^(sql_)?connection.*sqlite.*" /etc/nova/nova.conf
+ if grep -qE "^(sql_)?connection( )?=.*" /etc/nova/nova.conf || \
+ grep -qE "^(sql_)?connection.*sqlite.*" /etc/nova/nova.conf
then
su -s /bin/sh -c 'nova-manage db sync' nova
fi
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nova/+bug/1713059/+subscriptions
More information about the Ubuntu-openstack-bugs
mailing list