neutron-server crashes when running on an empty database

Bug #1285993 reported by Itsuro Oda
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Aaron Rosen

Bug Description

operation:
$ mysql
> create database neutron_ml2 character set utf8;
> exit
$ neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini

error:
2014-02-28 15:02:46.550 TRACE neutron ProgrammingError: (ProgrammingError) (1146, "Table 'neutron_ml2.ml2_vlan_allocations' doesn't exist") 'SELECT ml2_vlan_allocations.physical_network AS ml2_vlan_allocations_physical_network, ml2_vlan_allocations.vlan_id AS ml2_vlan_allocations_vlan_id, ml2_vlan_allocations.allocated AS ml2_vlan_allocations_allocated \nFROM ml2_vlan_allocations FOR UPDATE' ()

investigation:
This problem introduced by https://review.openstack.org/#/c/74896/ .

Not that this problem does not occur if nuetron-db-manage is run before running neutron-server since ml2_vlan_allocations table is created by neutron-db-manage.

I did skip running neutron-db-manage usually and it was no problem. Is it prohibited now ?

Itsuro Oda (oda-g)
description: updated
Revision history for this message
Itsuro Oda (oda-g) wrote :

--- a/neutron/plugins/ml2/plugin.py
+++ b/neutron/plugins/ml2/plugin.py
@@ -98,10 +98,10 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
         return self._aliases

     def __init__(self):
+ super(Ml2Plugin, self).__init__()
         # First load drivers, then initialize DB, then initialize drivers
         self.type_manager = managers.TypeManager()
         self.mechanism_manager = managers.MechanismManager()
- db.initialize()
         self.type_manager.initialize()
         self.mechanism_manager.initialize()
         # bulk support depends on the underlying drivers
-----

This is a part of https://review.openstack.org/#/c/74896/

db.initialize() should not be removed or super(Ml2Plugin,self).__init__() should be called at this point.
Note that the error occurs in self.type_manager.initialize().

Revision history for this message
Aaron Rosen (arosen) wrote :

Hi Itsuro Oda,

Looks like you're right that those files needs to hit initialize so the models are loaded. i'll push the patch with you as an author.

Changed in neutron:
assignee: nobody → Aaron Rosen (arosen)
importance: Undecided → Medium
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/77081

Changed in neutron:
status: New → In Progress
Revision history for this message
Itsuro Oda (oda-g) wrote :

Aaron,
Thank you for the quick fix !

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/77081
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=71deb11f6fd5186cabcc42431316deb5dbfa3dfe
Submitter: Jenkins
Branch: master

commit 71deb11f6fd5186cabcc42431316deb5dbfa3dfe
Author: Aaron Rosen <email address hidden>
Date: Thu Feb 27 22:26:30 2014 -0800

    ML2: database needs to be initalized after drivers loaded

    Previously, if you started neutron-server with an empty database some
    of the tables that drivers use are not automatically created. That said,
    one should probably run neutron-db-manage manually to create the tables
    and not rely on neutron to do this. This regression was cause in 326b85.

    Change-Id: I2c578733de0213945b31fba86a3b0ea45c02295a
    Closes-bug: #1285993
    Co-Authored-By: Itsuro Oda <email address hidden>

Changed in neutron:
status: In Progress → Fix Committed
Changed in neutron:
milestone: none → icehouse-3
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: icehouse-3 → 2014.1
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.