[Bug 1713059] Re: nova db sync is executed when the 'connection' is not defined

Corey Bryant corey.bryant at canonical.com
Tue Aug 29 14:27:03 UTC 2017


I discussed with James and we'd like to completely drop the db
migrations from the packages in Pike.

I don't think we need to backport fixes for all packages, however since
nova is hitting this in Ocata we should backport for that package.

** Summary changed:

- nova db sync  is executed when the 'connection' is not defined
+ drop db sync commands from OpenStack packages

** Description changed:

+ The original reason this bug was opened is that nova db sync is executed
+ when the 'connection' is not defined. Let's fix that and at the same
+ time drop all db syncs from OpenStack packages in Pike.
+ 
  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. 
+   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. 
+ 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
  
- 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 
+ # 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
-  
+      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
+      then
+        su -s /bin/sh -c 'nova-manage db sync' nova
+      fi

** Description changed:

  The original reason this bug was opened is that nova db sync is executed
  when the 'connection' is not defined. Let's fix that and at the same
  time drop all db syncs from OpenStack packages in Pike.
+ 
+ More on the nova issue:
  
  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

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1713059

Title:
  drop db sync commands from OpenStack packages

Status in ironic package in Ubuntu:
  Triaged
Status in nova package in Ubuntu:
  Confirmed
Status in ironic source package in Xenial:
  Invalid
Status in nova source package in Xenial:
  Triaged
Status in ironic source package in Zesty:
  Invalid
Status in nova source package in Zesty:
  Triaged
Status in ironic source package in Artful:
  Triaged
Status in nova source package in Artful:
  Confirmed

Bug description:
  The original reason this bug was opened is that nova db sync is
  executed when the 'connection' is not defined. Let's fix that and at
  the same time drop all db syncs from OpenStack packages in Pike.

  More on the nova issue:

  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/ironic/+bug/1713059/+subscriptions



More information about the Ubuntu-sponsors mailing list