Commit Graph

58846 Commits

Author SHA1 Message Date
Stephen Finucane bcf225daf4 db: Move main DB migrations
We place these in a 'legacy_migrations' directory, as we will soon be
adding alembic-based migrations in a 'migration' directory.

Change-Id: Ib927e4c48f59a467a913875111ffbf64ffe0de90
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-07-05 11:05:04 +01:00
Stephen Finucane 4bbea58cbb db: Move db.sqalchemy.migration to db.migration
At this point is nova's lifecycle, we're not going to change our ORM,
making the layer of indirection that is 'nova.db.sqlalchemy' is a
useless one. Start removing it with the 'migration' module.

Change-Id: I5fd6c6f74b7de2b422359cbe72defb07252e6b1e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-07-05 11:05:04 +01:00
Stephen Finucane 43de2421b3 db: Use module-level imports for sqlalchemy (for real)
Change If90d9295b231166a28c2cc350d324691821a696b kicked off this effort
but only change the migrations. This change completes the job.

Change-Id: Ic0f2c326ebce8d7c89b0debf5225cbe471daca03
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-07-05 11:04:42 +01:00
Zuul e7a7fd51d1 Merge "db: Clean up migration code" 2021-07-03 05:23:37 +00:00
Zuul d03a600461 Merge "db: Synchronize function signatures" 2021-07-01 20:16:18 +00:00
Zuul e7c18ef9bf Merge "db: Copy docs from 'nova.db.*' to 'nova.db.sqlalchemy.*'" 2021-07-01 20:15:55 +00:00
Zuul efd9a4212b Merge "db: Remove 'nova.db.base' module" 2021-07-01 19:52:32 +00:00
Zuul 433267147b Merge "db: Fold in ForeignKey constraints" 2021-07-01 19:52:03 +00:00
Zuul 958d958ba2 Merge "fix sr-iov support on Cavium ThunderX hosts." 2021-07-01 17:27:09 +00:00
Zuul 3daf6d5fe5 Merge "Make explicit the network backend used in the CI jobs" 2021-06-30 19:44:54 +00:00
Zuul ee3b492506 Merge "Improve policy doc for supported scope info" 2021-06-29 17:49:53 +00:00
Zuul 80c9aec5a6 Merge "Remove PROJECT_ADMIN limitation from zero-disk and external-network policy" 2021-06-29 17:49:26 +00:00
Zuul f17c1ed7ab Merge "Make test_refresh_associations_* deterministic" 2021-06-29 17:15:24 +00:00
Zuul b280ab292b Merge "Fix typos in minimum version policy docs" 2021-06-29 17:14:27 +00:00
Zuul a70137f1d8 Merge "Add test coverage for API version headers in CORS" 2021-06-29 17:13:44 +00:00
Zuul 25e2184849 Merge "Fix error '404 Not Found'" 2021-06-29 13:15:43 +00:00
Sean Mooney a569a51fed fix sr-iov support on Cavium ThunderX hosts.
This change is a partial revert of
Ibf8dca4bd57b3bddb39955b53cc03564506f5754
to reintoduce a try-except which is required for
some non standard hardware.

On the Cavium ThunderX platform, it's possible to have
virutal functions which are netdevs which are not associated
to a PF. This causes the PF name lookup to fail.
Prior to Ibf8dca4bd57b3bddb39955b53cc03564506f5754
when the lookup failed it was caught and we skipped
populating the parent PF interface name.

This change restores that behavior.

Closes-Bug: #1915255
Change-Id: Ia10ccdd9fbed3870d0592e3cbbff17f292651dd2
2021-06-28 12:48:26 +00:00
Zuul 1f6c351712 Merge "zuul: Add nova-tox-functional-centos8-py36 job" 2021-06-25 15:40:20 +00:00
Zuul 9311f54149 Merge "tests: Allow bindep and test-setup.sh to run on EL distros" 2021-06-25 15:17:09 +00:00
Zuul 6b727634bc Merge "db: Fold in indexes" 2021-06-25 12:56:58 +00:00
Zuul ff40fb77c9 Merge "db: Use module-level imports for sqlalchemy" 2021-06-25 12:09:55 +00:00
Rodolfo Alonso Hernandez 17cca270a6 Make explicit the network backend used in the CI jobs
All Neutron CI jobs (except for unit, functional and fullstack jobs),
have explicitly defined the network backend used:
- linuxbridge
- ovs
- ovn

