← Back to team overview

openstack team mailing list archive

Re: [keystone] IBM DB2 configuration

 


What I think we need is a simple way to run our current body of unit tests, to include the sql Migration tests, against a Live database, kindof the same way as I have et up for the live LDAP test.

The steps:

create a file under keystone/tests that doesn't trigger the nameing scheme that matches for unit tests. Since I use _ldap_livetest.py for LDAP, I would recommend _db_livetests.py.

That should then import test_backend_sql and test_sql upgrade. They would pull in a custom config file that is .gitignored but that has the DB connection info for DB2 etc. We could post sample ones for smokestack etc to pull in for integration testing.

A user then could run against those test with ./run_tests.sh -x _db_livetests





On 12/20/2012 11:55 AM, Dolph Mathews wrote:
(raising to the mailing list)

Which DB2 driver are you using? I was referring to: http://code.google.com/p/ibm-db/wiki/README

... which shows an example connection string for sqlalchemy as:

>>> db2 = sqlalchemy.create_engine('ibm_db_sa://db2inst1:secret@xxxxxxxxxxxxx:50000/pydev <http://db2inst1:secret@xxxxxxxxxxxxx:50000/pydev>')

-Dolph


On Thu, Dec 20, 2012 at 4:05 AM, Kevin-Yang <benbenzhuforever@xxxxxxxxx <mailto:benbenzhuforever@xxxxxxxxx>> wrote:

    Dolph,

    Really appreciated for your response.

    My VM configuration is:

    OS ->
    Red Hat Enterprise Linux Server release 6.3 (Santiago)

    DB2 ->
    Informational tokens are "DB2 v9.7.0.0", "s090521",
    "LINUXAMD6497", and Fix
    Pack "0"
    ibm_db ->
    http://pypi.python.org/packages/source/i/ibm_db/ibm_db-2.0.0.tar.gz#md5=709c576c0ec2379ca15049f5c861beb1
    ibm_db_sa ->

    When i changed from "ibmdb" -> "ibm_db_sa", I came with a
    different error -> Could not determine dialect for 'ibm_db_sa'.
    ##################################################################################
    Traceback (most recent call last):
      File "/usr/local/bin/keystone-manage", line 5, in <module>
        pkg_resources.run_script('keystone==2012.2', 'keystone-manage')
      File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 499,
    in run_script
      File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1239,
    in run_script
      File
    "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/EGG-INFO/scripts/keystone-manage",
    line 28, in <module>
        cli.main(argv=sys.argv, config_files=config_files)
      File
    "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/cli.py",
    line 164, in main
        return run(cmd, (args[:1] + args[2:]))
      File
    "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/cli.py",
    line 147, in run
        return CMDS[cmd](argv=args).run()
      File
    "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/cli.py",
    line 35, in run
        return self.main()
      File
    "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/cli.py",
    line 56, in main
        driver.db_sync()
      File
    "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/identity/backends/sql.py",
    line 136, in db_sync
        migration.db_sync()
      File
    "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/common/sql/migration.py",
    line 49, in db_sync
        current_version = db_version()
      File
    "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/common/sql/migration.py",
    line 61, in db_version
        return versioning_api.db_version(CONF.sql.connection, repo_path)
      File "<string>", line 2, in db_version
      File
    "/usr/local/lib/python2.7/site-packages/migrate/versioning/util/__init__.py",
    line 155, in with_engine
        engine = construct_engine(url, **kw)
      File
    "/usr/local/lib/python2.7/site-packages/migrate/versioning/util/__init__.py",
    line 140, in construct_engine
        return create_engine(engine, **kwargs)
      File
    "build/bdist.linux-x86_64/egg/sqlalchemy/engine/__init__.py", line
    338, in create_engine
      File
    "build/bdist.linux-x86_64/egg/sqlalchemy/engine/strategies.py",
    line 50, in create
      File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/url.py",
    line 123, in get_dialect

    sqlalchemy.exc.ArgumentError: Could not determine dialect for
    'ibm_db_sa'.
    ##################################################################################

    --
    You received this bug notification because you are a bug assignee.
    https://bugs.launchpad.net/bugs/987121

    Title:
      strict constraint for database table creation

    Status in OpenStack Identity (Keystone):
      Fix Released

    Bug description:
      OpenStack claims that any type of database supporting SQLAlchemy
    can be taken as the database for OpenStack use.
      In some databases, if a column is defined as UNIQUE, it must be
    specified NOT NULL at the same time, e.g. IBM DB2, which is
    SQLAlchemy supporting. I am doing some tests with DB2 now.
      For the tables TENANT, USER and ROLE, they all have the column
    NAME, but they don't define this column NOT NULL. For database
    like MYSQL, it is permitted and keystone-manage db_sync works
    well. However, for database with strict constrains, like IBM DB2,
    this is not allowed. Running keystone-manage db_sync will prompt
    the error, which tells me UNIQUE and NOT NULL must be specified
    for the column NAME.
      Suggestion:
      In the code keystone/identity/backends/sql.py, we have
      name = sql.Column(sql.String(64), unique=True)

      If we change it into
      name = sql.Column(sql.String(64), unique=True, nullable=False),
      this issue will be solved.

    To manage notifications about this bug go to:
    https://bugs.launchpad.net/keystone/+bug/987121/+subscriptions




_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to     : openstack@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


References