4764 Commits

Author SHA1 Message Date
Zuul
0058c31e1f Merge "s3api: Allow clients to upload with UNSIGNED-PAYLOAD" 2019-06-06 01:16:49 +00:00
Zuul
17d7a95547 Merge "py3: symlink follow-up" 2019-06-05 23:22:20 +00:00
Tim Burke
d9cafca246 py3: port ssync
Change-Id: I63a502be13f5dcda2a457d38f2fc5f1ca469d562
2019-06-05 13:26:18 -07:00
Tim Burke
2eb2451685 Increase some middleware test coverage
This patch increases the test coverage of the following middlewares:
 - list_endpoints
 - crypto
 - crossdomain

Change-Id: I3dec85f61da07bd110bf42220d5ba46e11833a90
2019-06-05 06:19:04 +00:00
Zuul
4ffc5db5f2 Merge "Note s3api compatability requirements in sample.conf" 2019-06-05 04:11:55 +00:00
Zuul
4ae5ae100d Merge "Have a separate s3api functional test suite" 2019-06-04 18:02:49 +00:00
Clay Gerrard
79ab3a490a Note s3api compatability requirements in sample.conf
Change-Id: I12f6e4a5a880a2d5e0f4fff4618e4196be311267
2019-06-04 11:45:35 -05:00
Kuan-Lin Chen
37fa12cd83 Do not sync suffixes when remote rejects reconstructor sync
The commit a0fcca1e makes reconstructor not sync suffixes when remote
reject reconstructor revert. However, the exact same logic should
be applied to SYNC job as well. REPLICATE requests aren't generally
needed when using SSYC (which the reconstructor always does).

If a ssync_sender fails to finish a sync the reconstructor should skip
the REPLICATE call entirely and move on to the next partition without
causing any useless remote IO.

Change-Id: Ida50539e645ea7e2950ba668c7f031a8d10da787
Closes-Bug: #1665141
2019-06-03 18:39:51 +08:00
Christian Schwede
c9e78d15e1 Remove invalid dict entries from hashes.pkl
If the data in a hashes.pkl is corrupted but still de-serialized without
errors, it will mess up the replication and gets never fixed. This
happens for example if one of the keys is a NULL byte.

This patch checks if the dict keys in hashes.pkl are valid strings and
invalidates it if not.

Closes-Bug: 1830881
Change-Id: I84b062d062ff49935feed0aee3e1963bb72eb5ea
2019-05-31 11:07:42 +02:00
Tim Burke
2e35376c6d py3: symlink follow-up
- Have the unit tests use WSGI strings, like a real system.
- Port the func tests.

Change-Id: I3a6f409208de45ebf9f55f7f59e4fe6ac6fbe163
2019-05-30 16:25:17 -07:00
Matthew Oliver
4f9595f113 py3: port symlink middleware
This patch ports the symlink middleware to py3.
The middleware itself seems to be mostly fine and most changes
are in the symlink unit tests.

Change-Id: I973c2e1bb8969cf6bffece8ce68881c393efbaef
2019-05-30 11:44:42 -07:00
Zuul
854a72facf Merge "S3Api: handle non-ASCII markers in v1 listings." 2019-05-29 23:32:20 +00:00
Zuul
769c0fb7fb Merge "Rework private-request-method interface" 2019-05-24 20:06:00 +00:00
Zuul
657b022689 Merge "py3: port diskfile" 2019-05-24 02:38:09 +00:00
Zuul
5a42544bed Merge "Clean up test_write_read_metadata" 2019-05-24 02:38:05 +00:00
Zuul
36648cd2e2 Merge "Add more tests for async expirer" 2019-05-23 09:25:50 +00:00
Zuul
a4159b7501 Merge "Add operator tool to async-delete some or all objects in a container" 2019-05-23 09:25:48 +00:00
Tim Burke
ff04ef05cd Rework private-request-method interface
Instead of taking a X-Backend-Allow-Method that *must match* the
REQUEST_METHOD, take a truish X-Backend-Allow-Private-Methods and
expand the set of allowed methods. This allows us to also expose
the full list of available private methods when returning a 405.

Drive-By: make async-delete tests a little more robust:
  * check that end_marker and prefix are preserved on subsequent
    listings
  * check that objects with a leading slash are correctly handled

Change-Id: I5542623f16e0b5a0d728a6706343809e50743f73
2019-05-22 16:36:50 -07:00
Clay Gerrard
04c8015b88 Add more tests for async expirer
Related-Change-Id: Ia13ee5da3d1b5c536eccaadc7a6fdcd997374443
Change-Id: Ic70eb61b32b196d356c9a3b40a22807456c7b0f2
2019-05-22 16:24:05 -05:00
Tim Burke
e22960fd71 s3api: Fix ETag when copying a MU part from another MU
Previously, we'd preserve the sysmeta that we wrote down with the
original multipart-upload to track its S3-style etag on the new part,
causing it to have an ETag like `<MD5>-<N>`. Later, when the client
tried to complete the new multipart-upload, it would send that etag back
to the server, which would reject the request because the ETag didn't
look like a normal MD5.

