Commit Graph

2384 Commits

Author SHA1 Message Date
Zuul 0c004ecbb2 Merge "Fix migration scripts with SQLAlchemy 2.0" 2024-04-17 00:17:51 +00:00
Zuul 12287c7075 Merge "SQLAlchemy 2.0: Drop use of removed autoload" 2024-04-16 10:18:17 +00:00
Zuul b4e8727159 Merge "pyupgrade changes for Python3.8+ (7)" 2024-04-15 10:46:27 +00:00
Zuul 6f36be9cc6 Merge "pyupgrade changes for Python3.8+ (6)" 2024-04-15 10:46:25 +00:00
Zuul ce29065796 Merge "pyupgrade changes for Python3.8+ (5)" 2024-04-15 10:46:23 +00:00
Zuul 54495575ab Merge "pyupgrade changes for Python3.8+ (4)" 2024-04-15 09:46:01 +00:00
Zuul 314f2b60dc Merge "pyupgrade changes for Python3.8+ (3)" 2024-04-15 09:22:31 +00:00
Gregory Thiemonge 4e6121d9bc Fix migration scripts with SQLAlchemy 2.0
select no longer accepts list/tuple as first argument but it takes
multiple arguments [0]

[0] https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#select-no-longer-accepts-varied-constructor-arguments-columns-are-passed-positionally

Closes-Bug: #2061348
Change-Id: I271986146f485b2cd4ae3391d1a27f4a57f97560
2024-04-15 09:05:57 +00:00
Takashi Kajinami d0c29009e6 SQLAlchemy 2.0: Drop use of removed autoload
The autoload arugment was removed[1] in SQLAlchemy and only
the autoload_with argument should be passed.

The autoload argument is set according to the autoload_with argument
automatically even in SQLAlchemy 1.x[2] so is not at all needed.

[1] c932123bac
[2] ad8f921e96

Closes-Bug: #2061303
Change-Id: Ic18044b8065d2350c180ad26f5307a77aa99037b
2024-04-15 18:05:33 +09:00
Sergey Kraynev 85cfb6c2ae Fix negative or 0 limit parameter in pagination
Octavia replace "limit" with None when it is less 1. (for example 0, -1)
However the further code failed to compare None and int values.
This patch fixes it by validation, that limit is None.

Co-Authored-By: Roman Goncharov <gadzhet007@gmail.com>

Closes-Bug: #2060917
Change-Id: I9bb45a1aca6b7b18644752a3dccc3ebfb7c106ef
2024-04-12 19:23:28 +00:00
Zuul f91ff6c5a6 Merge "pyupgrade changes for Python3.8+ (2)" 2024-04-12 18:03:28 +00:00
Zuul 29880ec667 Merge "pyupgrade changes for Python3.8+ (1)" 2024-04-12 18:03:26 +00:00
Sergey Kraynev 824b51a1da
Handle empty delay on update healthmonitor
Check that delay field is not UnsetType before further validation

Closes-Bug: #2059894
Change-Id: Ia853d43dc273019c76da09104f31aa7e1b154fec
2024-04-10 17:22:50 +04:00
Tom Weininger 6bbdd48815 pyupgrade changes for Python3.8+ (7)
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place octavia

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986

Change-Id: I9399730fed16b85686caa586788a1bc03ebd123a
2024-04-10 10:35:37 +02:00
Tom Weininger ba3bbfa866 pyupgrade changes for Python3.8+ (6)
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place octavia

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986

Change-Id: I3924de7cd8e2d242006ec4f272ece0276053e2ed
2024-04-10 10:23:50 +02:00
Tom Weininger a0360f9719 pyupgrade changes for Python3.8+ (5)
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place octavia

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986

Change-Id: I9aeb3d603a519c3029b5be1ab622a0250f628f7d
2024-04-10 10:23:50 +02:00
Tom Weininger 0009c7cda8 pyupgrade changes for Python3.8+ (4)
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place octavia

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986

Change-Id: I7d69a002c4e4c79fc2f5a13e9056aa2461d0ab7a
2024-04-10 10:23:50 +02:00
Tom Weininger 3d3360953b pyupgrade changes for Python3.8+ (3)
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place octavia

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986

Change-Id: Ib160f988cea0c6a27b3c1efeb2b2953f8929dc5c
2024-04-10 10:23:50 +02:00
Tom Weininger 9b1b8a3b6f pyupgrade changes for Python3.8+ (2)
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place octavia

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986

