If we are manually creating these things, we don't want any
automatically created. This is a latent issue that was being exposed by
SQLAlchemy 2.0's tweaked session management.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I9d760ebbfcca176a39b44f20fb92e16eaf6284c5
This is reported upstream [1] but I suspect the root cause is that we
were relying on a bug in Alembic: renaming tables doesn't really make
sense as a batch operation, which by definition works by recreating
tables with an updated schema (to support SQLite and its lack of full
'ALTER' support).
[1] https://github.com/sqlalchemy/alembic/issues/1453
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I1da6d117778bbbad64b2df2dfd2f8aeef8a7084c
Resolve the following RemovedIn20Warning warning:
Using strings to indicate relationship names in Query.join() is
deprecated and will be removed in SQLAlchemy 2.0. Please use the
class-bound attribute directly.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I155b4ce4b605720c8335d465124fd32cc973a737
after testing using an assert for DML without a transaction,
we can now turn autocommit off. enginefacade should be used
completely now
Change-Id: I2ee07c7e41ea43c2ab24a4a095550dd0b5fe47dd
Now that we have migrated all of our DB APIs to enginefacade, we can
clean up the outstanding TODOs.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Iee198a16f030f1205d38b7c232d4e3a42642c756
Thankfully the APIs being migrated here were _mostly_ sharing sessions
already, so we can simply migrate from public (decorated) methods to
private methods with minimal fuss.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Id1b555e48106662d15e8c50567a5f3acecf6a8f1
We need to maintain these on quotas (for now) but not on other
operations.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I991d6127c14b5f06ca9ca8e6caccbc392e639b42
We migrate both of these at the same time since a share replica is
effectively a share instance with only the 'replica_state' field set. As
such, they share many common DB APIs.
These are mostly trivial to migrate. Just a lot of refactoring to create
private methods, avoiding nested transactions.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I267e2e0fac0b4130f8836de276082788fbd8d454
Added new column named 'backup_type' in 'share_backups' table
and changes the share common api libs to support the dhss_true
configuration for share backup creation
Partially-implements: bp/share-backup
Change-Id: Ifb88ec096674ea8bc010c1c3f6dea1b51be3beaa
Export locations are usually too difficult to memo
rize.Currently, there is no way to determine the
export location before the share is created, so
users wait until the share creation request gets
completed, and then they check the export
locations to mount the share. The generated
export locations are often not human readable
and it is hard to memorize and control them.
Implements: bp/human-readable-export-locations
Change-Id: I72ac7e24ddd4330d76cafd5e7f78bac2b0174883
We are failing py311 jobs with our migration checks;
and the reason is that we have some 'implied' sql defaults
that might be inconsistent with the server versions - one
of them is the charset. We recently [1] fixed a bunch of
un-annotated tables with explicit charset declarations.
This is a continuation of that attempt.
Unfortunately, we can't change history. On existing
deployments, changes to these migrations will be ignored,
and must be done manually if there are any inconsistencies
to be fixed.
While we're at it, this commit also cleans up separate
steps to set the charset and engine to pre-created
tables.
[1] I7cd6fa0cc8e054af112493746e753fef2024000f
Closes-Bug: #2053211
Change-Id: I16345f63a279549e81cbde7b60fed29521d48a02
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
'_share_get_query' isn't really necessary and makes the code a little
trickier to read. Remove it.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I4089c28a53846afdd8b6baa911de0120ce004ae3
Share network subnet is deleted during share network deletion which was
missing earlier causing lots of stale db entries.
Change-Id: Idb58b4ca389cfb1aaf8f9f1f8aa2fd15979c4872
Closes-bug: #2037422
Well, most of them. Two are left out since they call into 'share_*' APIs
and that's a whole other bag of string. We'll tackle those later.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I170a406d4eb236d9921113270b58657a6ddaad0a
Another set of APIs that are commonly used from other APIs. Add private
versions of these that we can call without worrying about them creating
new sessions on us.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I37f5a058dd1dec8e1a6ba129f121de12c0f2f3e1
We are currently running this outside of the main session of many APIs.
This is tough to do when the session is created as a decorator. Make
life easier by using a decorator, which allows us to use a separate
context and separate session.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I95187d5b9bc21120c74b6784489c1b0dbbf337da
We migrate these two at the same time since they're so intertwined.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I23255a4a361602b602bca8349b5948efd147178d
This is an important helper in the migration to enginefacade since
'share_get' is currently used in so many other functions. We must move
a 'get_session' call out of '_share_get_query' so that we won't
inadvertently ignore the session stored in the context.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Iffe9e46ca707ef8cca3fe878faa29b62b924ab42
This better aligns with 'export_location_metadata_*' APIs. The plural
'export_locations_get*' APIs are renamed to 'export_location_get_all*'.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I14f2b834e7ac2d8be86f9d7e381706cadbb79eb8
Rename a number of APIs to use singular, rather than plural, like every
other API uses:
- share_instances_status_update ->
share_instance_status_update
- share_instances_get_all ->
share_instance_get_all
- share_instances_get_all_by_host ->
share_instance_get_all_by_host
- share_instances_get_all_by_share_network ->
share_instance_get_all_by_share_network
- share_instances_get_all_by_share_server ->
share_instance_get_all_by_share_server
- share_instances_get_all_by_share ->
share_instance_get_all_by_share
- share_instances_get_all_by_share_group_id ->
share_instance_get_all_by_share_group_id
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ic48fe0d1631a6e1a8ee9a50741cc1b31c9187c37
Currently, delete of share network leaves security service associations
behind it. DB purge job can't process them because they are constrained
to soft-deleted networks. Proposed patch fixes both formation of
orphaned associations and seamless purging of them.
Closes-Bug: #2029366
Change-Id: I9593dd6e89b2d290d3919c92d209132e1cec84f0