10622 Commits

Author SHA1 Message Date
Tim Burke
2c5dc64d25 Pull swift-*-info scripts into swift.cli.info
Related-Change: Ifcc8138e7b55d5b82bea0d411ec6bfcca2c77c83
Change-Id: I2718d8b96193d13f913824fc1091d72737d755ea
2024-07-23 14:30:32 -07:00
Zuul
da12a55bc5 Merge "Pull swift-dispersion-populate to its own module" 2024-07-23 21:23:14 +00:00
Zuul
533a601cbf Merge "swift-drive-audit: Work with ISO timestamps" 2024-07-22 18:19:46 +00:00
Zuul
ddbf619e92 Merge "Use entry_points for swift-init" 2024-07-22 18:19:42 +00:00
Zuul
e5e47117fa Merge "Use entry_points for a bunch more executables" 2024-07-22 18:19:39 +00:00
Zuul
79f5ba9f7c Merge "proxy_logging config: unit tests and doc pointers" 2024-07-22 18:19:31 +00:00
Tim Burke
78b986cb39 swift-drive-audit: Work with ISO timestamps
Recent OSes are using ISO format for their kernel logs.

Closes-Bug: #2072609
Change-Id: I92fce513d06d8b0875dabf9e9a1b2c5a3a79d9b5
2024-07-17 11:07:39 -07:00
Alistair Coles
e984de864d trivial: assert non_negative_int treats float as valid
Prior to the Related-Change, non_negative_int would raise a ValueError
if it was passed a positive float. It now casts the float to an int,
which is consistent with the docstring.

This patch adds test assertions to verify this behavior, and similar
behavior of config_positive_int_value.

Change-Id: I5d62e14c228544af634190f16321ee97a8c4211c
Related-Change: I06508279d59fa57296dd85548f271a7812aeb45f
2024-07-17 10:25:10 +01:00
Alistair Coles
d555755423 proxy_logging config: unit tests and doc pointers
Add unit tests to verify the precedence of access_log_ and log_
prefixes to options.

Add pointers from proxy_logging sections in other sample config files
to the proxy-server.conf-sample file.

Change-Id: Id18176d3790fd187e304f0e33e3f74a94dc5305c
2024-07-16 11:33:58 +01:00
Zuul
7c12870068 Merge "add object-count quota for accounts in middleware" 2024-07-16 04:52:06 +00:00
Tim Burke
2e06b771ed Pull swift-dispersion-populate to its own module
Related-Change: Ifcc8138e7b55d5b82bea0d411ec6bfcca2c77c83
Change-Id: I7f479359f94f102414f30e8aac87f377d10d34ee
2024-07-15 14:56:29 -07:00
Tim Burke
006fa6b3a7 Use entry_points for swift-init
I *think* swift.common.manager is a reasonable place for it?

Related-Change: Ifcc8138e7b55d5b82bea0d411ec6bfcca2c77c83
Change-Id: I48a345eedbf2369d481d18c0e2db37845673b647
2024-07-15 14:56:29 -07:00
Tim Burke
8f9d7db7f1 Use entry_points for a bunch more executables
See https://review.opendev.org/c/openstack/swift/+/918365 for motivation.

A handful of [files]scripts entries still remain, but they're more
involved to change over. These ones were all fairly mechanical to fix.

Related-Change: Ifcc8138e7b55d5b82bea0d411ec6bfcca2c77c83
Change-Id: Ia43d7cd3921bc6c9ff0cee3100ef5f486fd3edcb
2024-07-15 14:56:19 -07:00
Mohammed Al-Jawaheri
6105b38e65 add object-count quota for accounts in middleware
It is currently possible to configure "X-Container-Meta-Quota-Bytes"
and "X-Container-Meta-Quota-Count" on containers, as well as
"X-Account-Meta-Quota-Bytes" on accounts. However, there is no way
to configure an account quota limit for the number of files or
"quota-count". This limitation could potentially allow a user to
exhaust filesystem inodes.