That was discussed and approved during the Neutron CI meetings [1].

[1]https://meetings.opendev.org/meetings/neutron_ci/2021/neutron_ci.2021-06-15-15.00.log.html

Depends-On: https://review.opendev.org/c/openstack/neutron/+/797051
Change-Id: I23889eb8ebc5911f6ac6c283bcd7316271a77715
2021-06-23 13:05:35 +00:00
Zuul e2f3d8f5ec Merge "Fix max cpu topologies with numa affinity" 2021-06-22 17:08:30 +00:00
Zuul 5979c64846 Merge "Test numa and vcpu topologies bug: #1910466" 2021-06-21 14:19:10 +00:00
Zuul 44ae850d3b Merge "api: Log correct client IP if load balancer in use" 2021-06-21 12:36:58 +00:00
ericxiett c31d3f96b1 Fix error '404 Not Found'
The link of `TLS everywhere` should be 'https://docs.openstack.org/
project-deploy-guide/tripleo-docs/latest/features/tls-everywhere.html'.

Closes-Bug: #1933062
Change-Id: I468b82edeb899b0a780f8b545ad23ee0428a93ea
2021-06-21 15:04:43 +08:00
Zuul a6983621d4 Merge "db: Remove unused DB methods" 2021-06-19 13:28:43 +00:00
Zuul 2b9bb13b76 Merge "db: Reintroduce validation of shadow table schema" 2021-06-19 01:04:15 +00:00
Zuul d4fef9c7b8 Merge "db: Remove 'nova.db.sqlalchemy.utils'" 2021-06-19 01:03:53 +00:00
Zuul 6f0256a8cc Merge "Handle OPERATION_FAILED error during detach" 2021-06-18 16:22:09 +00:00
Zuul 97f1741352 Merge "Add --task-log option to nova-manage db archive_deleted_rows" 2021-06-18 11:54:56 +00:00
Lee Yarwood b5b2e99824 zuul: Add nova-tox-functional-centos8-py36 job
The nova-tox-functional-py36 job was replaced with the current py38
version during Victoria by I1d6a2986fcb0435cfabdd104d202b65329909d2b.

However as clearly stated in both the Victoria and Xena runtime
reference documents python 3.6 remains supported through CentOS 8 and
later CentOS 8 stream.

This change reintroduces functional test coverage for py36 using a
CentOS 8 stream based job.

[1] https://governance.openstack.org/tc/reference/runtimes/victoria.html
[2] https://governance.openstack.org/tc/reference/runtimes/xena.html

Change-Id: I6ef77bd92f2595016a99d1953414d3f554f6b2eb
2021-06-18 12:34:44 +01:00
Lee Yarwood 085de864db tests: Allow bindep and test-setup.sh to run on EL distros
Only install mariadb on EL based hosts. Also when using mariadb and
postgresql on EL based distros we need to ensure each service is
configured and actually started before using either.

Co-Authored-By: Ade Lee <alee@redhat.com>
Change-Id: I7122933d85bd7d0333c2c35e0f1a8414c1baa6d5
2021-06-18 12:34:27 +01:00
Sean Mooney 387823b36d Fix max cpu topologies with numa affinity
Nova has never supported specifying per numa node
cpu toplogies. Logically the  cpu toplogy of a guest
is independent of its numa toplogy and there is no
way to model different cpu toplogies per numa node
or implement that in hardware.

The presence of the code in nova that allowed the generation
of these invalid configuration has now been removed as it
broke the automatic selection of cpu topologies based
on hw:max_[cpus|sockets|threads] flavor and image properties.

