QA:Testcase use MySQL for OpenStack database

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(Created page with "{{QA/Test_Case |description=A brief description of the functionality being tested. |setup=Optionally include information on preparing the test environment |actions= Be as specifi...")
 
(remove from cloud SIG category)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{QA/Test_Case
 
{{QA/Test_Case
|description=A brief description of the functionality being tested.
+
|description=Rather than using the default sqlite DB, you can use MySQL.
|setup=Optionally include information on preparing the test environment
+
|setup=
|actions=
+
First install and enable MySQL:
Be as specific as required for the target audience.  
+
 
# Start here ...
+
$> sudo yum install -y mysql-server
# Next do this ...
+
$> sudo service mysqld start
# Finally click that
+
$> sudo chkconfig mysqld on
|results=
+
 
The following must be true to consider this a successful test run. Be brief ... but explicit.  
+
Set a password for the root account and delete the anonymous accounts:
# Step #1 completes without error
+
 
# The system boots into runlevel 5
+
$> mysql -u root
# Program completes wth exit code 0
+
mysql> update mysql.user set password = password('iamroot') where user = 'root';
 +
mysql> <nowiki>delete from mysql.user where user = ''</nowiki>;
 +
 
 +
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:
 +
 
 +
$> <nowiki>echo '--sql_connection=mysql://nova:nova@localhost/nova' | sudo tee -a /etc/nova/nova.conf</nowiki>
 +
 
 +
|actions=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.  
 +
 
 +
|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;'
 +
+---------------+------------------------------------------------------------------+---------+
 +
<nowiki>| repository_id | repository_path                                                  | version |</nowiki>
 +
+---------------+------------------------------------------------------------------+---------+
 +
<nowiki>| nova          | /usr/lib/python2.7/site-packages/nova/db/sqlalchemy/migrate_repo |      46 |</nowiki>
 +
+---------------+------------------------------------------------------------------+---------+
 +
 
 
}}
 
}}
  
 
[[Category:OpenStack Test Cases]]
 
[[Category:OpenStack Test Cases]]
[[Category:Cloud SIG]]
 

Latest revision as of 06:17, 25 April 2012

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

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;'
+---------------+------------------------------------------------------------------+---------+
| repository_id | repository_path                                                  | version |
+---------------+------------------------------------------------------------------+---------+
| nova          | /usr/lib/python2.7/site-packages/nova/db/sqlalchemy/migrate_repo |      46 |
+---------------+------------------------------------------------------------------+---------+