Commit Graph

651 Commits

Author SHA1 Message Date
Zuul 88c07347b9 Merge "reno: Update master for unmaintained/xena" 2024-03-27 06:25:51 +00:00
Zuul d2b44cd706 Merge "reno: Update master for unmaintained/victoria" 2024-03-27 06:25:21 +00:00
Zuul a94fad707f Merge "reno: Update master for unmaintained/wallaby" 2024-03-27 06:25:19 +00:00
Zuul d585c1be0e Merge "reno: Update master for unmaintained/yoga" 2024-03-27 06:25:18 +00:00
Zuul d468c78e41 Merge "Update master for stable/2024.1" 2024-03-26 10:37:35 +00:00
Zuul e77edf8521 Merge "install dependencies when installing masakari" 2024-03-25 01:23:13 +00:00
OpenStack Release Bot f1cec3121d Update master for stable/2024.1
Add file to the reno documentation build to show release notes for
stable/2024.1.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/2024.1.

Sem-Ver: feature
Change-Id: I729ddc3c1f672c2c9840dce2982792154fd8f1ae
2024-03-14 07:20:45 +00:00
OpenStack Release Bot f4c64a88cd reno: Update master for unmaintained/xena
Update the xena release notes configuration to build from
unmaintained/xena.

Change-Id: Id0ca4a9e31d855b927e65b707eff659ea12a2b45
2024-03-05 18:25:31 +00:00
OpenStack Release Bot ae08617ff8 reno: Update master for unmaintained/wallaby
Update the wallaby release notes configuration to build from
unmaintained/wallaby.

Change-Id: I8f8dc91cdff25db7170ac536f827725c26ee56f4
2024-03-05 18:24:50 +00:00
OpenStack Release Bot e40c832df8 reno: Update master for unmaintained/victoria
Update the victoria release notes configuration to build from
unmaintained/victoria.

Change-Id: I9cdd67af7b2726646dc129ee25c985c349f93b9b
2024-03-05 18:24:07 +00:00
OpenStack Release Bot 73b48922f9 reno: Update master for unmaintained/yoga
Update the yoga release notes configuration to build from
unmaintained/yoga.

Change-Id: Idbd1d1a09d99c8329229726b767f5b269acfbc28
2024-02-19 09:09:09 +00:00
Zuul 8fbcb68ee6 Merge "Update python classifier in setup.cfg" 2024-02-18 07:44:54 +00:00
James Page 6b38affa15
tests: Fix syntax error in hacking test
Under Python 3.12 this results in a syntax error rather than
M329 being detected on line 8 of the test code.

Change-Id: Ia1bb4dfb43b00115cde1158681d34d6ad7c7d744
2024-01-22 20:18:43 +00:00
Ghanshyam Mann 36a6ec8ab7 Update python classifier in setup.cfg
As per the current release tested runtime, we test
till python 3.11 so updating the same in python
classifier in setup.cfg

Change-Id: I4bb6f61e833e1b32252db7dcf6773139746e5335
2024-01-03 20:23:07 -08:00
suzhengwei 229bc78778 enable check-requirements
Change-Id: I102d386b0ca91ba6dfdd98a3c0c1568d6e29b457
2023-12-26 13:36:04 +08:00
suzhengwei 19bf506816 remove sqlalchemy-migrate requirement
We switch to alembic, and not support sqlalchemy-migrate.

Change-Id: Id8f1e3a880e8939e1c9f3234304d010de2819f2e
2023-12-26 09:17:34 +08:00
Stephen Finucane 72b3083999 Add job to test with SQLAlchemy master (2.x)
Change-Id: I26e49c2ea77d3eed852c30de3d8ff9122812cb48
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-24 07:14:37 +00:00
Stephen Finucane 5647c6b132 db: Don't rely on implicit autocommit
Resolve the following RemovedIn20Warning warning:

  The current statement is being autocommitted using implicit
  autocommit, which will be removed in SQLAlchemy 2.0. Use the .begin()
  method of Engine or Connection in order to use an explicit transaction
  for DML and DDL statements.

This is the beefiest one due to our extensive reliance on auto-commit.

