4043 Commits

Author SHA1 Message Date
Tim Burke
d03fc9bc54 swob: Stop auto-encoding unicode bodies
Instead, require that callers provide an encoding.

Related-Change: I31408f525ba9836f634a35581d4aee6fa2c9428f
Change-Id: I3e5ed9e4401eea76c375bb43ad4afc58b1d8006a
2018-06-28 09:58:44 -07:00
Zuul
729fe6f79d Merge "swob: Fix up some WSGI string business" 2018-06-28 12:23:58 +00:00
Zuul
eb43d30320 Merge "Enforce Content-Length in catch_errors" 2018-06-28 12:23:45 +00:00
Tim Burke
efcf7e6a95 swob: Fix up some WSGI string business
Change-Id: Iee1bab5775b243c318aa22ee4a548d793e6684ca
2018-06-27 15:55:30 -07:00
Samuel Merritt
306f9a150f py3: port domain_remap tests
The domain_remap middleware didn't need to change, only its tests.

Change-Id: I5edf05b609ce263708f851219c38c1bd1b645a6f
2018-06-26 13:20:49 -07:00
Samuel Merritt
081ff36e6e py3: port crossdomain
Change-Id: I83a35f066d69edf39c74fd22c7fb248b5320d21f
2018-06-26 13:20:49 -07:00
Samuel Merritt
50ea4e1e08 py3: port healthcheck
Typed "b" in a half-dozen places and fixed a typo in a test name.

Change-Id: Idcb8b2eeef5b545eb0944cc22b7c7961e8c2f8f0
2018-06-26 13:20:49 -07:00
Alistair Coles
1fa4b9e3fe Remove unnecessary loop in test_keymaster.py
The ignored_secret variable wasn't being used.

Change-Id: Ia659f3672941f9bb86054ce6cafbbe6fe7ccafbc
Related-Change: I1cd9a97c4e8d87d7c065866e7ad3a9e748ff19ab
2018-06-25 12:13:59 +01:00
Zuul
3de21d945b Merge "Remove empty part dirs during ssync replication" 2018-06-23 02:19:18 +00:00
Zuul
fc9b9e55c5 Merge "container-updater: Always report zero objects/bytes used for shards" 2018-06-22 21:45:56 +00:00
Zuul
84ddb8c1ec Merge "py3: port catch_errors" 2018-06-22 21:41:21 +00:00
Zuul
9c0de5d74f Merge "py3: fix test_proxy_logging.py" 2018-06-22 21:41:19 +00:00
Zuul
2a7190ba13 Merge "py3: Port common/swob" 2018-06-22 11:54:36 +00:00
Zuul
1c42cb529c Merge "py3: Port common/constraints" 2018-06-22 11:48:41 +00:00
Zuul
d280c4c356 Merge "py36: Fix test_get_logger_sysloghandler_plumbing" 2018-06-22 11:48:38 +00:00
Tim Burke
5652dec43b container-updater: Always report zero objects/bytes used for shards
Otherwise, a sharded container AUTH_test/sharded will have its stats
included in the totals for both AUTH_test *and* .shards_AUTH_test

Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Change-Id: I7fa74e13347601c5f44fd7e6cf65656cc3ebc2c5
2018-06-22 10:35:36 +01:00
Samuel Merritt
3920b88daa py3: port catch_errors
Today's diff is brought to you by the letter "b".

Change-Id: I074c1ff3f1232a899c101f2856dff4a881a6fe77
2018-06-21 17:23:41 -07:00
Samuel Merritt
e0b4eb225c py3: fix test_proxy_logging.py
Only the tests needed to change, and it was nearly all just prepending
"b" to a bunch of string literals.

Change-Id: Id5317e471c04a05627438c281bb0d6a97cf6a8a4
2018-06-21 17:18:42 -07:00
Tim Burke
1318bacc17 py36: Fix test_get_logger_sysloghandler_plumbing
Change-Id: Ibdb9e2bbec1c962d930a3f69fc95a8c562ac13b7
2018-06-21 15:43:26 -07:00
Tim Burke
f192f51d37 Have check_drive raise ValueError on errors
...which helps us differentiate between a drive that's not mounted vs.
not a dir better in log messages. We were already doing that a bit in
diskfile.py, and it seems like a useful distinction; let's do it more.

While we're at it, remove some log translations.

Related-Change: I941ffbc568ebfa5964d49964dc20c382a5e2ec2a
Related-Change: I3362a6ebff423016bb367b4b6b322bb41ae08764
Change-Id: Ife0d34f9482adb4524d1ab1fe6c335c6b287c2fd
Partial-Bug: 1674543
2018-06-20 17:15:07 -07:00
Tim Burke
2b19c26498 py3: Port common/swob
Change-Id: I31408f525ba9836f634a35581d4aee6fa2c9428f
2018-06-20 16:52:02 -07:00
Tim Burke
0694e51eb7 py3: Port common/constraints
Alternate approach to https://review.openstack.org/#/c/559902