Change-Id: I4ad020fbedd8106a3a86768c25a0c4dc750ec88a
2024-04-10 10:23:50 +02:00
Tom Weininger 69552a2082 pyupgrade changes for Python3.8+ (1)
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place octavia

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986

Change-Id: I8560b5440c0c2338e468b12d8c4abcc47a8fb50a
2024-04-10 10:23:44 +02:00
Zuul fa7cc01787 Merge "Fix fully-populated API with allowed_cidrs" 2024-03-20 20:29:29 +00:00
Gregory Thiemonge 5d9b23c602 Fix fully-populated API with allowed_cidrs
When creating a LB + a listener with an allowed_cidr with the
fully-populated API, an issue happened when Octavia validated that the
allowed_cidrs and the VIP ip address have the same IP version. The
vip.ip_address value was not updated in the load balancer object,
forcing the expiration of the DB object before entering _graph_create
fixes this issue.

Note: there's no change in the tests, the test function for this feature
exists, looks correct, and passes successfully, the bug is only
reproducible in octavia-api.

Closes-Bug: 2057751
Change-Id: Ia106d81c1b2588e5d938d2238c8a2f6660bf5ef1
2024-03-13 04:36:49 -04:00
Michael Johnson 411e7c6dbc Check Amphora status on SR-IOV failover flows
As noted on an earlier patch[1], the "SetAmphoraFirewallRules" task was not
checking the Amphora status nor using an API timeout. This could cause failover
flows to take longer than necessary if one of the Amphora is missing.

This patch corrects that issue by honoring both the Amphora status and timeout.

[1] https://review.opendev.org/c/openstack/octavia/+/910101/13/octavia/controller/worker/v2/flows/amphora_flows.py

Change-Id: Ic5e8140b13164267236f0a5d9a48fbd84bcdd688
2024-03-12 17:12:25 +00:00
Zuul 2abab95fa0 Merge "Fix neutron setting overrides" 2024-03-11 16:47:28 +00:00
Zuul ef28b2e629 Merge "Drop direct execution of octavia/cmd/*.py" 2024-03-08 19:37:35 +00:00
Zuul 2b8af0dc62 Merge "When we failed to load pkcs12 cert print warning" 2024-03-08 14:11:17 +00:00
Zuul 91ee3d7c86 Merge "redis: Support multiple sentinel servers" 2024-03-08 14:11:14 +00:00
Zuul a26c452f6f Merge "fix: specify endpoint info. for neutron client" 2024-03-08 09:14:52 +00:00
Zuul c85bdad24d Merge "redis: Add username" 2024-03-08 08:13:44 +00:00
Michael Johnson c88922315e Fix duplicate tasks in SRIOV LB Create flow
There was a mistake in the load balancer create flow where duplicate
tasks were added to the flow when an SRIOV VIP was used. This patch corrects
that by removing the duplicate tasks.

Change-Id: Id3dce30639cce6724d41fd2ccd53612384eba87f
2024-02-29 18:54:49 +00:00
Takashi Kajinami bd3ef61a0c redis: Support multiple sentinel servers
Redis Sentinel client implementation support using multiple sentinel
servers for redundancy, but only a single server from the servers list
was passed down to it.

This uses the new taskflow interface to add fallback servers, and
register the remaining servers in the list as fallbacks.

Depends-on: https://review.opendev.org/c/openstack/taskflow/+/907674
Change-Id: I6b281d2520db0048329b12b33108273ba2f96534
2024-02-29 16:57:57 +00:00
Takashi Kajinami 16f6b2e8f6 redis: Add username
Redis introduced ACL feature in 4.0.0, and this feature is supported by
redis-py since 3.4.0[1]. When ACL is enabled, authentication requires
username in addition to password.

Also this removes the default password string because it can confuse
underlying libraries in case a more strict check such as 'is None' is
implemented there.

[1] 8df8cd54d1

Depends-on: https://review.opendev.org/c/openstack/taskflow/+/907667
Change-Id: Ie85589ab4e02046f54864a10b9b8adce6996d82a
2024-03-01 01:57:35 +09:00
Zuul 115b18effd Merge "Enable nftables rules for SR-IOV VIPs" 2024-02-29 09:45:29 +00:00
Zuul 346e65cfee Merge "Add nftables support for SR-IOV VIPs" 2024-02-29 09:28:17 +00:00
Zuul 9973874afb Merge "Add support for SR-IOV ports in Octavia" 2024-02-29 09:01:03 +00:00
Michael Johnson fc37d8303d Enable nftables rules for SR-IOV VIPs
This patch enables setting the nftables rules in Amphora using SR-IOV VIPs.

