Database migration utility

Note

All commands of section are executed only on controller.

Utility description

openstack aos db migrate is modules databases update console utility. The utility checks and automatically updates database to the latest version at startup.

Utility arguments
Parameter Description
-h, --help Help output. Optional parameter.
-l, --list Lists all modules supported migration databases. Optional parameter.
-n, --names MODULE_NAMES Outputting the result for a specific module. The module name is set by the parameter MODULE_NAMES. It is needed separate names by gaps in case of use several parameters. Optional parameter.
--migration MIGRATION_VERSION Database migration version. The version number is set by the parameter MIGRATION_VERSION. Optional parameter.
-v, --verbose Flag for displaying a detailed message about database migration error. Optional parameter.

Examples of using

Getting a list of modules available for migration

Command:

openstack aos db migrate --list

Example of outputting a list of modules for which databases migration is available:

Available modules:
       cloud_manager
       clouds
       dashboard
       journal
       monitor
       scheduler
       rs_server

Running database migration for a single module

Launch :Dashboard <AOS.Dashboard> module database migration:

openstack aos db migrate --names dashboard

Example of response:

Running db migrate for: dashboard

================
DB migrate table
================
+---+------------------+--------+------------+
| N | Module name      | Status | Result     |
+---+------------------+--------+------------+
| 1 | Dashboard        | OK     | 9 -> 10    |
+---+------------------+--------+------------+

Running database migrations for multiple modules

Launch Dashboard and CloudManager modules databases migration:

openstack aos db migrate --names dashboard cloud_manager

Example of response:

Running db migrate for: dashboard, cloud_manager

================
DB migrate table
================
+---+--------------------+--------+------------+
| N | Module name        | Status | Result     |
+---+--------------------+--------+------------+
| 1 | Dashboard          | OK     | No changes |
+---+--------------------+--------+------------+
| 2 | CloudManager       | OK     | 25 -> 28   |
+---+--------------------+--------+------------+

Running database migrations for all modules

Launch all modules databases migration:

openstack aos db migrate

Example of response:

Running db migrate for: cloud_manager, clouds, dashboard, monitor, rs_server, scheduler

================
DB migrate table
================
+---+---------------------+--------+----------------+
| N | Module name         | Status | Result         |
+---+---------------------+--------+----------------+
| 1 | CloudManager        | OK     | No changes     |
+---+---------------------+--------+----------------+
| 2 | Clouds              | OK     | No changes     |
+---+---------------------+--------+----------------+
| 3 | Dashboard           | OK     | 10 -> 11       |
+---+---------------------+--------+----------------+
| 4 | Journal             | OK     | No changes     |
+---+---------------------+--------+----------------+
| 5 | Monitor             | OK     | No changes     |
+---+---------------------+--------+----------------+
| 6 | RSserver            | OK     | 10 -> 11       |
+---+---------------------+--------+----------------+
| 7 | Scheduler           | OK     | No changes     |
+---+---------------------+--------+----------------+

Unsuccessful database migration

Command:

openstack aos db migrate

Example of unsuccessful database migration:

Running db migrate for: cloud_manager, clouds, dashboard, monitor, rs_server, scheduler

================
DB migrate table
================

+---+---------------------+--------+------------------------------------------------------+
| N | Module name         | Status | Result                                               |
+---+---------------------+--------+------------------------------------------------------+
| 1 | CloudManager        | FAIL   | Unknown DB Error. Please contact your administrator. |
+---+---------------------+--------+------------------------------------------------------+
| 2 | Clouds              | FAIL   | Unknown DB Error. Please contact your administrator. |
+---+---------------------+--------+------------------------------------------------------+
| 3 | Dashboard           | FAIL   | Unknown DB Error. Please contact your administrator. |
+---+---------------------+--------+------------------------------------------------------+
| 4 | Journal             | FAIL   | Unknown DB Error. Please contact your administrator. |
+---+---------------------+--------+------------------------------------------------------+
| 5 | Monitor             | FAIL   | Unknown DB Error. Please contact your administrator. |
+---+---------------------+--------+------------------------------------------------------+
| 6 | RSserver            | FAIL   | Unknown DB Error. Please contact your administrator. |
+---+---------------------+--------+------------------------------------------------------+
| 7 | Scheduler           | FAIL   | Unknown DB Error. Please contact your administrator. |
+---+---------------------+--------+------------------------------------------------------+

Repeat command with flag --verbose to output detailed error message:

openstack aos db migrate --names dashboard cloud_manager --verbose

Example of response:

Running db migrate for: cloud_manager, dashboard

================
DB migrate table
================

+---+---------------------+--------+------------------------------------------------------+
| N | Module name         | Status | Result                                               |
+---+---------------------+--------+------------------------------------------------------+
| 1 | CloudManager        | FAIL   | Error while getting migrate versions: Unable to get  |
|   |                     |        | database engine from engine facade                   |
+---+---------------------+--------+------------------------------------------------------+
| 2 | Dashboard           | FAIL   | Error while getting migrate versions:                |
|   |                     |        | (_mysql_exceptions.OperationalError) (2003, 'Can\'t  |
|   |                     |        | connect to MySQL server on \'controller\'')          |
+---+---------------------+--------+------------------------------------------------------+

Rolling back a database update

Important

It is impossible for several modules at once.

Rolling back CloudManager modules database update from 27 to 26 version:

openstack aos db migrate -n cloud_manager --migration 26

Example of response:

Running db migrate for: cloud_manager

================
DB migrate table
================
+---+--------------------+--------+------------+
| N | Module name        | Status | Result     |
+---+--------------------+--------+------------+
| 1 | CloudManager       | OK     | 27 -> 26   |
+---+--------------------+--------+------------+

Results table description

Field name Description
N Module serial number.
Module name Module name.
Status

Migration progress status. Possible values:

  • OK - update was successful;
  • FAIL - update failed.
Result

Results of the update. Possible values:

  • No changes - no change, no update required;
  • 26 -> 27 - output if a migration is applied, where 26 is the initial version and 27 is the final version;
  • Error - message indicating the problem.