7bf279779995be5081e3ff9da7e113f20efe4446
Commit Graph

10648 Commits

This Branch
This Branch
All Branches
Author SHA1 Message Date
Tim Burke
7bf2797799 s3api: Clean up some errors
- SHA256 mismatches should trip XAmzContentSHA256Mismatch errors,
 not BadDigest. This should include ClientComputedContentSHA256 and
 S3ComputedContentSHA256 elements.
- BadDigest responses should include ExpectedDigest elements.
- Fix a typo in InvalidDigest error message.
- Requests with a v4 authorization header require a sha256 header,
 rejecting with InvalidRequest on failure (and pretty darn early!).
- Requests with a v4 authorization header perform a
 looks-like-a-valid-sha256 check, rejecting with InvalidArgument
 on failure.
- Invalid SHA256 should take precedence over invalid MD5.
- v2-signed requests can still raise XAmzContentSHA256Mismatch errors
 (though they *don't* do the looks-like-a-valid-sha256 check).
- If provided, SHA256 should be used in calculating canonical request
 for v4 pre-signed URLs.
Change-Id: I06c2a16126886bab8807d704294b9809844be086
2024年09月03日 17:26:41 -07:00
Zuul
ec8166be33 Merge "tests: Attempt to use configured tmp in xprofile tests" 2024年08月28日 23:43:28 +00:00
Matthew Oliver
becb3ffc1a tests: Attempt to use configured tmp in xprofile tests
My home server has more strict controls on /tmp as it run selinux etc.
When running unittests and the default log_filename_prefix deep under
/tmp gets permission denied. It would be better to override this setting
in the tests with a good known tmp location
Change-Id: I6c95ca3a0045a8f268802c6abb633bdfb0e56b73
2024年08月28日 12:26:49 -07:00
Zuul
6a0153f545 Merge "docs: Simplify reload-process-tree SVGs" 2024年08月27日 23:00:04 +00:00
Tim Burke
2e11ac32da docs: Simplify reload-process-tree SVGs
Those were so unwieldy as to be uneditable before.
Change-Id: Ic9f4a0ea6b8e18e1624c516890ab69884a299773
2024年08月27日 14:23:39 -07:00
Zuul
769baae36e Merge "account info: Add --sync/-s option" 2024年08月27日 19:29:43 +00:00
Zuul
7cbbee49c9 Merge "sharder: rename state to db_state when it's the DB state" 2024年08月26日 21:30:25 +00:00
Alistair Coles
92eebe24c6 Improve test coverage for proxy object DELETE and POST
Add unit tests for the proxy object controller to cover object DELETE
and POST scenarios.
Change-Id: I625a4cf03ee9d4a270d60fa2dc9795b36bb36bf1
2024年08月23日 16:14:34 +01:00
Alistair Coles
87bf4bf5da sharder: rename state to db_state when it's the DB state
Sharding involves both container DB state transitions and ShardRange
state transitions. To avoid confusion, always use db_state as the var
name when referring to the container DB state value.
Change-Id: Iaaf494fd4e02017005cb3811b673f967bd6b5e1d
2024年08月23日 10:53:07 +01:00
Alistair Coles
d830703a32 Setup proxy object GET and HEAD tests correctly
Some unit tests for the proxy object GET and HEAD path were setup with
insufficient mock responses. The mock connection would raise
StopIteration exceptions once the mock responses were exhausted, which
the object controller would handle as if they were error responses,
potentially distorting the test scenario.
This patch makes the set_http_connect context manager check for
unexpected requests and raise an AssertionError if any are found.
Change-Id: I47774396d9d0a78ebceea6c628c9412b3ad67a11
2024年08月22日 12:11:47 +01:00
Matthew Oliver
e6b73612d1 FakeStatsdClient: Stop issuing DNS calls for host.
Running unittests on my home server, even though is a beast, would be
painfully slow. Running them on my laptop ran much faster. I tried
everything and couldn't figure it out.
Chris, co-author, dug in and after we ran out of options he fired up his
packet capture and realised most tests were issuing DNS queries for
`host.`. On my home server, it runs ipv6 dual stack, so these calls
would need to timeout before a test can continue.
On finding this `host.` Ben, another co-author, dug into the code and
found the only reference we have to `host` is in FakeStatsdClient.
Sure enough as I dug a little further it turns out our FakeStatsdClient
used to override a StatsdClient function `_determine_sock_family(self,
host, port)` to stop actually creating a real socket.
However, at some point the StatsdClient was refactored and that method
was renamed and changed. Which leads to a DNS lookup every time we
create a debug_logger as it brings up the socket.
As you can imagine, this happens alot!
This patch overrides the new function that handles to socket creation
`_set_sock_family_and_target(self, host, port)`. Which eliminates the
DNS call all together.
Co-Authored-By: Ben Formosa <bformosa@nvidia.com>
Co-Authored-By: Chris Smart <csmart@nvidia.com>
Change-Id: Ie393075f79447627714692e3f01bb53e967a71e8
2024年08月13日 17:04:40 +10:00
Zuul
1d5e65ce6a Merge "Move utils/logs.py related tests out of test_utils" 2024年08月12日 19:10:36 +00:00
Shreeya Deshpande
f5a8851dae Move utils/logs.py related tests out of test_utils
Change-Id: Ie73988edf6be0e38d9004bee04ff46c906a759ff
2024年08月08日 15:35:00 -04:00
Alistair Coles
6a5a681227 tests: don't mutate and re-use Response headers
Some tests in test_account_quotas.py registered a response with
FakeSwift during setUp and then subsequently mutated the response's
headers dict. Worse, some tests then mutate the headers again and
re-use the same response.
This relies on the FakeSwift implementation not copying the original
headers when the response is registered, which may not remain the case
(as the author discovered with the Related-Change). It's also an
unnecessary shortcut.
Change-Id: I3217c17936d0c11b03de4a4a172bb2fb0a2be734
Related-Change: I84604a7ea049850ad4d0f0cea2096ab8a98dfb4a
2024年08月07日 18:44:06 +01:00
Alistair Coles
9d14c7c830 expirer stats: add test coverage for 'errors' stat
Drive-by: simplify patching of test expirer instance.
Drive-by: fix comment spelling.
Related-Change: Ib151c498ba325f39570e963e5b7948080ffcd3d6
Change-Id: Ia0041c4eedc33a2675890d52cbbc33b9190f1665
2024年08月02日 11:50:12 +01:00
Jianjian Huo
b400a1fdb3 Expirer: add delete task iteration related metrics
Four new metrics have been added into task iteration process:
 'tasks.parse_errors': count of errors when parsing the task object
 'tasks.skipped': count of task objects skipped because it doesn't
 belong to this expirer.
 'tasks.delayed': count of objects is still within the delay
 'tasks.assigned': count of assigned objects to this expirer
Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: Ib151c498ba325f39570e963e5b7948080ffcd3d6
2024年08月02日 10:34:13 +00:00
Zuul
682c71afe4 Merge "Implement context manager protocol for logging mutexes" 2024年07月25日 20:45:47 +00:00
Zuul
c581f85b7f Merge "Pass timeout as kwarg" 2024年07月25日 12:00:30 +00:00
Zuul
dd75cc72dc Merge "Move remaining bin scripts to cli modules" 2024年07月25日 03:53:32 +00:00
Zuul
44c70caba3 Merge "Pull swift-*-info scripts into swift.cli.info" 2024年07月25日 03:49:12 +00:00
Tim Burke
fd7861313f Pass timeout as kwarg
Cleans up a deprecation warning:
 DeprecationWarning: Passing more than 1 positional argument to
 _sqlite3.Connection() is deprecated. Parameters 'timeout',
 'detect_types', 'isolation_level', 'check_same_thread', 'factory',
 'cached_statements' and 'uri' will become keyword-only parameters
 in Python 3.15.
Change-Id: I2b11487f8174e36b024c503d7e78de1904e0a281
2024年07月24日 09:45:12 -07:00
Tim Burke
7c7ab03e2d Implement context manager protocol for logging mutexes
Newer versions of python expect to be able to say `with self.lock:`
down in logging.
See https://github.com/python/cpython/commit/74723e11
Change-Id: I30305566d12a1b8be4c8bde4b416b798322a1385
2024年07月24日 09:44:30 -07:00
Matthew Oliver
78278c11a6 account info: Add --sync/-s option
The container-info cli already supports the --sync/-s option to view
incoming and outgoing syncs from the db. Account works exactly the same
way. And hey be might want to interrogate who an account has been
syncing with. So it should have the same option.
This patch adds the same option to account_main parser:
 $ swift-account-info <path_to_account> -s
 Path: /a2
 Account: a2
 Deleted: False
 Account Hash: c1e207026da71a9237c5d9e206b9ec59
 Metadata:
 Created at: 2024年07月24日T06:08:28.760490 (1721801308.76049)
 Put Timestamp: 2024年07月24日T06:08:28.743650 (1721801308.74365)
 Delete Timestamp: 1970年01月01日T00:00:00.000000 (0)
 Status Timestamp: 2024年07月24日T06:08:28.743650 (1721801308.74365)
 Container Count: 10
 Object Count: 100
 Bytes Used: 880
 Chexor: 0673fe17a762662d74e8d3ad93e0785b
 UUID: 705ac602-5e85-49ef-92a4-3082d40cad4f-sdb3
 ...
 Incoming Syncs:
 Sync Point	Remote ID 	Updated At
 10 	285bbaae-90da-409a-9533-f0d113764e44-sdb4	2024年07月24日T06:10:34.000000 (1721801434)
 11 	80c45862-dcd3-4ffe-9659-91851276d244-sdb2	2024年07月24日T06:10:35.000000 (1721801435)
 Outgoing Syncs:
 Sync Point	Remote ID	Updated At
 ...
Change-Id: I1aa96e97281421c69cb75ea24ce427c20c4c615e
2024年07月24日 16:16:17 +10:00
Zuul
ac5bec8889 Merge "AUTHORS: update Zaitcev" 2024年07月23日 23:40:02 +00:00
Tim Burke
c3e1d91d1f Move remaining bin scripts to cli modules
- swift-account-audit
 - swift-config
 - swift-drive-audit
 - swift-get-nodes
 - swift-reconciler-enqueue
 - swift-oldies
 - swift-orphans
Related-Change: Ifcc8138e7b55d5b82bea0d411ec6bfcca2c77c83
Change-Id: Ie4a252ec51d23caa9e90e6c2f772847d0d71b1c8
2024年07月23日 15:03:00 -07:00
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
Pete Zaitcev
dd86cecac1 AUTHORS: update Zaitcev
Unfortunately, kotori had to be switched to a whitelist,
so it's not appropriate for a public address list anymore.
Change-Id: I86f10fcf4fd0bc5902c3dad49c6f3019fa159b64
2024年07月23日 14:25:42 -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