Jump to: navigation, search


NOTE(mriedem): This following sections on this page are relatively out of date. DB2 support has been in sqlalchemy-migrate since 0.8.3 and is supported in the following OpenStack projects: Keystone, Ceilometer, Cinder, Glance, Heat, Neutron. Nova is a work in progress: https://review.openstack.org/#/c/69047/

Alembic support for DB2 can be found on pypi: https://pypi.python.org/pypi/ibm_db_alembic

The third party CI wiki for DB2 is here: https://wiki.openstack.org/wiki/IBM/DB2-TEST


Currently OpenStack supports multiple open source databases as the backend database, for example: MySQL, SQLite, PostgreSQL are the default supported databases for the community. In order to support enterprise customers, we would like to integrate the IBM database product DB2 into OpenStack. This will give OpenStack customers an option for an enterprise level database.
This wiki document provides an overview of how we have enabled DB2, what is needed to enable OpenStack to access DB2 as the backend database and what IBM plans to provide to the OpenStack community with the DB2 support.


Today, the OpenStack community projects do not support DB2 as a backend database. Customers who want to deploy Openstack with DB2 would have to manually apply the Python patch for SQLAlchemy-migrate DB2 support and then configure DB2 manually. IBM also has to maintain and update the SQLAlchemy-migrate changes, and the OpenStack consumers would have to install the IBM changes for each new OpenStack release. Thus, having DB2 support in the OpenStack community code base would facilitate the deployment of OpenStack for enterprise customers using DB2.

Use Cases

  • Deploy Openstack projects (Glance, Keystone, Cinder, Nova, Neutron, Heat and Ceilometer) with DB2
  • Install Openstack with DB2 using Devstack

The following items could be implemented in the future:
  • Migrate MySQL database to DB2
  • Migrate DB2 database back to MySQL


IBM will provide the necessary code changes to support nova, glance, cinder, keystone, heat, ceilometer and neutron to use a DB2 backend database. Oslo will be updated as necessary. The code provided by IBM for the OpenStack services will include enablement of unit/migration test cases for DB2. IBM will also work with the SQLAlchemy and SQLAlchemy-migrate communities to get the necessary support for interacting with DB2 available for download.
To support DB2 database in OpenStack, the following tasks are needed and will be completed by IBM:
  • Update Openstack projects (Glance, Keystone, Cinder, Nova, Heat, Ceilometer and Neutron) to support DB2 initialization and access.
Blueprints will be opened against each project for checking in the necessary code to support DB2 and patches will be submitted for review against those blueprints. The code may be initially submitted before additional test infrastructure (noted below) is in place as the DB2 specific code is not executed unless the database configured in a service's sql_connection string is ibm_db_sa. Until DB2 is integrated into OpenStack's test infrastructure IBM is taking responsibility for managing the impacts of additional migrations upon DB2 functionality.
  • IBM will provide the necessary test infrastructure for DB2.
  • IBM DB2 Express-C will be made freely available for use on the OpenStack Jenkins systems. IBM will also assist in the configuration of DB2 for that system.
  • Third party tests will be provided by IBM to verify proper DB2 functionality with community code and the hardware infrastructure to support the tests will also be provided.

  • DevStack will be updated to support setup/configuration of DB2 as a backend database. (Note that the installation of DB2 database may need to be done separately outside of DevStack.)
The following functions need to be implemented in /devstack/lib/databases to support DB2:
  • recreate_database_xxx
  • install_database_xxx
  • configure_database_xxx
  • database_connection_url_xxx
Note: Before running devstack, the developer also needs to do the followings:
set DB2 as the default database in stackrc:
add a line to localrc:
use_database ibm_db_sa

  • Dependent database access packages
The following packages are needed to support DB2:
  • SQLAlchemy. A Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL. Official website: http://www.sqlalchemy.org/
This package is available and can be installed via:
  • sudo pip install SQLAlchemy==0.8.3
  • SQLAlchemy currently supports interaction with DB2.
  • SQLAlchemy-migrate. It is an MIT licensed open source project and provides a way to deal with database schema changes in SQLAlchemy projects. Currently, to support DB2, a patch for SQLAlchemy-migrate is needed. The following issue has been submitted to have the patch included in the base code:
After the patch has been applied, run this command to install it:
sudo python setup.py install
A patch has been submitted (https://review.openstack.org/#/c/55572/) to integrate DB2 support into SQLAlchemy-migrate. Once the patch is approved the above steps will no longer be necessary.
  • The Python driver and wrapper for DB2 and the adapter for SQLAlchemy interface.
Today, this driver/adapter can be installed using pip: sudo pip install ibm-db-sa

  • Users will need to download/install IBM DB2 Express-C and the IBM Data Server Driver for ODBC and CLI. Version 10.5 or greater is required to support unique constraints over nullable columns.
DB2 Express-C may be freely downloaded from the following website: http://www.ibm.com/developerworks/downloads/im/db2express/index.html
IBM Data Server Driver for ODBC and CLI may be downloaded from this website: http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.apdv.cli.doc%2Fdoc%2Ft0023867.htm (Note: The ODBC CLI is only required for database client systems that are accessing a remote DB2 server.)

Supported DB2 Levels

IBM has tested OpenStack Havana and Icehouse on DB2 Express-C 10.5 and DB2 Enterprise Server 10.5.