This change removed the incorrect code and related unit
tests with assert nova could generate invalid topologies.

Closes-Bug: #1910466
Change-Id: Ia81a0fdbd950b51dbcc70c65ba492549a224ce2b
2021-06-18 12:34:22 +01:00
Sean Mooney fe25fa13e0 Test numa and vcpu topologies bug: #1910466
This change reproduces bug #1910466
When hw:cpu_max_[sockets|cores|threads] is configured
in addition to an explict numa topologies and cpu pinning
nova is currently incapable of generating the correct
virtual CPU topology resulting in an index out of range
error as we attempt to retrieve the first topology
from an empty list.

This change reproduces the error via a new functional
test.

Related-Bug: #1910466
Change-Id: I333b3d85deed971678141307dd06545e308cf989
2021-06-18 12:15:27 +01:00
Zuul a0ec2de968 Merge "Move 'check-cherry-picks' test to gate, n-v check" 2021-06-17 21:42:14 +00:00
Zuul c9fd0c2951 Merge "gate: Remove test_evacuate.sh" 2021-06-17 12:19:23 +00:00
Zuul b60144e026 Merge "db: Remove dead code" 2021-06-17 12:19:00 +00:00
Stephen Finucane 4de5a92d4e db: Reintroduce validation of shadow table schema
This was removed in change I9b964c8e68051a995635a3d5f5aa09af2b0dcb82 but
it's still a valid thing to do. Reintroduce it, cleaning up the test in
the process by removing references to dump tables (which were removed
entirely in change I17db7cdaad2c6368092b4fb00d5959711ad249f9) as well as
references to migrations that no longer exist as they've been squashed.

Change-Id: I70219a094e473da113c9855b610c11faea50f3b3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-06-17 11:10:22 +01:00
melanie witt bc71331bca Add --task-log option to nova-manage db archive_deleted_rows
The task_log table contains instance usage audit records if
nova-compute has been configured with [DEFAULT]instance_usage_audit =
True. This will be the case if OpenStack Telemetry is being used in the
deployment, as the option causes nova to generate audit information
that Telemetry then retrieves from the server usage audit log API [1].

Historically, there has been no way to delete task_log table records
other than manual database modification. Because of this, task_log
records could pile up over time and operators are forced to perform
manual steps to periodically truncate the table.

This adds a --task-log option to the 'nova-manage db
archive_deleted_rows' CLI to also archive task_log records while
archiving the database. --task-log works in conjunction with --before
if operators desire archving only records that are older than <date>.
The 'updated_at' field is used by --task-log --before <date> to
determine the age of a task_log record for archival.

Closes-Bug: #1877189

[1] https://docs.openstack.org/api-ref/compute/#server-usage-audit-log-os-instance-usage-audit-log

Change-Id: Ibed67854a693c930effd4dba7aca6cd03b65bd92
2021-06-17 01:57:12 +00:00
Zuul b8a5961161 Merge "Retry lvm volume and volume group query" 2021-06-16 16:21:33 +00:00
Zuul ead497692b Merge "tests: Remove duplicate policy tests" 2021-06-16 15:49:27 +00:00
Zuul 4961132d79 Merge "Allow X-OpenStack-Nova-API-Version header in CORS" 2021-06-16 15:48:41 +00:00
Zuul eec1958d82 Merge "tests: Remove useless mocks" 2021-06-16 15:07:43 +00:00
Zuul b32804758e Merge "tests: Merge flavor tests" 2021-06-16 15:07:01 +00:00
Stephen Finucane 98b01c9a59 Move 'check-cherry-picks' test to gate, n-v check
This currently runs in the 'check' pipeline, as part of the pep8 job,
which causes otherwise perfectly valid backports to report as failing
CI. There's no reason a stable core shouldn't be encouraged to review
these patches: we simply want to prevent them *merging* before their
parent(s). Resolve this conflict by moving the check to separate voting
job in the 'gate' pipeline as well as a non-voting job in the 'check'
pipeline to catch more obvious issues.