Change-Id: Iebf9d022c312b8f5457ff34eb497cdb851aa4901
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-24 03:36:11 +00:00
Stephen Finucane bbc4f7edd0 db: Don't use legacy select() calling style
Resolve the following RemovedIn20Warning warning:

  The legacy calling style of select() is deprecated and will be removed
  in SQLAlchemy 2.0.  Please use the new calling style described at
  select().

Change-Id: I00206489e97468d98a3a516c7c081c70348e3998
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-24 01:39:29 +00:00
Stephen Finucane 6f2a704556 db: Don't use strings to indicate paths
Resolve the following RemovedIn20Warning warning:

  Using strings to indicate column or relationship paths in loader
  options is deprecated and will be removed in SQLAlchemy 2.0.  Please
  use the class-bound attribute directly.

Change-Id: I1b71331796c2730713797043489b6c11710b9851
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-23 06:10:48 +00:00
Stephen Finucane 69d62e3e6d db: Don't pass strings to Connection.execute()
Resolve the following RemovedIn20Warning warning:

  Passing a string to Connection.execute() is deprecated and will be
  removed in version 2.0.  Use the text() construct, or the
  Connection.exec_driver_sql() method to invoke a driver-level SQL
  string.

We do the latter.

Change-Id: I0ee518022772beeb0298e12b5b36279fd384fb4a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-23 04:25:12 +00:00
Stephen Finucane 4545fdf69f tests: Resolve various warnings
These are highlighted by the new WarningsFixture.

Change-Id: If9a27784e4f4fde61dff73c1f6fde99324e1aa07
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-23 02:42:08 +00:00
Stephen Finucane 88950e33ba tests: Enable SQLAlchemy 2.0 deprecation warnings
Well, sort of. We enable them but immediately filter out the ones we're
actually seeing, the rationale being that we can address these in a
piecemeal fashion without the risk of introducing new issues.

There's a lot more to be done here. However, the work done in oslo.db
[1], nova [2], cinder [2] etc. should provide a guide for how to resolve
the outstanding issues.

[1] https://review.opendev.org/q/topic:sqlalchemy-20+project:openstack/oslo.db
[2] https://review.opendev.org/q/topic:sqlalchemy-20+project:openstack/nova
[3] https://review.opendev.org/q/topic:sqlalchemy-20+project:openstack/cinder

Change-Id: If13c14f1d968f1ef968ae440087227691cf966b0
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-22 15:57:44 +00:00
Stephen Finucane df3fdb4f4e db: Remove legacy migrations
These are no longer used. Curiously, sqlalchemy-migrate is not in the
dependencies and was instead being pulled in as a transitive dependency
of oslo.db. This will therefore disappear when oslo.db is bumped to 13.x
or later in upper-constraints, since that version removes
sqlalchemy-migrate support.

Change-Id: I4ea8ae36c9f8d3e5e5a9ac9548c5fe8f975cd666
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-22 09:24:36 +00:00
Stephen Finucane 6823ea5ed1 db: Migrate to alembic
This is easier than Cinder, Nova etc. but more difficult than Heat.
Masakari hasn't had many database migrations in recent cycles but it did
have on in Antelope. This means we need to handle people doing
skip-level upgrades and validate which version of the legacy migrations
they are currently on. We support users coming from both Zed and
Antelope and anyone else will need to go through an older version of
Masakari to update their database migrations first. Other than this
difference, the logic is pretty similar: as with other projects, we
simply determine if we're upgrading a deployment that was previously
using sqlalchemy-migrate, upgrading a deployment that has already
migrated to alembic, or deploying a new deployment, and adjust
accordingly.

In addition, we also have to consider Taskflow's migrations. These were
previously being run once as part of the legacy
006_add_persistence_tables migrations. Since Taskflow uses Alembic under
the hood, it's safe to run every time. The presence of Taskflow does
force us to use a different table name in Masakari though.

Note that one curious side-effect of this is that the order than table
rows are purged change. This appears to be happening because the
notification table is now being created in the initial Alembic
migration, which alters the return value of 'MetaData.sorted_tables'.
In any case, the fix is simply a case of adjusting this order in the
tests.

Change-Id: I5285d7cc3c6da0059c0908cedc195b2262cb1fce
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-22 07:31:12 +00:00
Stephen Finucane 85fd89726c tests: Validate number of rows _before_ purging
A nice sanity check.

