Unable to create the Neutron network net_local because of constraints for db2

Bug #1294568 reported by Jun Xie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Jun Xie

Bug Description

CREATE TABLE subnets (tenant_id VARCHAR(255),id VARCHAR(36) NOT NULL, name VARCHAR(255),network_id VARCHAR(36), ip_version INT NOT NULL, cidr VARCHAR(64) NOT NULL,gateway_ip VARCHAR(64),enable_dhcp SMALLINT,shared SMALLINT,ipv6_ra_mode VARCHAR(16), ipv6_address_mode VARCHAR(16),PRIMARY KEY (id), FOREIGN KEY(network_id) REFERENCES networks (id),CHECK (enable_dhcp IN (0, 1)), CHECK (shared IN (0, 1)), CONSTRAINT ipv6_modes CHECK (ipv6_ra_mode IN ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless')),CONSTRAINT ipv6_modes CHECK (ipv6_address_mode IN ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless')))

for db2, this fails because the name ipv6_modes is used twice for a contraint name. In db2, A constraint-name must not identify a constraint that was already specified within the same CREATE TABLE statement. (SQLSTATE 42710).
=============

Checked neutron server.log and found

2014-03-18 18:37:45.799 19954 TRACE neutron Traceback (most recent call last):
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/bin/neutron-server", line 10, in <module>
2014-03-18 18:37:45.799 19954 TRACE neutron sys.exit(main())
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/server/__init__.py", line 54, in main
2014-03-18 18:37:45.799 19954 TRACE neutron neutron_api = service.serve_wsgi(service.NeutronApiService)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/service.py", line 113, in serve_wsgi
2014-03-18 18:37:45.799 19954 TRACE neutron LOG.exception(_('Unrecoverable error: please check log '
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/openstack/common/excutils.py", line 68, in __exit_
_
2014-03-18 18:37:45.799 19954 TRACE neutron six.reraise(self.type_, self.value, self.tb)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/service.py", line 106, in serve_wsgi
2014-03-18 18:37:45.799 19954 TRACE neutron service.start()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/service.py", line 75, in start
2014-03-18 18:37:45.799 19954 TRACE neutron self.wsgi_app = _run_wsgi(self.app_name)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/service.py", line 175, in _run_wsgi
2014-03-18 18:37:45.799 19954 TRACE neutron app = config.load_paste_app(app_name)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/common/config.py", line 170, in load_paste_app
2014-03-18 18:37:45.799 19954 TRACE neutron app = deploy.loadapp("config:%s" % config_path, name=app_name)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
2014-03-18 18:37:45.799 19954 TRACE neutron return loadobj(APP, uri, name=name, **kw)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
2014-03-18 18:37:45.799 19954 TRACE neutron return context.create()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 710, in create
2014-03-18 18:37:45.799 19954 TRACE neutron return self.object_type.invoke(self)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 144, in invoke
2014-03-18 18:37:45.799 19954 TRACE neutron **context.local_conf)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/util.py", line 56, in fix_call
2014-03-18 18:37:45.799 19954 TRACE neutron val = callable(*args, **kw)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/urlmap.py", line 25, in urlmap_factory
2014-03-18 18:37:45.799 19954 TRACE neutron app = loader.get_app(app_name, global_conf=global_conf)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 350, in get_app
2014-03-18 18:37:45.799 19954 TRACE neutron name=name, global_conf=global_conf).create()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 710, in create
2014-03-18 18:37:45.799 19954 TRACE neutron return self.object_type.invoke(self)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 144, in invoke
2014-03-18 18:37:45.799 19954 TRACE neutron **context.local_conf)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/util.py", line 56, in fix_call
2014-03-18 18:37:45.799 19954 TRACE neutron val = callable(*args, **kw)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/auth.py", line 69, in pipeline_factory
2014-03-18 18:37:45.799 19954 TRACE neutron app = loader.get_app(pipeline[-1])
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 350, in get_app
2014-03-18 18:37:45.799 19954 TRACE neutron name=name, global_conf=global_conf).create()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 710, in create
2014-03-18 18:37:45.799 19954 TRACE neutron return self.object_type.invoke(self)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
2014-03-18 18:37:45.799 19954 TRACE neutron return fix_call(context.object, context.global_conf, **context.local_conf)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/paste/deploy/util.py", line 56, in fix_call
2014-03-18 18:37:45.799 19954 TRACE neutron val = callable(*args, **kw)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/api/v2/router.py", line 71, in factory
2014-03-18 18:37:45.799 19954 TRACE neutron return cls(**local_config)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/api/v2/router.py", line 75, in __init__
2014-03-18 18:37:45.799 19954 TRACE neutron plugin = manager.NeutronManager.get_plugin()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/manager.py", line 211, in get_plugin
2014-03-18 18:37:45.799 19954 TRACE neutron return cls.get_instance().plugin
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/manager.py", line 206, in get_instance
2014-03-18 18:37:45.799 19954 TRACE neutron cls._create_instance()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/openstack/common/lockutils.py", line 249, in inner
2014-03-18 18:37:45.799 19954 TRACE neutron return f(*args, **kwargs)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/manager.py", line 200, in _create_instance
2014-03-18 18:37:45.799 19954 TRACE neutron cls._instance = cls()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/manager.py", line 112, in __init__
2014-03-18 18:37:45.799 19954 TRACE neutron plugin_provider)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/manager.py", line 140, in _get_plugin_instance
2014-03-18 18:37:45.799 19954 TRACE neutron return plugin_class()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/plugins/ml2/plugin.py", line 105, in __init__
2014-03-18 18:37:45.799 19954 TRACE neutron super(Ml2Plugin, self).__init__()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/db/db_base_plugin_v2.py", line 225, in __init__
2014-03-18 18:37:45.799 19954 TRACE neutron db.configure_db()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/db/api.py", line 34, in configure_db
2014-03-18 18:37:45.799 19954 TRACE neutron register_models()
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/neutron/db/api.py", line 53, in register_models
2014-03-18 18:37:45.799 19954 TRACE neutron base.metadata.create_all(engine)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/schema.py", line 2571, in create_all
2014-03-18 18:37:45.799 19954 TRACE neutron tables=tables)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 2302, in _run_visitor
2014-03-18 18:37:45.799 19954 TRACE neutron conn._run_visitor(visitorcallable, element, **kwargs)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1972, in _run_visitor
2014-03-18 18:37:45.799 19954 TRACE neutron **kwargs).traverse_single(element)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/sql/visitors.py", line 106, in traverse_singl
e
2014-03-18 18:37:45.799 19954 TRACE neutron return meth(obj, **kw)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/ddl.py", line 67, in visit_metadata
2014-03-18 18:37:45.799 19954 TRACE neutron self.traverse_single(table, create_ok=True)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/sql/visitors.py", line 106, in traverse_singl
e
2014-03-18 18:37:45.799 19954 TRACE neutron return meth(obj, **kw)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/ddl.py", line 86, in visit_table
2014-03-18 18:37:45.799 19954 TRACE neutron self.connection.execute(schema.CreateTable(table))
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1449, in execute
2014-03-18 18:37:45.799 19954 TRACE neutron params)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1542, in _execute_ddl
2014-03-18 18:37:45.799 19954 TRACE neutron compiled
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1698, in _execute_conte
xt
2014-03-18 18:37:45.799 19954 TRACE neutron context)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/base.py", line 1691, in _execute_conte
xt
2014-03-18 18:37:45.799 19954 TRACE neutron context)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib/python2.6/site-packages/ibm_db_sa/ibm_db.py", line 104, in do_execute
2014-03-18 18:37:45.799 19954 TRACE neutron cursor.execute(statement, parameters)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/ibm_db_dbi.py", line 1335, in execute
2014-03-18 18:37:45.799 19954 TRACE neutron self._execute_helper(parameters)
2014-03-18 18:37:45.799 19954 TRACE neutron File "/usr/lib64/python2.6/site-packages/ibm_db_dbi.py", line 1247, in _execute_helper
2014-03-18 18:37:45.799 19954 TRACE neutron raise self.messages[len(self.messages) - 1]
2014-03-18 18:37:45.799 19954 TRACE neutron ProgrammingError: (ProgrammingError) ibm_db_dbi::ProgrammingError: Statement Execute Failed: [IBM][
CLI Driver][DB2/LINUXX8664] SQL0601N The name of the object to be created is identical to the existing name "IPV6_MODES" of type "CHECK CONST"
. SQLSTATE=42710 SQLCODE=-601 "\nCREATE TABLE subnets (\n\ttenant_id VARCHAR(255), \n\tid VARCHAR(36) NOT NULL, \n\tname VARCHAR(255), \n\tnet
work_id VARCHAR(36), \n\tip_version INT NOT NULL, \n\tcidr VARCHAR(64) NOT NULL, \n\tgateway_ip VARCHAR(64), \n\tenable_dhcp SMALLINT, \n\tshar
ed SMALLINT, \n\tipv6_ra_mode VARCHAR(16), \n\tipv6_address_mode VARCHAR(16), \n\tPRIMARY KEY (id), \n\tFOREIGN KEY(network_id) REFERENCES netw
orks (id), \n\tCHECK (enable_dhcp IN (0, 1)), \n\tCHECK (shared IN (0, 1)), \n\tCONSTRAINT ipv6_modes CHECK (ipv6_ra_mode IN ('slaac', 'dhcpv6-
stateful', 'dhcpv6-stateless')), \n\tCONSTRAINT ipv6_modes CHECK (ipv6_address_mode IN ('slaac', 'dhcpv6-stateful', 'dhcpv6-stateless'))\n)\n\n
" ()
2014-03-18 18:37:45.799 19954 TRACE neutron

Revision history for this message
Jun Xie (junxiebj) wrote :

error log can be seen here more clearly: http://paste.openstack.org/show/73814/

Changed in neutron:
assignee: nobody → Jun Xie (junxiebj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/81488

Changed in neutron:
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/81488
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=5d6cb0c62e0245735a9d511d2f871776055ff224
Submitter: Jenkins
Branch: master

commit 5d6cb0c62e0245735a9d511d2f871776055ff224
Author: jun xie <email address hidden>
Date: Wed Mar 19 18:01:52 2014 +0800

    Use different name for the same constraint

    In DB2, a constraint-name must not identify a constraint
    that was already specified within the same CREATE TABLE
    statement. The current CREATE TABLE statement uses the same
    constraint name 'ipv6_modes' for both ipv6_ra_mode and
    ipv6_address_mode column. This change tries to use different
    names.

    Change-Id: Id4d82fb7e0e570a843e28856e531e25578a4351a
    Closes-Bug: #1294568

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.