Change-Id: I554aac422371abafb4bb04e2d0df3fce3fa169d4
2024-02-28 17:07:05 +00:00
Michael Johnson d83999f4ed Add nftables support for SR-IOV VIPs
This patch adds the initial nftables support in the amphora for SR-IOV
VIPs. Followup patches will add rules to the nftables chain. As this
point in the patch chain, SR-IOV VIPs will not pass any traffic.

Change-Id: Ib2a1c3f49a26690d2e0e9c7330e047748c0b5105
2024-02-28 16:00:12 +00:00
Michael Johnson 75c1bdd104 Add support for SR-IOV ports in Octavia
Change-Id: I16622add64076370dad85620043f71077bc9acbb
2024-02-28 15:56:35 +00:00
Zuul b2f3f77d9e Merge "Honor connection_recycle_timeout in MysqlPersistenceDriver" 2024-02-28 05:27:01 +00:00
Michael Johnson ffc9d83197 Remove some unused code
These methods and tasks are no longer used in the code, so this patch proposes
to remove them.

Change-Id: Ic7813d3a9073e4b3c1bc6a7839242df34a16d348
2024-02-27 03:50:47 +00:00
Takashi Kajinami 6d352dd3a6 Fix pylint error
pylint 3.1.0 introduced the new check (use-yield-from) and this detects
a few failures in current code. This fixes these failures.

Change-Id: Ia5396895b27e4b28a7d9d8d85a85a8449c21d493
2024-02-26 16:58:39 +09:00
Vasyl Saienko 96846e7b66 When we failed to load pkcs12 cert print warning
Print actual error when we failed to load pkcs12 cert and
falling back to the default implemntation, as exception may
not be related to certificate or its format like an issue
with wrong methods during cryptography version mismatch

*** AttributeError: module 'OpenSSL.crypto' has no attribute 'load_pkcs12'

Related-Prod: PRODX-39931
Change-Id: I85c8a615c4f2e08e28939805ae0e9b2028dadaed
2024-02-19 18:52:06 +02:00
Mohammed Naser 7352dc8f1e fix: specify endpoint info. for neutron client
Closes bug: #2049551

Change-Id: I80a266e500958415a70d462ddfe57e9e03e6ef13
2024-02-15 14:28:47 +08:00
Gregory Thiemonge 7bb6096ecc Fix neutron setting overrides
Since 2023.2, we deprecated some settings in the [neutron] section
('endpoint', 'endpoint_type' and 'ca_certificates_file'), they are
respectively replaced by 'endpoint_override', 'valid_interfaces' and
'cafile'. There's some code in Octavia that automatically sets the new
settings if the user still has the old settings (it is required because
keystoneauth uses the CONF objects to establish the sessions).
But some corner cases were not correctly addressed in that patch.

Now Octavia ensures that the override of the parameters is correctly
handled.

Change-Id: Ic37e9f699e32431ae1735ddc9642689967ddc696
Closes-Bug: 2051604
2024-02-01 14:32:11 +01:00
Takashi Kajinami 1e0f59f558 Drop direct execution of octavia/cmd/*.py
We generate scripts using setuptools, and we don't expect users may
launch these processes directly from *.py files.

Change-Id: I31c812b112f587d8273893e565417e9949288d16
2024-01-28 17:18:28 +00:00
James Page b1c930d41f
tests: correct use of has_calls -> assert_has_calls
Newer Python detect 'has_calls' as an incorrect use of assert_has_calls.

Correct the one instance of this in Octavia.

Change-Id: I5c943266332908e00c19b409e3af571680d55c26
2024-01-23 14:32:12 +00:00
Zuul 5750e4512d Merge "Provide Amphora stats for Octavia no-op drivers" 2024-01-10 19:16:14 +00:00
Zuul 490a65fceb Merge "Fix issue with certificates with no subject or CN" 2024-01-06 15:54:20 +00:00
Zuul 240b0066a1 Merge "Use cryptography to load PKCS12 certificates" 2023-12-19 15:03:19 +00:00
Takashi Kajinami 2a327582f7 Unpin flake8-import-order
... to resolve the following ValueError.

```
ValueError: 'string' is not callable
```

The I202 test is disabled because multiple files need updates. It may
be enabled later once all the warnings are addressed.

Fixed E721 test errors which appears 4 times.

E721 do not compare types, for exact checks use `is` / `is not`, for
instance checks use `isinstance()`

Change-Id: I68880b83c8a555ed30c3ce18b73ae27b8db34dc8
2023-12-14 21:47:34 +09:00