This change introduces the "X-Account-Meta-Quota-Count" header,
allowing users with the ResellerAdmin role to add a quota-count
limit on accounts. The middleware will enforce this limit similarly
to the existing quota-byte limit.

Co-authored-by: Azmain Adib <adib1905@gmail.com>
Co-authored-by: Daanish Khan <daanish1337@gmail.com>
Co-authored-by: Mohamed Hassaneen <mohammedashoor89@gmail.com>
Co-authored-by: Nada El-Mestkawy <nadamaged05@gmail.com>
Co-authored-by: Tra Bui <trabui.0517@gmail.com>

Change-Id: I1d11b2974de8649a111f2462a8fef51039e35d7f
2024-07-15 19:54:08 +03:00
Matthew Oliver
e8affa7db5 Pass db_state to container-update and async_pending
When the proxy passes the container-update headers to the object server
now include the db_state, which it already had in hand. This will be
written to async_pending and allow the object-updater to know more about
a container rather then just relying on container_path attribute.

This patch also cleans up the PUT, POST and DELETE _get_update_target
paths refactoring the call into _backend_requests, only used by these
methods, so it only happens once.

Change-Id: Ie665e5c656c7fb27b45ee7427fe4b07ad466e3e2
2024-07-12 20:46:14 -05:00
Zuul
9c38d756e0 Merge "Use entry_points for server executables" 2024-07-10 02:35:47 +00:00
Jianjian Huo
0fd36e395d common: move memcached exceptions to the base file.
Change-Id: I022404cd90d9755a09c20619c3a72588d3367467
2024-07-02 08:37:12 -07:00
Zuul
789d0c44d9 Merge "Python 3.12: do not use ssl.wrap_socket" 2024-07-01 23:04:16 +00:00
Tim Burke
0c9a524bee Provide content-type for long description in dists
Previously, `twine check <swift wheel>` would report

   WARNING  `long_description_content_type` missing.
   defaulting to `text/x-rst`.

Change-Id: I5d004218515d17b8cbace46b2c1e646f734779f3
2024-06-28 10:11:54 -07:00
Zuul
b5200b0a4f Merge "Get rid of py2 docker image builds; switch "latest" to py3" 2024-06-28 16:21:24 +00:00
Cyril Roelandt
64086c3091 Python 3.12: do not use ssl.wrap_socket
The ssl.wrap_socket method has been removed in 3.12.
SSLContext.wrap_socket should now be used.

Change-Id: I6119e054289eac263ff5448d7d118209f98678d9
2024-06-28 09:14:58 -07:00
Zuul
34b9d731ab Merge "docker: Remove && chaining in install scripts" 2024-06-28 00:25:46 +00:00
Zuul
0f0f34b107 Merge "obj: Close replicator/reconstructor connections" 2024-06-27 21:46:36 +00:00
Tim Burke
a8be689fc7 Get rid of py2 docker image builds; switch "latest" to py3
Continue also tagging it "py3" so any users of that tag don't become
stuck in time.

Closes-Bug: #2037268
Closes-Bug: #2070029
Change-Id: I38d9469238d2eb6647414c1107e68ff6f3a15797
2024-06-27 14:33:15 -07:00
Tim Burke
f29067631e docker: Remove && chaining in install scripts
Something about them threw off the exit-immediately-on-non-zero-exit
behavior when building.

Related-Bug: #2070029
Change-Id: I3e40ebd78a9f8e93c905b24a12f5f54b2d27c2d9
2024-06-27 14:24:37 -07:00
Zuul
37169aa6ac Merge "proxy-server: log correct path when listing parsing fails" 2024-06-26 18:10:34 +00:00
Alistair Coles
130377bd27 proxy-server: log correct path when listing parsing fails
The proxy may use a sub-request to fetch a container listing response,
for example for updating shard ranges. If it then fails to parse the
response, it should use the sub-request path when logging a warning or
error. Before, the proxy would use the original request path which may
have been to an object.