Change-Id: Id3e4452883f6a3cf44ff58b39ded82e882e28c23
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-06-16 15:51:38 +01:00
Stephen Finucane 070e83b749 db: Clean up migration code
Reduce some duplication before we move these things around.

Change-Id: Id2285eeb7c56f598768da376d85b6830c2e99fb6
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-06-16 10:10:29 +01:00
Stephen Finucane b5dd59f8f9 db: Synchronize function signatures
A number of the abstract APIs in 'nova.db.api' had a different function
signature to their concrete implementations in 'nova.db.sqlalchemy.api'.
Correct this. Functions changed include:

- action_get_by_request_id
- create_context_manager
- instance_add_security_group
- instance_extra_update_by_uuid
- instance_get_all_by_filters
- instance_remove_security_group
- migration_get
- migration_get_by_id_and_instance
- pci_device_update
- service_get_minimum_version
- virtual_interface_delete_by_instance
- virtual_interface_get_by_instance
- virtual_interface_get_by_instance_and_network

To do this, the following script was used:

  >>> import nova.db.api as base_api
  >>> import nova.db.sqlalchemy.api as sqla_api
  >>> import collections
  >>> import inspect
  >>> for name in dir(base_api):
  ...     fn_base = getattr(base_api, name)
  ...     if not isinstance(fn_base, collections.Callable):
  ...         continue
  ...     fn_sqla = getattr(sqla_api, name, None)
  ...     if not fn_sqla or not isinstance(fn_sqla, collections.Callable):
  ...         print(f'missing function in nova.api.sqlalchemy.db: {name}')
  ...     spec_base = inspect.getfullargspec(fn_base)
  ...     spec_sqla = inspect.getfullargspec(fn_sqla)
  ...     if spec_base != spec_sqla:
  ...         print('mismatched function specs:')
  ...         print(f'base: {spec_base}')
  ...         print(f'sqla: {spec_sqla}')
  ...     break

In order for *this* to work, it was necessary to update the many
decorators in 'nova.db.sqlalchemy.api' so that function signatures were
preserved. This is possible by setting the signature of the wrapper to
that of the wrapped function.

Change-Id: Icb97a8b4e17fdbb2146ddf2729c906757c664f66
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-06-16 10:10:29 +01:00
Stephen Finucane 1d60cd7e05 db: Copy docs from 'nova.db.*' to 'nova.db.sqlalchemy.*'
We want to remove a level of indirection. Preserve the useful things
here, specifically, the docstrings. This was managed using the following
script:

  >>> from nova.db import api as api_a
  >>> from nova.db.sqlalchemy import api as api_b
  >>> from inspect import getmembers, isfunction
  >>> members_a = dict(getmembers(api_a, isfunction))
  >>> members_b = dict(getmembers(api_b, isfunction))
  >>> mismatch_members = []
  >>> for member in members_a:
  ...     if member in members_b:
  ...         doc_a = members_a[member].__doc__
  ...         doc_a = doc_a.strip() if doc_a else doc_a
  ...         doc_b = members_b[member].__doc__
  ...         doc_b = doc_b.strip() if doc_b else doc_b
  ...         if doc_a and doc_a != doc_b:
  ...             mismatch_members.append(member)
  >>> for member in mismatch_members:
  ...     print(member)

The docstrings are still missing a lot of information about parameters,
but that can be addressed another time/never.

Change-Id: I9f414cf831316b624132d9e06192f1ecbbd3dd78
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-06-16 10:10:29 +01:00
Stephen Finucane 7ab2947720 db: Remove 'nova.db.base' module
This made sense back in the day where the ORM was configurable and we
were making lots of direct calls to the database. Now, in a world where
most things happen via o.vo, it's just noise. Remove it.

Change-Id: I216cabcde5311abd46fdad9c95bb72c31b414010
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-06-16 10:10:29 +01:00