Now, have s3api include blank values in the copy request to overwrite
the source sysmeta, and treat a blank etag override the same as a
missing one.

Change-Id: Id33a7ab9d0b8f33fede73eae540d6137708e1218
Closes-Bug: #1829959
2019-05-22 13:36:41 -07:00
Tim Burke
40bd9f16a3 py3: port diskfile
Change-Id: Ie73f9df460f9014014168d6e60767e66b24d30b0
2019-05-22 13:25:54 -07:00
Tim Burke
8868e2cd50 Clean up test_write_read_metadata
I'm pretty sure I botched the intent of the test when I touched it in
https://github.com/openstack/swift/commit/36c4297

As a side-effect, clean up a warning on py2:

    UnicodeWarning: Unicode equal comparison failed to convert
    both arguments to Unicode - interpreting them as being unequal

Change-Id: I4da8264f85e688bc5109016c197378ca6dfe06a5
2019-05-22 13:25:28 -07:00
Tim Burke
83d0161991 Add operator tool to async-delete some or all objects in a container
Adds a tool, swift-container-deleter, that takes an account/container
and optional prefix, marker, and/or end-marker; spins up an internal
client; makes listing requests against the container; and pushes the
found objects into the object-expirer queue with a special
application/async-deleted content-type.

In order to do this enqueuing efficiently, a new internal-to-the-cluster
container method is introduced: UPDATE. It takes a JSON list of object
entries and runs them through merge_items.

The object-expirer is updated to look for work items with this
content-type and skip the X-If-Deleted-At check that it would normally
do.

Note that the target-container's listing will continue to show the
objects until data is actually deleted, bypassing some of the concerns
raised in the related change about clearing out a container entirely and
then deleting it.

Change-Id: Ia13ee5da3d1b5c536eccaadc7a6fdcd997374443
Related-Change: I50e403dee75585fc1ff2bb385d6b2d2f13653cf8
2019-05-22 13:22:50 -07:00
Alexandre Lécuyer
4927b1f29c Specify pickle protocol in REPLICATE()
The default pickle protocol in python3 is version 3. This is not
readable by a python2 interpreter.

Force the use of version 2 in the object server REPLICATE() function,
for compatibility with python 2.

Change-Id: I19d23570ff3a084d288de1308e059cfd8134d6ad
2019-05-22 13:12:32 -07:00
Zuul
b4c8cf192a Merge "Fix quarantine when object path is not a directory" 2019-05-22 05:59:43 +00:00
Zuul
720979e3f1 Merge "py3: port expirer" 2019-05-22 05:59:41 +00:00
Zuul
5be0e9ff09 Merge "Start transition to boto3 in s3api tests." 2019-05-22 05:25:13 +00:00
Zuul
aac771875b Merge "Make test_read_write_acl_listings more robust" 2019-05-21 23:08:21 +00:00
Alexandre Lécuyer
6008b0a83f Fix quarantine when object path is not a directory
In the diskfile module, there are a couple of cases where we would
quarantine the suffix dir if a single object within is not a directory.

Change the code so that we quarantine only the object.

Change-Id: I35eb16f568c00d973eb089aedd0e5a5619c25a2f
2019-05-21 15:10:56 -07:00
Timur Alperovich
d4e7940457 Start transition to boto3 in s3api tests.
Adds the scaffolding required for tests to use boto3 and converts the
test_bucket.py tests to the new interface. Follow on patches will
convert the other tests to use the boto3 library.

Notable changes: we no longer try to reach for the equivalent of
`boto.make_request()` and instead rely on the boto3/botocore event
system to mutate requests as necessary (or to disable pre-flight
validators).

Partial-Bug: 1557260
Change-Id: I3d77ef4a6b878c49ebfa0c8b8647d7199d87601e
2019-05-21 22:10:20 +00:00
Tim Burke
350bc8cbee s3api: stop adding etag quotes when there are already etag quotes
Some middleware, such as that included with ProxyFS, may put
RFC-compliant ETags in container listings; we should leave those
unquoted, so we don't double-up on quotes.

Change-Id: I8b56231aef41076a224dc62cd93c1973355c4670
2019-05-20 14:10:10 -07:00
Tim Burke
82e446a8a0 s3api: Allow clients to upload with UNSIGNED-PAYLOAD
(Some versions of?) awscli/boto3 will do v4 signatures but send a
Content-MD5 for end-to-end validation. Since a X-Amz-Content-SHA256
is still required to calculate signatures, it uses UNSIGNED-PAYLOAD
similar to how signatures work for pre-signed URLs.

Look for UNSIGNED-PAYLOAD and skip SHA256 validation if set.

