<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><br>
      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.  <br>
      <br>
      The steps:<br>
      <br>
      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.<br>
      <br>
      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.<br>
      <br>
      A user then could run against those test  with ./run_tests.sh -x 
      _db_livetests<br>
      <br>
      <br>
      <br>
      <br>
      <br>
      On 12/20/2012 11:55 AM, Dolph Mathews wrote:<br>
    </div>
    <blockquote
cite="mid:CAC=h7gWJ9cKtMXQFdTHYYk_Q7q5V01k6vSrZZi0H=_7QVMQCfg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div style="">(raising to the mailing list)</div>
        <div><br>
        </div>
        Which DB2 driver are you using? I was referring to: <a
          moz-do-not-send="true"
          href="http://code.google.com/p/ibm-db/wiki/README">http://code.google.com/p/ibm-db/wiki/README</a>
        <div>
          <br>
        </div>
        <div style="">... which shows an example connection string for
          sqlalchemy as:</div>
        <div><br>
        </div>
        <div>>>> db2 = sqlalchemy.create_engine('ibm_db_sa://<a
            moz-do-not-send="true"
            href="http://db2inst1:secret@host.name.com:50000/pydev">db2inst1:secret@host.name.com:50000/pydev</a>')<br>
          <div class="gmail_extra">
            <div>
              <div><br>
              </div>
              -Dolph</div>
            <br>
            <br>
            <div class="gmail_quote">On Thu, Dec 20, 2012 at 4:05 AM,
              Kevin-Yang <span dir="ltr"><<a moz-do-not-send="true"
                  href="mailto:benbenzhuforever@gmail.com"
                  target="_blank">benbenzhuforever@gmail.com</a>></span>
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                Dolph,<br>
                <br>
                Really appreciated for your response.<br>
                <br>
                My VM configuration is:<br>
                <br>
                OS -><br>
                Red Hat Enterprise Linux Server release 6.3 (Santiago)<br>
                <br>
                DB2 -><br>
                Informational tokens are "DB2 v9.7.0.0", "s090521",
                "LINUXAMD6497", and Fix<br>
                Pack "0"<br>
                ibm_db -> <a moz-do-not-send="true"
href="http://pypi.python.org/packages/source/i/ibm_db/ibm_db-2.0.0.tar.gz#md5=709c576c0ec2379ca15049f5c861beb1"
                  target="_blank">http://pypi.python.org/packages/source/i/ibm_db/ibm_db-2.0.0.tar.gz#md5=709c576c0ec2379ca15049f5c861beb1</a><br>
                ibm_db_sa -><br>
                <br>
                When i changed from "ibmdb" -> "ibm_db_sa", I came
                with a different error -> Could not determine dialect
                for 'ibm_db_sa'.<br>
##################################################################################<br>
                <div class="im">Traceback (most recent call last):<br>
                    File "/usr/local/bin/keystone-manage", line 5, in
                  <module><br>
                      pkg_resources.run_script('keystone==2012.2',
                  'keystone-manage')<br>
                    File
                  "build/bdist.linux-x86_64/egg/pkg_resources.py", line
                  499, in run_script<br>
                    File
                  "build/bdist.linux-x86_64/egg/pkg_resources.py", line
                  1239, in run_script<br>
                    File
                  "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/EGG-INFO/scripts/keystone-manage",
                  line 28, in <module><br>
                      cli.main(argv=sys.argv, config_files=config_files)<br>
                    File
                  "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/cli.py",
                  line 164, in main<br>
                      return run(cmd, (args[:1] + args[2:]))<br>
                    File
                  "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/cli.py",
                  line 147, in run<br>
                      return CMDS[cmd](argv=args).run()<br>
                    File
                  "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/cli.py",
                  line 35, in run<br>
                      return self.main()<br>
                    File
                  "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/cli.py",
                  line 56, in main<br>
                      driver.db_sync()<br>
                    File
                  "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/identity/backends/sql.py",
                  line 136, in db_sync<br>
                      migration.db_sync()<br>
                </div>
                  File
                "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/common/sql/migration.py",
                line 49, in db_sync<br>
                    current_version = db_version()<br>
                  File
                "/usr/local/lib/python2.7/site-packages/keystone-2012.2-py2.7.egg/keystone/common/sql/migration.py",
                line 61, in db_version<br>
                    return
                versioning_api.db_version(CONF.sql.connection,
                repo_path)<br>
                  File "<string>", line 2, in db_version<br>
                  File
                "/usr/local/lib/python2.7/site-packages/migrate/versioning/util/__init__.py",
                line 155, in with_engine<br>
                    engine = construct_engine(url, **kw)<br>
                  File
                "/usr/local/lib/python2.7/site-packages/migrate/versioning/util/__init__.py",
                line 140, in construct_engine<br>
                    return create_engine(engine, **kwargs)<br>
                  File
                "build/bdist.linux-x86_64/egg/sqlalchemy/engine/__init__.py",
                line 338, in create_engine<br>
                  File
                "build/bdist.linux-x86_64/egg/sqlalchemy/engine/strategies.py",
                line 50, in create<br>
                  File
                "build/bdist.linux-x86_64/egg/sqlalchemy/engine/url.py",
                line 123, in get_dialect<br>
                <br>
                sqlalchemy.exc.ArgumentError: Could not determine
                dialect for 'ibm_db_sa'.<br>
##################################################################################<br>
                <div class="">
                  <div class="h5"><br>
                    --<br>
                    You received this bug notification because you are a
                    bug assignee.<br>
                    <a moz-do-not-send="true"
                      href="https://bugs.launchpad.net/bugs/987121"
                      target="_blank">https://bugs.launchpad.net/bugs/987121</a><br>
                    <br>
                    Title:<br>
                      strict constraint for database table creation<br>
                    <br>
                    Status in OpenStack Identity (Keystone):<br>
                      Fix Released<br>
                    <br>
                    Bug description:<br>
                      OpenStack claims that any type of database
                    supporting SQLAlchemy can be taken as the database
                    for OpenStack use.<br>
                      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.<br>
                      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.<br>
                      Suggestion:<br>
                      In the code keystone/identity/backends/sql.py, we
                    have<br>
                      name = sql.Column(sql.String(64), unique=True)<br>
                    <br>
                      If we change it into<br>
                      name = sql.Column(sql.String(64), unique=True,
                    nullable=False),<br>
                      this issue will be solved.<br>
                    <br>
                    To manage notifications about this bug go to:<br>
                    <a moz-do-not-send="true"
                      href="https://bugs.launchpad.net/keystone/+bug/987121/+subscriptions"
                      target="_blank">https://bugs.launchpad.net/keystone/+bug/987121/+subscriptions</a><br>
                  </div>
                </div>
              </blockquote>
            </div>
            <br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Mailing list: <a class="moz-txt-link-freetext" href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a>
Post to     : <a class="moz-txt-link-abbreviated" href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a>
Unsubscribe : <a class="moz-txt-link-freetext" href="https://launchpad.net/~openstack">https://launchpad.net/~openstack</a>
More help   : <a class="moz-txt-link-freetext" href="https://help.launchpad.net/ListHelp">https://help.launchpad.net/ListHelp</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>