← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1769635] Re: Error:Access denied for user 'nova'@'%' to database 'nova_api_cell0'

 

Yeah as suggested, these docs have some pointers:

https://docs.openstack.org/nova/pike/user/cells.html#first-time-setup

Specifically:

"If you don't specify --database_connection then nova-manage will use
the [database]/connection value from your config file, and mangle the
database name to have a _cell0 suffix."

And:

"If your databases are on separate hosts then you should specify
--database_connection or make certain that the nova.conf being used has
the [database]/connection value pointing to the same user/password/host
that will work for the cell0 database. If the cell0 mapping was created
incorrectly, it can be deleted using the nova-manage cell_v2 delete_cell
command and then run map_cell0 again with the proper database connection
value."

So I think what probably happened is that when you ran map_cell0, it
created a nova_api.cell_mappings record with the wrong database
connection URL, because now db sync, which is relying on the
cell_mappings table record to connect to the cell0 database, is failing
because it's looking for nova_api_cell0 but you have nova_cell0.

This is the exact code that is creating the default cell0 connection URL
if you didn't specify --database-connection when running map_cell0:

https://github.com/openstack/nova/blob/15.1.0/nova/cmd/manage.py#L1160

So I think you probably just want to (1) delete the cell0 mapping (2)
run map_cell0 again and ensure it creates a cell0 entry with the correct
database connection URL and then (3) run nova-manage db sync again.

** Changed in: nova
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1769635

Title:
  Error:Access denied for user 'nova'@'%' to database 'nova_api_cell0'

Status in OpenStack Compute (nova):
  Invalid

Bug description:
  Description
  ===========

  My Openstack controller and compute node are installed on centOS7.

  Everything is fine until I run "su -s /bin/sh -c "nova-manage db sync" nova" as indicated in the online Doc:https://docs.openstack.org/ocata/install-guide-rdo/nova-controller-install.html, I got the error below.
  ++++++++++++++++++++++++++++++++++++++++++
  [root@server ~]# su -s /bin/sh -c "nova-manage db sync" nova
  ERROR: Could not access cell0.
  Has the nova_api database been created?
  Has the nova_cell0 database been created?
  Has "nova-manage api_db sync" been run?
  Has "nova-manage cell_v2 map_cell0" been run?
  Is [api_database]/connection set in nova.conf?
  Is the cell0 database connection URL correct?
  Error: (pymysql.err.OperationalError) (1044, u"Access denied for user 'nova'@'%' to database 'nova_api_cell0'")
  ++++++++++++++++++++++++++++++++++++++++++

  I'm sure nova_api and nova_cell0 has been created, and "nova-manage api_db sync" and "nova-manage cell_v2 map_cell0" ran successfully. Also in nova.conf, [api_database]/connection is correctly set.
  But I logged into the mysql,show databases and there is no such database nova_api_cell0. 

  I then moved on to next steps. All are fine until launching an instance. Error below.
  ++++++++++++++++++++++++++++++++++++++++++
  [root@server ~]# openstack server list
  Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
  <class 'sqlalchemy.exc.OperationalError'> (HTTP 500) (Request-ID: req-3f7b8ee6-1939-442e-99a7-883cfc178cdd)
  ++++++++++++++++++++++++++++++++++++++++++

  I also found the same error "Access denied for user 'nova'@'%' to
  database 'nova_api_cell0'" in nova.api.log

  
  Can someone tell me why I run into this error? Many thanks in advance.

  Environment
  ===========
  root@server ~]# rpm -qa | grep nova
  openstack-nova-common-15.1.0-1.el7.noarch
  openstack-nova-conductor-15.1.0-1.el7.noarch
  python-nova-15.1.0-1.el7.noarch
  openstack-nova-scheduler-15.1.0-1.el7.noarch
  openstack-nova-novncproxy-15.1.0-1.el7.noarch
  openstack-nova-api-15.1.0-1.el7.noarch
  openstack-nova-placement-api-15.1.0-1.el7.noarch
  openstack-nova-console-15.1.0-1.el7.noarch
  python2-novaclient-7.1.2-1.el7.noarch

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1769635/+subscriptions


References