Change-Id: I1e244c231753b8f4b6f1cf95cb0ae4c3c959ae0f
2018-06-20 16:51:25 -07:00
Zuul
c568b4b100 Merge "Resolve TODO's in test/probe/test_sharder.py" 2018-06-20 23:48:23 +00:00
Alistair Coles
a59c5e3bae Resolve TODO's in test/probe/test_sharder.py
Resolve outstanding TODO's. One TODO is removed because there isn't an
easy way to arrange for an async pending to be targeted at a shard
container.

Change-Id: I0b003904f73461ddb995b2e6a01e92f14283278d
2018-06-20 19:42:32 +00:00
Zuul
c3ea2f0909 Merge "Use valid eventlet logger method" 2018-06-20 18:48:18 +00:00
Zuul
c34330e420 Merge "Fix test_wsgi.py tests failing with eventlet <=0.18.4" 2018-06-20 18:23:07 +00:00
Alistair Coles
a1cb919930 Use valid eventlet logger method
eventlet<=0.17.4 LoggerFileWrapper does not have an error() method
so don't try to call it. Instead, use info() which even in newer
eventlet versions does exactly the same as error().

This bug only manifests in unit tests once the Related-Bug has been fixed
(see Related-Change).

Closes-Bug: #1777836
Related-Bug: #1777701
Related-Change: I68fd9d0263a6720aaf0d90b8ea6da1158105ac01

Change-Id: I46190567549826c811ffa51e9a71a38a20d9ce97
2018-06-20 10:20:58 +01:00
Alistair Coles
642d8748c0 Fix test_wsgi.py tests failing with eventlet <=0.18.4
Older versions of eventlet expect getsocketname() to return a tuple,
and newer versions are happy to receive a tuple, so fix the mock to
return a tuple.

Change-Id: I68fd9d0263a6720aaf0d90b8ea6da1158105ac01
Closes-Bug: #1777701
2018-06-20 09:59:55 +01:00
Zuul
1cd6416471 Merge "Fix common/test_utils.py on Python 3.5.4+" 2018-06-20 03:15:49 +00:00
Zuul
298f8b4df1 Merge "Tighten up staticweb redirect test" 2018-06-19 23:50:24 +00:00
Samuel Merritt
4a0afa9fea Enforce Content-Length in catch_errors
If a WSGI application produces the header "Content-Length: <N>" but
does not produce exactly N bytes of response, then that is an error
and an exception should be thrown so that the WSGI server can take the
correct action (close the TCP connection for HTTP <= 1.1, something
else for HTTP 2.0).

As part of this, I also fixed a bug in DLOs where a HEAD response
might have a body. The way it works is this:

 * user makes HEAD request for DLO manifest

 * DLO middleware makes GET request for container

 * authorize callback (e.g. from tempurl) replies 401 for container
   GET; response has a nonempty body (it's a GET response; that's
   fine)

 * DLO notes that response is non-2xx, returns it as-is

 * client gets response with nonempty body to a HEAD request

The fix there was simple; if the original request method was HEAD,
clear out the response body.

Change-Id: I74d8c13eba2a4917b5a116875b51a781b33a7abf
Related-Bug: 1568650
2018-06-18 14:50:59 -07:00
Zuul
4aca486fc4 Merge "func tests: Rename storage_url to storage_path" 2018-06-16 02:36:16 +00:00
Samuel Merritt
b08355ea3f Rename test_except.py -> test_catch_errors.py
Every other middleware has files swift/common/middleware/<mw>.py and
test/unit/common/middleware/test_<mw>.py, while catch_errors has
test_except.py, which makes its tests harder to find. Let's follow the
same naming pattern.

Change-Id: I534ff57ac2fe8e12a3f84d821da04d679f1ced3a
2018-06-15 15:17:04 -07:00
Zuul
cdb1736e01 Merge "Only try to fetch or sync shard ranges if the remote supports sharding" 2018-06-15 21:30:51 +00:00
Tim Burke
8e892713ee Tighten up staticweb redirect test
Change-Id: Ifc3f2f58f51c71f4e652567b4f9c82deb98bbb5b
2018-06-15 10:32:05 -07:00
Tim Burke
b39a88ca65 func tests: Rename storage_url to storage_path
... so we can use storage_url for actual, complete URLs.
Also, expose storage_scheme for easier comparisons.

