Remove auto-generation of db schema from models at startup
This patch removes the Neutron capability of creating database tables from sqlalchemy models for all those model classes for which a table is not found in the database schema. Migrations should be the official and only solution for creating and managing the Neutron db schema. This patch also adapts unit tests in order to ensure test schemas are still correctly created. DocImpact Update deployment documentation accordingly. Closes-Bug: #1207402 Change-Id: Ie4ee5507888ecad5f6dc32ce7a029c43014687a2 Co-Authored-By: Henry Gessau <gessau@cisco.com>
This commit is contained in:

committed by
Henry Gessau

parent
4d385be7e3
commit
91a95ce0f5
@@ -21,7 +21,6 @@ from sqlalchemy import orm
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.common import constants as n_constants
|
||||
from neutron.db import api as qdbapi
|
||||
from neutron.db import common_db_mixin as base_db
|
||||
from neutron.db import l3_agentschedulers_db as l3_agent_db
|
||||
from neutron.db import l3_db
|
||||
@@ -162,10 +161,6 @@ class VPNService(model_base.BASEV2, models_v2.HasId, models_v2.HasTenant):
|
||||
class VPNPluginDb(vpnaas.VPNPluginBase, base_db.CommonDbMixin):
|
||||
"""VPN plugin database class using SQLAlchemy models."""
|
||||
|
||||
def __init__(self):
|
||||
"""Do the initialization for the vpn service plugin here."""
|
||||
qdbapi.register_models()
|
||||
|
||||
def _get_validator(self):
|
||||
"""Obtain validator to use for attribute validation.
|
||||
|
||||
|
@@ -16,7 +16,6 @@ import mock
|
||||
# from oslo.config import cfg
|
||||
|
||||
from neutron import context as n_ctx
|
||||
from neutron.db import api as dbapi
|
||||
from neutron.openstack.common import uuidutils
|
||||
from neutron.plugins.common import constants
|
||||
# from neutron.services.vpn import plugin as vpn_plugin
|
||||
@@ -24,6 +23,7 @@ from neutron.services.vpn.service_drivers import cisco_csr_db as csr_db
|
||||
from neutron.services.vpn.service_drivers import cisco_ipsec as ipsec_driver
|
||||
from neutron.services.vpn.service_drivers import cisco_validator as validator
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit import testlib_api
|
||||
|
||||
_uuid = uuidutils.generate_uuid
|
||||
|
||||
@@ -328,14 +328,12 @@ class TestCiscoIPsecDriverMapping(base.BaseTestCase):
|
||||
tenant_id='1000')
|
||||
|
||||
|
||||
class TestCiscoIPsecDriver(base.BaseTestCase):
|
||||
class TestCiscoIPsecDriver(testlib_api.SqlTestCase):
|
||||
|
||||
"""Test that various incoming requests are sent to device driver."""
|
||||
|
||||
def setUp(self):
|
||||
super(TestCiscoIPsecDriver, self).setUp()
|
||||
dbapi.configure_db()
|
||||
self.addCleanup(dbapi.clear_db)
|
||||
mock.patch('neutron.common.rpc.create_connection').start()
|
||||
|
||||
l3_agent = mock.Mock()
|
||||
|
Reference in New Issue
Block a user