oslo.db lib starting with version 1.12.0 uses PyMySQL as mysql client.
We get problem with it as it does not close opened sessions by default.
And if we do some actions with migration sessions and do not close sessions,
then alembic, as db migration tool does not write to DB updated migration
version, that is final step of each migration.
It breaks further attempts to perform some migration actions in case some
migration can not be applied twice. Because of improper versions in DB,
alembic tries to execute same migrations again and again.
So, close migration sessions explicitly since PyMySQL does not do it itself.
Also, print version in devstack for getting more details in future debug of
devstack installation output.
Change-Id: I5c729f10bac23b1853e18127b50b1d9f053ab629
Closes-Bug: #1473400
Our migrations set field 'deleted' as Boolean for table
'share_type_extra_specs', but model 'ShareTypeExtraSpecs' treats it as Integer.
Same for several other models.
It works using MySQL as far it uses 'tinyint' storing `1` or `0` there. So, in
case of MySQL it is always Integer.
But PostgreSQL fails to write any records there because it distinguishes
Boolean from Integer. So, fix DB migrations, DB methods and models to make
mentioned field compatible for PostreSQL backend too.
Also, reuse func 'model_query' from oslo_db to remove errors with queries that
contain aggregate functions.
Change-Id: I0ca00ce86adad893ac786b10324a934d372e2a04
Closes-Bug: #1440089
Replace explicit usage of SQL code with appropriate analog of ORM.
It allows to keep abstraction between DB and python clear without
potential incompatibilities due to differencies in SQL dialects.
Change-Id: Ied97264cafcec0bcebd4c3ddc7b29185825c56a6
Closes-Bug: #1437278
Currently the driver_handles_share_servers is an optional extra_spec
on each share_type that allows the scheduler to filter. We want to
make this a required extra spec, so that every share type has this
value set to true or false. It's not be possible to remove that extra
spec. Modifying the extra spec is allowed as long as the value
remains either true or false.
- Add validation checks to types_manage and types_extra_specs API
controllers
- Add required_extra_specs to data returned by API methods
types_show() and types_index()
- Add db migration, which adds required extra_spec to all existing
share_types
- Add get_required_extra_specs(), validate_required_extra_spec(),
get_valid_required_extra_specs()
methods to share_types module
- Add appropriate unit tests
Partially implements bp share-type-require-driver-mode
Change-Id: I60a877b05a642ea2945b15248e885cf6f7f89aa0