Change-Id: I571c16c196dae4e4f8fb41904c8850d0054b1fe9
Related-Change: I61eb12455c37376be4d739eee55a5f439216f0e9
2019-05-20 11:44:21 -07:00
Zuul
f17b9d2e24 Merge "Be explicit that a code path is just for py2" 2019-05-18 17:49:23 +00:00
Zuul
72a0115514 Merge "Get functional/tests.py running under py3" 2019-05-18 07:33:03 +00:00
Pete Zaitcev
bd8c3067b4 py3: slo
This adds wsgi_to_str(self.path_info) everywhere we forgot it,
not only in the slo module itself.

Dropping the body=''.join(body) after call_slo() is obvious:
the latter only returns strings of bytes, not lists of such.

Change-Id: I6b4d87e4cda4945bc128dbc9c1edd39e736a59d2
2019-05-17 17:57:23 -05:00
Zuul
f1a0eccab9 Merge "py3: bulk -- alternate approach" 2019-05-17 22:49:10 +00:00
Zuul
f1e2a21efe Merge "Wait longer for log lines in unit test" 2019-05-17 18:30:23 +00:00
Tim Burke
ad034023f3 Be explicit that a code path is just for py2
Change-Id: I7d0345a712f71e76034910fa7bb2bbaf42b4d2ff
2019-05-17 10:30:21 -07:00
Zuul
3b76c717aa Merge "Set Content-Type with s3api metadata updates." 2019-05-17 02:55:09 +00:00
Tim Burke
bec2cccd43 py3: port expirer
Change-Id: Ib5aeda94fe9b165f54ad7412d68d71b62e427a40
2019-05-14 17:10:54 -07:00
Timur Alperovich
8b64381371 Set Content-Type with s3api metadata updates.
S3 supports two metadata operations on object copy: COPY and REPLACE.
When using REPLACE, the Content-Type should be set to the one supplied
by the caller. When using COPY, the existing object's Content-Type value
is used.

Change-Id: Ic7c6278dedef308c9219eb45751abfa5655f144f
Closes-Bug: #1828907
2019-05-14 09:48:47 -07:00
Tim Burke
5cd2a2ac2f py3: bulk -- alternate approach
Related-Change: I3603247e0c36299de2107aa8e494a3f87647696f
Change-Id: Iaf14c1ab3e236e6774492ed711fccef066a16fca
2019-05-13 20:08:50 -05:00
Tim Burke
89c9c6f0b2 Have a separate s3api functional test suite
The idea is that we should have a suite of pure-S3 tests that we can
point at AWS to verify that we've written accurate tests, then point at
Swift-with-s3api to verify that we've correctly implemented the S3 api.

As a start, just check GET Service; go ahead and create a few buckets
so we can see them in the service listing.

Change-Id: I283757cd3084b1c83a1e9bf0f46b6ce9d7ee8eb9
2019-05-13 14:03:03 -07:00
Kota Tsuyuzaki
4aa71aa25c We don't have to keep the retrieved token anymore
Since the change in s3_token_middleware to retrieve the auth info
from keystone directly, now, we don't need to have any tokens provided
by keystone in the request header as X-Auth-Token.

Note that this makes the pipeline ordering change documented in the
related changes mandatory, even when working with a v2 Keystone server.

Change-Id: I7c251a758dfc1fedb3fb61e351de305b431afa79
Related-Change: I21e38884a2aefbb94b76c76deccd815f01db7362
Related-Change: Ic9af387b9192f285f0f486e7171eefb23968007e
2019-05-09 11:21:00 -07:00
Tim Burke
8b3d0a6c64 py3: finish porting proxy/test_server.py
Change-Id: I8287db75b4f19581203360c646e72f64fe45f170
2019-05-08 17:47:40 -07:00
Tim Burke
506279235d Get functional/tests.py running under py3
Note that you need a pretty recent eventlet to pick up
https://github.com/eventlet/eventlet/commit/f0bc79e

Change-Id: I6b006b972e7431c406039f4e0f6890a8f74a4432
2019-05-08 17:44:03 -07:00
Tim Burke
259224f009 py3: port unit/proxy/test_server.py
All except the versioned_writes tests, which are hairy.

Change-Id: Ieb54869f93a70c8887d33bd2ad46cf04a190d896
2019-05-08 15:59:06 -07:00
Timur Alperovich
dade632b0f S3Api: handle non-ASCII markers in v1 listings.
Added a test for S3 v1 listings that use URL encoding and have non-ASCII
characters. In the process discovered that the XML schema for
ListBucketResult had a small problem: Delimiter and EncodingType needed
to be reordered.

Change-Id: Ib3124ea079a73a577b86de97657603a64b16f965
2019-05-08 12:17:38 -07:00
Zuul
e85dda286e Merge "Require logger passed to broker in unit tests for account-reaper" 2019-05-07 21:55:49 +00:00
Zuul
4473fd9ba1 Merge "py3: port unit/proxy/test_sysmeta.py" 2019-05-07 19:17:31 +00:00