Change-Id: I387fa387f392d2511d75ef955ae69df3978c65cb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-22 07:05:33 +00:00
Stephen Finucane d7a918f2b1 db: Sync alembic, sqlalchemy-migrate migrations
Alembic's auto-generate functionality doesn't preserve index names or
column order. This causes comparisons between databases to fail. Update
the initial alembic migration to match the schema's generated by
sqlalchemy-migrate.

Change-Id: I16763a82cc2db9138882ace2dad6f0cae330b9e8
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-22 05:31:48 +00:00
Stephen Finucane ed872b3fe0 db: Add initial alembic migration
This was generated using the same approach first used in heat [1], but
with a difference to account for the fact that, unlike heat, we have a
migration added in recent times. We generate our initial schema
automatically based on our models using alembic's auto-generate
functionality:

  alembic --config masakari/db/sqlalchemy/alembic.ini \
    revision -m 'Initial empty revision'
  alembic --config masakari/db/sqlalchemy/alembic.ini \
    upgrade head
  alembic --config masakari/db/sqlalchemy/alembic.ini \
    revision -m 'Auto-generated revision' --autogenerate

The two files were then combined, formatting and imports adjusted. We
then *remove* the parts of the migration related to the 'vm_moves' table
and run the autogeneration step again:

  alembic --config masakari/db/sqlalchemy/alembic.ini \
    revision -m 'Add vm moves table' --autogenerate

As noted above, this is necessary since we're going to need to support
alembic-based migrations for users jumping from e.g. Zed to Bobcat.
Once done, the schema of these migrations and the sqlalchemy-migrate
migrations are compared. This step was done by comparing the schemas of
a database created by the sqlalchemy-migrate tool to the one created by
alembic. First, we compared the initial alembic migration which
corresponds to the state of the database after sqlalchemy-migrate
migration 007:

  alembic --config masakari/db/sqlalchemy/alembic.ini \
    upgrade 8f848eb45d03
  python masakari/db/sqlalchemy/migrate_repo/manage.py version_control \
    sqlite:///masakari-old.db 000
  python masakari/db/sqlalchemy/migrate_repo/manage.py upgrade \
    sqlite:///masakari-old.db 007

With the two databases created, we can compare them using the
methodologies described in [2]. Once this is done, we do the same things
for the final migration to generate its own alembic variation of the
migration.

  alembic --config masakari/db/sqlalchemy/alembic.ini \
    upgrade head
  python masakari/db/sqlalchemy/migrate_repo/manage.py upgrade \
    sqlite:///masakari-old.db

These last steps highlight some small differences between the schemas.
These changes are kept to a separate change to make them more obvious.

[1] https://review.opendev.org/c/openstack/heat/+/878350
[2] https://that.guru/blog/comparing-nova-db-migrations/

Change-Id: I6d0f27ba1d81e75010e8b56c70172ccf32c1abb3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-22 02:38:43 +00:00
Stephen Finucane 13ae6c01c9 db: Wire up for auto-generation
Change-Id: I81b4c80b592230befb7bb315411b9f0b1214aee3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-22 01:03:57 +00:00
Stephen Finucane 50a46964a2 db: Add initial alembic configuration
No migrations yet: this is simply the output of 'alembic init' with some
minor tweaks.

Change-Id: Ib9423c2f751d7ec0a0dec89bdc39f9b6ab043655
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-21 15:57:33 +00:00
Stephen Finucane 962cf0abed db: Remove configurable backends
oslo.db has killed the idea of the migration wrappers. This knob is
therefore no longer useful.

Change-Id: Ia61b3291668b17b13d5f674c0dceff29a7b9b4cf
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-21 11:06:20 +00:00
Stephen Finucane 94257be795 pre-commit: Update dependencies
We also bump the hacking version and remove some unnecessary notes from
the top of the requirements files: these don't apply with the dependency
resolver introduced in pip 20.3.

Change-Id: Ifebaec916264bfd10eec13040295719fd47ae107
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-21 09:13:09 +00:00
suzhengwei e6ab50131e fix ci broken
1.Add sqlalchemy-migrate dependence in test-requirements.txt.

It will remove the dependence after this project switchs to alembic.
Remove "check-requirements" temporarily.