Change-Id: Iffcfc327bc674681ac51fe75c1d9911fa3a60d54
2018-06-15 10:32:05 -07:00
Zuul
a3cc7ccc69 Merge "Experimental swift-ring-composer CLI to build composite rings" 2018-06-15 04:27:43 +00:00
Tim Burke
f6a436aeda Only try to fetch or sync shard ranges if the remote supports sharding
Change-Id: I7231e8af310e268484f2075f0194b7783cf1c3ea
2018-06-14 16:58:29 -07:00
Zuul
ea33638d0c Merge "object-updater: add concurrent updates" 2018-06-14 20:37:06 +00:00
Alistair Coles
6b626f2f98 Experimental swift-ring-composer CLI to build composite rings
Provides a simple, experimental, CLI tool to generate a
composite ring from a list of component builder files.

For example:

  swift-ring-composer <composite-file> compose \
      <builder-file> <builder-file> --output <ring-file>

Commands available:

- compose: compose a list of builder file to a composite ring
- show: show the metadata for a composite ring

Co-Authored-By: Kota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>
Co-Authored-By: Matthew Oliver <matt@oliver.net.au>
Change-Id: I25a79e71c13af352e19e4358f60545265b51584f
2018-06-14 09:50:55 +01:00
Zuul
7625c287ea Merge "Fix shard_max_row in ContainerBroker.get_replication_info()" 2018-06-14 08:04:20 +00:00
Zuul
de3c5054fa Merge "Create policy_stat table in auditor if missing" 2018-06-14 07:58:26 +00:00
Samuel Merritt
d5c532a94e object-updater: add concurrent updates
The object updater now supports two configuration settings:
"concurrency" and "updater_workers". The latter controls how many
worker processes are spawned, while the former controls how many
concurrent container updates are performed by each worker
process. This should speed the processing of async_pendings.

There is a change to the semantics of the configuration
options. Previously, "concurrency" controlled the number of worker
processes spawned, and "updater_workers" did not exist. I switched the
meanings for consistency with other configuration options. In the
object reconstructor, object replicator, object server, object
expirer, container replicator, container server, account replicator,
account server, and account reaper, "concurrency" refers to the number
of concurrent tasks performed within one process (for reference, the
container updater and object auditor use "concurrency" to mean number
of processes).

On upgrade, a node configured with concurrency=N will still handle
async updates N-at-a-time, but will do so using only one process
instead of N.

UpgradeImpact:

If you have a config file like this:

    [object-updater]
    concurrency = <N>

and you want to take advantage of faster updates, then do this:

    [object-updater]
    concurrency = 8  # the default; you can omit this line
    updater_workers = <N>

If you want updates to be processed exactly as before, do this:

    [object-updater]
    concurrency = 1
    updater_workers = <N>

Change-Id: I17e18088e61f664e1b9942d66423666d0cae1689
2018-06-13 17:39:34 -07:00
Romain LE DISEZ
a04234dc2a Functional tests for domain_remap middleware
Change-Id: I63428132283986bda9e5c082ffe85741449b71ba
2018-06-13 15:56:59 +01:00
Alistair Coles
65e1de29d6 Fix shard_max_row in ContainerBroker.get_replication_info()
ContainerBroker adds the shard_max_row item to the
get_replication_info result by querying the db for the shard ranges
table max rowid. However, the wrong table name was being used in the
db query such that the value was always -1. This bug was benign
because the value of shard_max_row is not currently used.

Noticed while reviewing [1] which does make use of the shard_max_row
*key* in replication info.

[1] Related-Change: I7231e8af310e268484f2075f0194b7783cf1c3ea

Change-Id: I9e733e301894f1ffff4a1092926cc0df8419c5b5
2018-06-13 12:20:17 +01:00
Zuul
15438e86ae Merge "Read-only middleware fixups" 2018-06-13 04:58:12 +00:00
Zuul
671355134f Merge "func tests: Drop clone_conn arg to Connection" 2018-06-13 04:28:15 +00:00
Tim Burke
dc8d1c964a Get rid of tpool_reraise
As best I can tell, eventlet already does (and always has done) the
right thing, and we were just bad at catching Timeouts.

For some history:

    https://github.com/openstack/swift/commit/5db3cb3
    https://github.com/openstack/swift/commit/2b3aab8
    https://github.com/openstack/swift/commit/da0e013

Change-Id: Iad8109c4a03f006a89e55373cf3ca867d724b3e1
Related-Bug: 1647804
2018-06-12 15:23:17 -07:00
Tim Burke
b3ce3c9b49 func tests: Drop clone_conn arg to Connection
We never use it, may as well get rid of it.

Change-Id: I0d860e6fdc20afb6baf28d0269dcbda21cee0ac7
2018-06-12 14:38:55 -07:00
Zuul
eb9a21b22b Merge "Allow domain remap storage_domain to be configured for func tests" 2018-06-12 21:12:54 +00:00