[Openstack-operators] neutron.db.migration.migrate_to_ml2 (Havana ovs->Icehouse ml2)
Mikyung Kang
mkkang at isi.edu
Tue Apr 21 17:30:54 UTC 2015
Hello,
I'm upgrading Neutron to ML2 while checking the following document on CentOS6.5. Also I tried it on CentOS7, but the result is same.
http://docs.openstack.org/openstack-ops/content/upgrades_havana-icehouse-rhel.html#treeDiv
Using neutron-db-manage, I updated database as follows:
Even though I got string error (sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string) when upgrading to icehouse, it's resolved by adding "connection = mysql://id:pw@x.x.x.x/ovs_quantum" into [database] section in /etc/neutron/neutron.conf file.
# neutron-db-manage --config-file /etc/neutron/neutron.conf \
> --config-file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini stamp havana
No handlers could be found for logger "neutron.common.legacy"
INFO [alembic.migration] Context impl MySQLImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
INFO [alembic.migration] Running stamp_revision -> havana
# neutron-db-manage --config-file /etc/neutron/neutron.conf \
> --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade icehouse
...
# neutron-db-manage --config-file /etc/neutron/neutron.conf \
> --config-file /etc/neutron/plugins/ml2/ml2_conf.ini current
No handlers could be found for logger "neutron.common.legacy"
INFO [alembic.migration] Context impl MySQLImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
icehouse (head)
After that, I'm trying to perform the conversion from OVS to ML2, but it can't create ml2_network_segments table.
# python -m neutron.db.migration.migrate_to_ml2 openvswitch \
> mysql://id:pw@x.x.x.x/ovs_quantum
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/site-packages/neutron/db/migration/migrate_to_ml2.py", line 462, in <module>
main()
File "/usr/lib/python2.7/site-packages/neutron/db/migration/migrate_to_ml2.py", line 458, in main
args.vxlan_udp_port)
File "/usr/lib/python2.7/site-packages/neutron/db/migration/migrate_to_ml2.py", line 138, in __call__
metadata.create_all(engine)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/schema.py", line 3352, in create_all
tables=tables)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1617, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1246, in _run_visitor
**kwargs).traverse_single(element)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 120, in traverse_single
return meth(obj, **kw)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 713, in visit_metadata
self.traverse_single(table, create_ok=True)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 120, in traverse_single
return meth(obj, **kw)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 732, in visit_table
self.connection.execute(CreateTable(table))
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute
return meth(self, multiparams, params)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 69, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 783, in _execute_ddl
compiled
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
context)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1160, in _handle_dbapi_exception
exc_info
File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
context)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute
cursor.execute(statement, parameters)
File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
sqlalchemy.exc.OperationalError: (OperationalError) (1005, "Can't create table 'ovs_quantum.ml2_network_segments' (errno: 150)") '\nCREATE TABLE ml2_network_segments (\n\tid VARCHAR(36) NOT NULL, \n\tnetwork_id VARCHAR(36) NOT NULL, \n\tnetwork_type VARCHAR(32) NOT NULL, \n\tphysical_network VARCHAR(64), \n\tsegmentation_id INTEGER, \n\tPRIMARY KEY (id), \n\tFOREIGN KEY(network_id) REFERENCES networks (id) ON DELETE CASCADE\n)\n\n' ()
But, I could create it manually as follows:
> CREATE TABLE ml2_network_segments ( id VARCHAR(36) NOT NULL, network_id VARCHAR(36) NOT NULL, network_type VARCHAR(32) NOT NULL , physical_network VARCHAR(64), segmentation_id INT);
> ALTER TABLE ml2_network_segments ADD FOREIGN KEY (network_id) REFERENCES networks (id) ON DELETE cascade;
> ALTER TABLE ml2_network_segments ADD PRIMARY KEY (id);
After that, I got different error about ml2_port_bindings.
#python -m neutron.db.migration.migrate_to_ml2 openvswitch \
> mysql://id:pw@x.x.x.x/ovs_quantum
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/site-packages/neutron/db/migration/migrate_to_ml2.py", line 462, in <module>
main()
File "/usr/lib/python2.7/site-packages/neutron/db/migration/migrate_to_ml2.py", line 458, in main
args.vxlan_udp_port)
File "/usr/lib/python2.7/site-packages/neutron/db/migration/migrate_to_ml2.py", line 138, in __call__
metadata.create_all(engine)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/schema.py", line 3352, in create_all
tables=tables)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1617, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1246, in _run_visitor
**kwargs).traverse_single(element)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 120, in traverse_single
return meth(obj, **kw)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 713, in visit_metadata
self.traverse_single(table, create_ok=True)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 120, in traverse_single
return meth(obj, **kw)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 732, in visit_table
self.connection.execute(CreateTable(table))
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 729, in execute
return meth(self, multiparams, params)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 69, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 783, in _execute_ddl
compiled
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
context)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1160, in _handle_dbapi_exception
exc_info
File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
context)
File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute
cursor.execute(statement, parameters)
File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
sqlalchemy.exc.IntegrityError: (IntegrityError) (1215, 'Cannot add foreign key constraint') "\nCREATE TABLE ml2_port_bindings (\n\tport_id VARCHAR(36) NOT NULL, \n\thost VARCHAR(255) NOT NULL, \n\tvif_type VARCHAR(64) NOT NULL, \n\tdriver VARCHAR(64), \n\tsegment VARCHAR(36), \n\tvnic_type VARCHAR(64) DEFAULT 'normal' NOT NULL, \n\tvif_details VARCHAR(4095) DEFAULT '' NOT NULL, \n\tprofile VARCHAR(4095) DEFAULT '' NOT NULL, \n\tPRIMARY KEY (port_id), \n\tFOREIGN KEY(port_id) REFERENCES ports (id) ON DELETE CASCADE, \n\tFOREIGN KEY(segment) REFERENCES ml2_network_segments (id) ON DELETE SET NULL\n)\n\n" ()
Any suggestions are welcome!
Thanks,
Mikyung
More information about the OpenStack-operators
mailing list