2.Fix unit tests broken by olso.utils

Some of the object unit tests grub Mock object unintentionally, and
that results in failure during initializing an versioned object,
because the Mock object does not present its version correctly.

3.make functional jobs not voting

Fix functional jobs later.

Change-Id: Id3c952a54e77952cfd0d76d259f49a14edca1d8b
2023-12-21 13:36:46 +08:00
Zuul b72beecca2 Merge "Fix compatability with new oslo.messaging" 2023-09-20 01:09:47 +00:00
Zuul d4feef4b96 Merge "Move functional tests to Jammy; focal unsupported" 2023-09-11 06:58:46 +00:00
Jay Faulkner 636df88983 Fix compatability with new oslo.messaging
A recent change to oslo.messaging to redact contexts before sending them
to a notification bus broke masakari due to the invalid default for
read_deleted. This ensures that a "None" value for read_deleted ends up
being interpreted as a 'none'.

Related-bug: #2030976
Change-Id: Ic9b895601f301c1e9ba135766493d4234fa9b50b
2023-09-08 14:06:04 -07:00
Jay Faulkner 21b8e38604 Move functional tests to Jammy; focal unsupported
Focal is no longer supported in devstack, and the PTI indicates this
should be testing against Jammy.

Change-Id: I4780d25e45b694527bf644cd228104f4429f6e6f
2023-09-08 14:05:23 -07:00
wangkuntian 4f71562214 install dependencies when installing masakari
Change-Id: I72b442c400e65bf388804df18a2ba487ccf9b228
2023-09-07 10:49:01 +08:00
Ghanshyam Mann 2d6ecd3623 Fix bindep.txt for python 3.11 job(Debian Bookworm)
Python 3.11 job run on Debian Bookworm which does
not the mysql pkg for example, mariadb-server, libmysqlclient-dev
instead they have mariadb. Updating bindep.txt file
to adjust the pkgs as per Debian bookworm.

Change-Id: Ic1008c7368bd1f658c48ddaef260e33d14358a03
2023-09-06 16:52:41 -05:00
suzhengwei bad1f2fe6e log when set host on maintenance
Change-Id: I44b1db763d3a0ed9eb4c007278c8f131db9b57dd
2023-06-29 18:54:49 +08:00
Zuul c6afc1bc8f Merge "add pre-commit" 2023-06-02 10:08:04 +00:00
suzhengwei dcb7c0b7e1 extend wait period for process notification
Change-Id: I99247ebd2d1384930eb5c3d3f01fdab1687570bd
2023-06-01 20:01:02 +08:00
suzhengwei 6d77bc827a add pre-commit
This tool provides a extensible way to configure pre-commit hooks
to do something from running linters to spell-checking and it proved
to be useful.

Change-Id: I77cf6c85559989bd051798e601640e0039342924
2023-05-30 19:55:03 +08:00
suzhengwei b2f2a58e3c use looping call with timeout
When period call, use loopingcall with timeout instead of etimeout.

Change-Id: I5c7d77a0578bbf96ba9d13f6b2784eb912fc548a
2023-03-20 18:02:04 +08:00
Zuul 0b32d34379 Merge "releasenote for Masakari VMove" 2023-03-09 17:36:30 +00:00
suzhengwei 17ebad5397 releasenote for Masakari VMove
Change-Id: I640ea99f680b5ff4a773a58282a6d4e1c16366da
2023-03-07 18:10:45 +08:00
OpenStack Release Bot 4f37490995 Update master for stable/2023.1
Add file to the reno documentation build to show release notes for
stable/2023.1.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/2023.1.

Sem-Ver: feature
Change-Id: I9c0c1aebda728918029eb05f307c285581d8f0d7
2023-03-06 09:14:05 +00:00
suzhengwei 3e1b85133a vmoves table purge support
Change-Id: I10b4793d0471a26df4381988670334a695067d27
2023-02-16 11:11:01 +08:00
Zuul 20db09fe0a Merge "add api-ref for masakari vmoves" 2023-02-02 11:02:07 +00:00
suzhengwei fdee6e1dab add api-ref for masakari vmoves
Change-Id: I82ba71efba7dd8b0b7e0919bfd543cd105b8f3d1
2023-02-02 17:10:33 +08:00