openstack-nova default database

Mark McLoughlin markmc at redhat.com
Fri Nov 18 08:41:01 UTC 2011


Hey,

On Thu, 2011-11-17 at 15:22 -0500, Russell Bryant wrote:
> Greetings,
> 
> A few weeks ago I spent some time looking into a bug [1] that came up 
> back when we had the test day.  The bug showed a "database locked" error 
> when sqlite was used.  In short, using sqlite with nova is not a 
> reliable combination.  I'd like to get some consensus on a good way to 
> address that.

For reference, the bug triggering this discussion is:

  https://bugzilla.redhat.com/735012

> Some options ...
> 
> 1) Update the docs to strongly recommend switching to MySQL as a part of 
> the setup process.
> 
> 2) Don't even bother having the packages set up for sqlite at all. 
> Switch to mysql by default.
> 
> I'd like to take path #2 here.  It seems like a bad idea to provide a 
> default configuration that we know will fail at times.

Yeah, if sqlite is such a lost cause, then we should drop it.

If we do remove the auto-sqlite-setup thing in %post, people who do try
to use sqlite will hit the following problems:

  - You can use an sqlite URI like sqlite:////nova.sqlite, but if you
    then run 'nova manage db sync' the DB will be created in the current
    dir rather than /var/lib/nova. The nova services all run 
    with /var/lib/nova as their cwd

  - 'nova-manage db sync' will create the DB owned by the current user. 
    You need to chown it to the nova user

So, the "create nova.sqlite in %post" thing was about trying to
eliminate those hurdles.

> If we do take this path, what's the best way to go about it?  We can 
> have nova set up to use MySQL and point it at localhost with some 
> default credentials.  Should we do more?  Provide a trivial script for 
> creating the nova database and user?  Have an optional openstack-nova-db 
> package that pulls in MySQL and automatically creates the db?
> 
> I don't want to try to make things too smart and then end up causing 
> pain for administrators.

I'd go with simply making mysql://nova:nova@localhost/nova the default
for the sql_connection flag

Potentially also include a simple script for changing the MySQL root
password, deleting anonymous accounts, creating the nova DB and the nova
user as described here:

  https://fedoraproject.org/wiki/Getting_started_with_OpenStack_Nova#Using_MySQL

I'd also look into what the Ubuntu packages do:

  http://bazaar.launchpad.net/~openstack-ubuntu-packagers/nova/ubuntu/files/head:/debian/

At a first glance, it looks like they use sqlite by default and don't
any particular help for people to use MySQL e.g.

  http://bazaar.launchpad.net/~openstack-ubuntu-packagers/nova/ubuntu/view/head:/debian/nova-common.postinst

      if ! grep -q sql_connection /etc/nova/nova.conf
      then
          su -c 'nova-manage db sync' nova
      fi

Cheers,
Mark.





More information about the cloud mailing list