Change-Id: Id904f4cc0f911f9e6e53d4b3ad7f98aacd2b335d
2024-06-26 11:23:18 +01:00
Zuul
91bcd307fa Merge "Support tox4" 2024-06-26 01:32:25 +00:00
Zuul
7b60c2a66f Merge "trivial: assert SendtoCalls consistently" 2024-06-25 20:37:20 +00:00
Tim Burke
6220a473f3 Support tox4
Change-Id: If15c3fee706d295de678f812839a5d0759089ccf
2024-06-25 13:36:42 -07:00
Zuul
fcbe00a5cd Merge "tests: Check proxy-logging stats on the wire" 2024-06-25 18:47:25 +00:00
Alistair Coles
a7b69628d5 trivial: assert SendtoCalls consistently
Use same assertion pattern as introduced in the Related-Change and
include the host and port in the assertion.

Change-Id: I7cccf3b8cdfe157c27fb8e0b1f432a649970a865
Related-Change: I9a016de1010dd17e91bc85877413b34d2c3287c7
2024-06-25 16:29:19 +01:00
Zuul
d1a7bc6afd Merge "s3api: include error response reason in log_info" 2024-06-25 07:21:11 +00:00
Tim Burke
a21d078009 tests: Check proxy-logging stats on the wire
With labeled metrics on the horizon, I wanted some more end-to-end
tests of stats emission.

Change-Id: I9a016de1010dd17e91bc85877413b34d2c3287c7
2024-06-24 11:04:44 -07:00
Zuul
ff08a649e0 Merge "Add get_statsd_client function" 2024-06-24 15:39:19 +00:00
Shreeya Deshpande
0c58afc7ee Add get_statsd_client function
It takes a config dict and some caller-specific options, similar to
get_logger. Use this in get_logger, so our logging module doesn't
need to know anything about statsd config options.

Co-Authored-By: yanxiao@nvidia.com
Change-Id: I5ae2cc5c257fb8d7eab885977d9d9cf602224ec7
2024-06-21 13:07:44 -07:00
Alistair Coles
5d640985f7 s3api: include error response reason in log_info
There's a variety of reasons why s3api may return a 4xx or 5xx
response. It's useful to get some more detail in the log message,
particularly when the request is a HEAD which won't get any detail in
the response body.

Change-Id: I0a499dc5c50bb534a23adcbfe7c3822d8954b0e0
2024-06-19 11:06:11 +01:00
Tim Burke
68adc5bff3 CI: up-rev a few py2 constraints
Noticed a few more projects had final py2 releases.

Change-Id: I144efd5ee670a5a6b444fbc31e9434fac31bf2ec
2024-06-18 16:28:16 -07:00
Zuul
b33f8ff2c5 Merge "CI: make sure old swift is truly gone for rolling-upgrade jobs" 2024-06-18 21:47:01 +00:00
Zuul
352255cf19 Merge "CI: update known failures for the ceph tests" 2024-06-18 17:10:53 +00:00
Zuul
839537f40e Merge "Skip boto 2.x tests if boto is not installed" 2024-06-18 17:10:44 +00:00
Tim Burke
5be20f46df CI: update known failures for the ceph tests
For some reason, when we switched from py36 on centos8 to py39 on
centos9, these two tests started failing. Looks like a disagreement
about whether the canonical path for a bucket request should have
a trailing slash or not.

Mark them as known-failures for now so we can stay aware of any
other new breakage brought on by swift code changes.

Related-Change: I4f6b9c07af7bc768654f1a5d0c66b048e0f2c9c1
Change-Id: If990752c7ef7667182dbe18e49679e48c0e3d42d
2024-06-17 21:04:04 -07:00
Tim Burke
415420cc8f Use entry_points for server executables
The old [files]scripts method of specifying executable Python scripts
triggers some legacy easy-install-like mode for editable installs,
which relies on pkg_resources. Recent versions of setuptools (67.5.0+)
have started emitting warnings when importing pkg_resources, which in
turn cause quite noticeable slowdowns in process startup. This is
particularly prominant on py312, which stopped pre-installing (an often
older version of) setuptools in new venvs.

See also:
 - https://github.com/python/cpython/issues/95299
 - https://github.com/pypa/setuptools/pull/3843
 - https://github.com/pypa/setuptools/issues/3966

