[openstack-dev] [Neutron][DB] Strategy for collecting models for autogenerate
libosvar at redhat.com
Mon Aug 4 15:32:57 UTC 2014
as a part of making db migrations unconditional we need to have all
models easily collectible . Currently we have a head.py file
containing imports to all models. Disadvantage is that all imports need
to be collected manually and maintained in case new module with model is
added to the tree.
Original suggested approach was to consolidate all models into one
directory providing simple import of all models. This approach wasn't
liked so I tried to implement alternatives.
1) os.walk neutron directory, search for "model_base.BASEV2" occurrences
and import such modules.
2) Import all models in the tree excluding UT and neutron.db.migration
(since it contains frozen models).
I did simple benchmark of three mentioned approaches, could be found
On a DB meeting today we agreed that least painful way will be importing
all modules with pkgutil. Considering this will be used only in testing
and autogenerate, memory consumption and speed are imho acceptable.
We'd like to know your opinion, and especially Mark's opinion, on
mentioned approaches and if we can agree on the approach chosen on
- time tested with 100 iterations on Lenovo X230, 2 cores with
hyperthreading Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
More information about the OpenStack-dev