Freeze models for healing migration
Take a snapshot of all models from the code base at the time when the healing migration merges. The healing migration needs this frozen view of the models to be available (even as the models change in the future) to compare with the current DB schema. The healing migration will use this comparison to heal the schema. partially implement bp: db-migration-refactor Change-Id: I438147c7961b1ecad47f6146cc7fc9396aee7bc5
This commit is contained in:
parent
019444170b
commit
ec952faf5d
0
neutron/db/migration/models/__init__.py
Normal file
0
neutron/db/migration/models/__init__.py
Normal file
1823
neutron/db/migration/models/frozen.py
Normal file
1823
neutron/db/migration/models/frozen.py
Normal file
File diff suppressed because it is too large
Load Diff
86
neutron/db/migration/models/head.py
Normal file
86
neutron/db/migration/models/head.py
Normal file
@ -0,0 +1,86 @@
|
||||
# Copyright (c) 2014 OpenStack Foundation.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
The module provides all database models at current HEAD.
|
||||
|
||||
Its purpose is to create comparable metadata with current database schema.
|
||||
Based on this comparison database can be healed with healing migration.
|
||||
|
||||
"""
|
||||
|
||||
from neutron.db import agents_db # noqa
|
||||
from neutron.db import agentschedulers_db # noqa
|
||||
from neutron.db import allowedaddresspairs_db # noqa
|
||||
from neutron.db import external_net_db # noqa
|
||||
from neutron.db import extradhcpopt_db # noqa
|
||||
from neutron.db import extraroute_db # noqa
|
||||
from neutron.db.firewall import firewall_db # noqa
|
||||
from neutron.db import l3_agentschedulers_db # noqa
|
||||
from neutron.db import l3_db # noqa
|
||||
from neutron.db import l3_gwmode_db # noqa
|
||||
from neutron.db.loadbalancer import loadbalancer_db # noqa
|
||||
from neutron.db.metering import metering_db # noqa
|
||||
from neutron.db import model_base
|
||||
from neutron.db import models_v2 # noqa
|
||||
from neutron.db import portbindings_db # noqa
|
||||
from neutron.db import portsecurity_db # noqa
|
||||
from neutron.db import quota_db # noqa
|
||||
from neutron.db import routedserviceinsertion_db # noqa
|
||||
from neutron.db import routerservicetype_db # noqa
|
||||
from neutron.db import securitygroups_db # noqa
|
||||
from neutron.db import servicetype_db # noqa
|
||||
from neutron.db.vpn import vpn_db # noqa
|
||||
from neutron.plugins.bigswitch.db import consistency_db # noqa
|
||||
from neutron.plugins.bigswitch import routerrule_db # noqa
|
||||
from neutron.plugins.brocade.db import models as brocade_models # noqa
|
||||
from neutron.plugins.cisco.db import n1kv_models_v2 # noqa
|
||||
from neutron.plugins.cisco.db import network_models_v2 # noqa
|
||||
from neutron.plugins.cisco.db import nexus_models_v2 # noqa
|
||||
from neutron.plugins.hyperv import model # noqa
|
||||
from neutron.plugins.linuxbridge.db import l2network_models_v2 # noqa
|
||||
from neutron.plugins.metaplugin import meta_models_v2 # noqa
|
||||
from neutron.plugins.ml2.drivers.brocade.db import ( # noqa
|
||||
models as ml2_brocade_models)
|
||||
from neutron.plugins.ml2.drivers.cisco.apic import apic_model # noqa
|
||||
from neutron.plugins.ml2.drivers.cisco.nexus import ( # noqa
|
||||
nexus_models_v2 as ml2_nexus_models_v2)
|
||||
from neutron.plugins.ml2.drivers.mech_arista import db # noqa
|
||||
from neutron.plugins.ml2.drivers import type_flat # noqa
|
||||
from neutron.plugins.ml2.drivers import type_gre # noqa
|
||||
from neutron.plugins.ml2.drivers import type_vlan # noqa
|
||||
from neutron.plugins.ml2.drivers import type_vxlan # noqa
|
||||
from neutron.plugins.ml2 import models # noqa
|
||||
from neutron.plugins.mlnx.db import mlnx_models_v2 # noqa
|
||||
from neutron.plugins.nec.db import models as nec_models # noqa
|
||||
from neutron.plugins.nec.db import packetfilter as nec_packetfilter # noqa
|
||||
from neutron.plugins.nec.db import router # noqa
|
||||
from neutron.plugins.nuage import nuage_models # noqa
|
||||
from neutron.plugins.openvswitch import ovs_models_v2 # noqa
|
||||
from neutron.plugins.ryu.db import models_v2 as ryu_models_v2 # noqa
|
||||
from neutron.plugins.vmware.dbexts import lsn_db # noqa
|
||||
from neutron.plugins.vmware.dbexts import maclearning # noqa
|
||||
from neutron.plugins.vmware.dbexts import models as vmware_models # noqa
|
||||
from neutron.plugins.vmware.dbexts import networkgw_db # noqa
|
||||
from neutron.plugins.vmware.dbexts import qos_db # noqa
|
||||
from neutron.plugins.vmware.dbexts import vcns_models # noqa
|
||||
from neutron.services.loadbalancer import agent_scheduler # noqa
|
||||
from neutron.services.loadbalancer.drivers.embrane import ( # noqa
|
||||
models as embrane_models)
|
||||
from neutron.services.vpn.service_drivers import cisco_csr_db # noqa
|
||||
|
||||
|
||||
def get_metadata():
|
||||
return model_base.BASEV2.metadata
|
0
neutron/tests/functional/db/__init__.py
Normal file
0
neutron/tests/functional/db/__init__.py
Normal file
42
neutron/tests/functional/db/test_models.py
Normal file
42
neutron/tests/functional/db/test_models.py
Normal file
@ -0,0 +1,42 @@
|
||||
# Copyright (c) 2014 OpenStack Foundation.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import sqlalchemy
|
||||
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
class TestDBCreation(base.BaseTestCase):
|
||||
"""Check database schema can be created without conflicts.
|
||||
|
||||
For each test case is created a SQLite memory database.
|
||||
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestDBCreation, self).setUp()
|
||||
self.engine = sqlalchemy.create_engine('sqlite://')
|
||||
|
||||
def _test_creation(self, module):
|
||||
metadata = module.get_metadata()
|
||||
metadata.create_all(self.engine)
|
||||
|
||||
def test_head_creation(self):
|
||||
from neutron.db.migration.models import head
|
||||
self._test_creation(head)
|
||||
|
||||
def test_frozen_creation(self):
|
||||
from neutron.db.migration.models import frozen
|
||||
self._test_creation(frozen)
|
Loading…
x
Reference in New Issue
Block a user