From Fedora Project Wiki

No edit summary
No edit summary
Line 21: Line 21:
  mysql> grant all on nova.* to 'nova'@'%';
  mysql> grant all on nova.* to 'nova'@'%';


(Note nova@localhost is required even though the anonymous accounts have been deleted?)
Next, you want to switch to using the MySQL DB. But once you do so, you're essentially starting from scratch with a clean DB. So, make sure all your floating IPs are released, volumes deleted and instances terminated:


Then configure nova to use the DB:
$> euca-terminate-instances i-00000001
 
Then shutdown all the services:
 
$> for iii in api compute network volume scheduler; do sudo service openstack-nova-$iii stop; done
 
Now you configure nova to use the DB:


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


|actions=Instruct nova to use the DB:
|actions=Create the DB schema:


  $> sudo nova-manage db sync
  $> sudo nova-manage db sync


|results=Query the database using:
Restart the services:
 
$> for iii in api compute network volume scheduler; do sudo service openstack-nova-$iii start; done
 
Now go back over the previous test cases and create a user, project, network and keypair. You don't need to re-register the images. Then launch an instance and testing floating IPs and volumes.
 
|results=Everything should work as before.


$> mysql -u nova -pnova nova
You should see that Nova is using the MySQL DB.
mysql> select * from migrate_version;


Ensure a record with $repository_id = 'nova' is returned
$> mysql -u nova -pnova nova -e 'select * from migrate_version;'
+---------------+------------------------------------------------------------------+---------+
| repository_id | repository_path                                                  | version |
+---------------+------------------------------------------------------------------+---------+
| nova          | /usr/lib/python2.7/site-packages/nova/db/sqlalchemy/migrate_repo |      46 |
+---------------+------------------------------------------------------------------+---------+
}}
}}


[[Category:OpenStack Test Cases]]
[[Category:OpenStack Test Cases]]
[[Category:Cloud SIG]]
[[Category:Cloud SIG]]

Revision as of 11:52, 20 October 2011

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'@'%';

Next, you want to switch to using the MySQL DB. But once you do so, you're essentially starting from scratch with a clean DB. So, make sure all your floating IPs are released, volumes deleted and instances terminated:

$> euca-terminate-instances i-00000001

Then shutdown all the services:

$> for iii in api compute network volume scheduler; do sudo service openstack-nova-$iii stop; done

Now you configure nova to use the DB:

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

How to test

Create the DB schema:

$> sudo nova-manage db sync

Restart the services:

$> for iii in api compute network volume scheduler; do sudo service openstack-nova-$iii start; done

Now go back over the previous test cases and create a user, project, network and keypair. You don't need to re-register the images. Then launch an instance and testing floating IPs and volumes.

Expected Results

Everything should work as before.

You should see that Nova is using the MySQL DB.

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