QA:Testcase use MySQL for OpenStack database

From FedoraProject

Revision as of 10:20, 19 October 2011 by Pbrady (Talk | contribs)

Jump to: navigation, search

Contents

Description

Rather than using the default sqlite DB, you can use MySQL.

Setup

First install and enable MySQL:

$> sudo yum install -y mysql-server
$> sudo service mysqld start
$> sudo chkconfig mysqld on

Set a password for the root account and delete the anonymous accounts:

$> mysql -u root
mysql> update mysql.user set password = password('iamroot') where user = 'root';
mysql> delete from mysql.user where user = '';

Create a database and user account specifically for nova:

mysql> create database nova;
mysql> create user 'nova'@'localhost' identified by 'nova';
mysql> create user 'nova'@'%' identified by 'nova';
mysql> grant all on nova.* to 'nova'@'%';

(Note nova@localhost is required even though the anonymous accounts have been deleted?)

Then configure nova to use the DB:

$> echo '--sql_connection=mysql://nova:nova@localhost/nova' | sudo tee -a /etc/nova/nova.conf 

How to test

Instruct nova to use the DB:

$> sudo nova-manage db sync

Expected Results

Query the database using:

$> mysql -u nova -pnova nova
mysql> select * from migrate_version;

Ensure a record with $repository_id = 'nova' is returned