Now, use [entry_points]console_scripts to specify these executables,
which does not use pkg_resources in the generated script files.

Change-Id: Ifcc8138e7b55d5b82bea0d411ec6bfcca2c77c83
2024-06-17 15:01:35 -07:00
Tim Burke
a290f445ef CI: make sure old swift is truly gone for rolling-upgrade jobs
While switching how some executable scripts were configured, I saw
some strange rolling-upgrade failures that seemed to indicate that
the new invocation method was trying to be used with old code. It
seems like it maybe has something to do with whether swift was
installed to /usr/local/lib/python3.9/site-packages/ or
/usr/local/lib64/python3.9/site-packages/ but I'm not entirely
sure.

At any rate, a proper package manager ought to uninstall the old
version then install the new one, so it seems reasonable to do that
with pip, too.

Change-Id: I12e84745e7601d162755bc9d0f1cda7b63e92197
2024-06-17 15:01:35 -07:00
Zuul
46e183df15 Merge "add bytes of expiring objects to queue entry" 2024-06-14 20:29:12 +00:00
Thomas Goirand
90da23c7d2 kms_keymaster: allow specifying barbican_endpoint
Under a multi-region deployment with a single Keystone server,
specifying the Keystone auth credentials isn't enough. Indeed,
Castellan succeeds when logging-in, but may use the wrong
Barbican endpoint (if there are 2 Barbican deployed). This is
what happened to us, when deploying our 2nd region.

They way to fix it would be to tell Castellan what region to use,
unfortunately, there's no such option in Castellan. Though we may
specify the barbican_endpoint, which is what this patch allows.

Change-Id: Ib7f4219ef5fdef65e9cfd5701e28b5288741783e
2024-06-14 12:17:07 +02:00
Anish Kachinthaya
3637b1abd9 add bytes of expiring objects to queue entry
The size in bytes from object metadata of expiring objects are stored in
expirey queue entries under the content_type field.

The x-content-type-timestamp take from object metadata is provided along
with the x-content-type update so the container replicator resolves the
latest content-type and ensures eventual consistency.

UpgradeImpact: During rolling upgrades you should expect expirer queue
entries to continue lacking swift_expirer_bytes= annotations until ALL
object servers replicas have been upgraded to new code.

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>

Change-Id: Ie4b25f1bd16def4069878983049b83de06f68e54
2024-06-13 15:47:51 -05:00
Zuul
1d5b1d746e Merge "Lazy import is not needed" 2024-06-04 20:45:11 +00:00
Tim Burke
eee7741251 CI: Move off CentOS 8
Remove swift-tox-py36-centos-8-stream job entirely.

Move the following jobs to CentOS 9:

  - swift-tox-func-s3api-ceph-s3tests-tempauth
  - swift-tox-func-s3api-tests-tempauth
  - swift-multinode-rolling-upgrade, as well as the other rolling
    upgrade jobs

Remove the swift-multinode-rolling-upgrade-victoria job, as py39
support (required for CentOS 9) was not added until wallaby.

Change-Id: I4f6b9c07af7bc768654f1a5d0c66b048e0f2c9c1
2024-06-04 10:45:58 -07:00
Clay Gerrard
a666010aae Lazy import is not needed
There was an abandoned change that made reference to a RecussionError
when running a probe test that imported boto3 that had something to do
with eventlet, ssl and a transitive dependency on requests-mock, but the
fix that actually got merged seemed to depend on another change to
tox.ini that disables request-mock when we run pytest.

Either way, we already import from boto3 at the top of probe tests and
it's in test-requirements; so we require it to be installed even if you
don't have s3api in your pipeline.

Related-Change: I789b257635c031ac0cb6e4b5980f741e0cb5244d
Related-Change: I2793e335a08ad373c49cbbe6759d4e97cc420867
Related-Change: If14e4d2c1af2efcbc99e9b6fe10973a7eb94d589

Change-Id: Id2662bfc5ef2f21f901f1c98e6389c4cb01818a2
2024-06-04 12:42:20 -05:00