857 Commits

Author SHA1 Message Date
jola-mirecka
902b66d3ae Change in swift-drive-audit handling log rotation.
Change supports kern.log rotation in order to avoid loss
of significant information.

There is a year change functionality added as kern.log
does not keep record of year.

There is also backwards function added which allows
reading logs from the back to the front, speeding up the
execution along with the unit test for it

Fixes Bug 1080682

Change-Id: I93436c405aff5625396514000cab774b66022dd0
2013-02-12 13:34:49 +00:00
Jenkins
3df9229dae Merge "Use a doubled proxy-logging instead of each middleware handling it differently (if at all)" 2013-02-12 03:47:13 +00:00
Jenkins
89d4a51359 Merge "Made internal client handle failed requests better" 2013-02-11 19:47:02 +00:00
David Goetz
a622349eda Use a doubled proxy-logging instead of each middleware handling it
differently (if at all)

Adding a swift.source to wsgi pre_auth funcs and all middleware that makes
subrequests to proxy server.

NOTE: This change will result in a change in the number of proxy logs made for
staticweb, formpost, tempurl, and any other middleware that performs sub
requests (including swauth and SOS).

Please see docs for details.

DocImpact

Change-Id: I80cf2806add1c3d34054147e2515944be340455b
2013-02-11 09:22:25 -08:00
Jenkins
9de643e453 Merge "Change the flag set to specify bulk delete and expand archives from a HTTP header to a query parameter." 2013-02-08 18:18:29 +00:00
Jenkins
f6b224e2da Merge "Fixed bug in domain_remap and cname_lookup middleware" 2013-02-07 22:58:15 +00:00
David Goetz
08c017418b Change the flag set to specify bulk delete and expand archives from a HTTP
header to a query parameter.

This is needed because query parameters show up in proxy logs and headers do
not. With this change it will be easy to determine from any log line that gets
created from the original request (of which there is currently none) that the
request was a bulk action.

Note: This is not backwards compatible with the previous method of setting a
header. Because the bulk middleware has not been included in an openstack swift
release this should be fine.

Change-Id: I0297fa2de9e491bf0b8c430c0781e2e12316ed4b
2013-02-07 11:11:32 -08:00
Jenkins
9f14161455 Merge "Fixes 'not in' operator usage" 2013-02-07 00:47:33 +00:00
Jenkins
946c7a5d41 Merge "Basic container quotas" 2013-02-06 02:25:55 +00:00
Michael Barton
24ef12027c Basic container quotas
Add a new middleware implementing some basic container quotas.

Quotas are subject to several limitations: eventual consistency, the timeliness
of the cached container_info (60 second ttl by default), and it’s unable to
reject chunked transfer uploads that exceed the quota (though once the quota
is exceeded, new chunked transfers will be refused).

However, they get most of the way to container quotas fairly inexpensively.

Quotas are set by adding meta values to the container, and are validated when
set:

  X-Container-Meta-Quota-Bytes: Maximum size of the container, in bytes.
  X-Container-Meta-Quota-Count: Maximum object count of the container.

DocImpact

Change-Id: I77cfbf6dc231a2e522bd67328e4c082424a93eee
2013-02-05 06:03:38 -08:00
Greg Lange
07d85d3ee8 Made internal client handle failed requests better
In two places, the internal client was not doing what it should with failed requests.

Change-Id: I49e566108fe920d85ca60fe76d24debe8ec7ffad
2013-02-04 19:59:38 +00:00
Jenkins
62e71a2b1f Merge "Deterministic, repeatable serialization for rings." 2013-02-02 02:23:22 +00:00
Zhongyue Luo
c3d4a63021 Fixes 'not in' operator usage
Fixes bug 1110150

Change-Id: I6c48553564b1809a7ae5de9f778d93dccbe157ae
2013-02-02 09:55:33 +08:00
Jenkins
65baec39d2 Merge "Allow rebalance to take a seed." 2013-02-01 04:04:07 +00:00
Samuel Merritt
156cdc8edf Deterministic, repeatable serialization for rings.
The (account|container|object).ring.gz files contain, among other
things, a JSON-encoded dictionary. This change simply makes the JSON
serializer sort the keys of that dictionary so that two
Python-identical rings will result in two bytewise-identical ring
files. Also, to get repeatable compression, we lock down the timestamp
in the gzip output stream to a fixed value. (There's a timestamp value
in a gzip stream header; by default, gzip.GzipFile sticks time.time()
in there.)

This only works on Python 2.7; on 2.6, the 'mtime' argument to
gzip.GzipFile() is unsupported. Don't worry, serialization still works
on 2.6. It just doesn't always produce the same bytes for the same
ring.

Change-Id: Ide446413d0aeb78536883933fd0caf440b8f54ad
2013-01-31 16:55:10 -08:00
Jenkins
c0d497c421 Merge "Cleanup based on pyflakes." 2013-01-31 23:31:46 +00:00
Monty Taylor
abe70e8323 Cleanup based on pyflakes.
pyflakes itself can't be used in any automated gating way, because there are
two sets of false errors it raises. However, as an exercise, cleaning up the
'valid' ones uncovered three actual bugs. The other changes (mostly unused
variables) are included here for fun.

Command run: pyflakes swift | grep -v "undefined name '_'"

Change-Id: I18696bf047dedad1a9fdbde3463e214fba95f7c6
2013-02-01 07:50:17 +11:00
Jenkins
0dfd705b98 Merge "Added fallocate_reserve option" 2013-01-30 23:45:36 +00:00
Christopher MacGown
e189723fec Allow rebalance to take a seed.
Passing a seed into rebalance makes the rebalance deterministic
which allows us to generate identical rings across disparate
nodes without having to copy the ring files around.

Change-Id: Ie5ae46ac030e61284bc501fdef9d77eeb5243afd
2013-01-29 17:08:20 -08:00
Jenkins
c9b24df5d6 Merge "Add wsgify and split_path utilities to swob" 2013-01-29 23:28:25 +00:00
Jenkins
5c93cb5766 Merge "Fix keystoneauth with OPTIONS headers (eg: CORS)" 2013-01-29 23:26:01 +00:00
gholt
87a42ab9ca Added fallocate_reserve option
Some systems behave badly when they completely run out of space. To
alleviate this problem, you can set the fallocate_reserve conf value
to a number of bytes to "reserve" on each disk. When the disk free
space falls at or below this amount, fallocate calls will fail, even
if the underlying OS fallocate call would succeed. For example, a
fallocate_reserve of 5368709120 (5G) would make all fallocate calls
fail, even for zero-byte files, when the disk free space falls under
5G.

The default fallocate_reserve is 0, meaning "no reserve", and so the
software behaves exactly as it always has unless you set this conf
value to something non-zero.

Also fixed ring builder's search_devs doc bugs.

Related: To get rsync to do the same, see
https://github.com/rackspace/cloudfiles-rsync
Specifically, see this patch:
https://github.com/rackspace/cloudfiles-rsync/blob/master/debian/patches/limit-fs-fullness.diff

DocImpact

Change-Id: I8db176ae0ca5b41c9bcfeb7cb8abb31c2e614527
2013-01-29 20:07:26 +00:00
Michael Barton
c45e435d1f Add wsgify and split_path utilities to swob
And refactor some of the code to use them.

Remove unused imports.

Change-Id: Ica479c10247fa85c740bb99cf7d1db7fbb1b2c80
2013-01-25 00:38:32 -08:00
David Goetz
2f663ff9a0 Bulk Requests: auto extract archive and bulk delete middleware.
Fix small problem in ratelimiting middleware.

DocImpact

Change-Id: Ide3e0b9f4887626c30cae0b97eb7e2237b1df3ed
2013-01-24 12:34:56 -08:00
Chmouel Boudjnah
0dc32d31c5 Fix keystoneauth with OPTIONS headers (eg: CORS)
- Fixes bug 1101143.

Change-Id: I2a82269e4aed2c8926e0aa736c38120784e25de2
2013-01-24 12:36:35 +01:00
Jenkins
64270fab71 Merge "Allow for multiple X-(Account|Container)-* headers." 2013-01-24 00:54:21 +00:00
Jenkins
77a562dbf1 Merge "Add handler for CORS "actual requests"" 2013-01-23 22:18:11 +00:00
Adrian Smith
89ee10bd92 Add handler for CORS "actual requests"
Fix for bug 1095130

* Added a wrapper function around public methods to handle
  CORS actual requests. These requests need to return some
  extra headers to be valid responses to a CORS request.
  Access-Control-Expose-Headers and Access-Control-Allow-Origin.

* Added support for the CORS header Access-Control-Expose-Headers.

* Some refactoring of the OPTIONS method so the
  "is_origin_allowed" logic can be reused.

* Added a little extra detail to the CORS documentation.

DocImpact

Change-Id: I68538e472a900775427f21a8a59e738a83dcc8bc
2013-01-23 19:31:18 +00:00
Samuel Merritt
f2941b0846 Validate numericness of ports in builder files.
You can't really goof this up using bin/swift-ring-builder, but if you
have code that uses swift.common.ring.RingBuilder directly, you can
stuff e.g. "6002" in where you mean 6002, resulting in some fairly
baffling failures. (Yes, I have done this.)

Change-Id: I87b7b7066b9ea2ce6f82255605da99cf0d283689
2013-01-22 18:56:48 -08:00
Eohyung Lee
04037aee5d Fixed bug in domain_remap and cname_lookup middleware
If domain_remap and cname_lookup received request which has no host header,
then returns 500 error. This fixes that problem.

Change-Id: Ibb457e9b4cb21181d8243858c04ce255365690da
Fixes: bug #1100632
2013-01-23 09:36:37 +09:00
Kota Tsuyuzaki
161aa89bd5 prevent irregular auth_prefix config in tempauth
Tempauth handles a authorization request by request path.
If a request's path start with auth_prefix, tempauth middleware
handles that request to authorization method.
Therefore, when configuring auth_prefix to '/', all requests
handle to authorization method.

This change enables tempauth to prevent invalid auth_prefix
config '/' and similar empty auth_prefix in initialization method.

Fixes bug #1096538.

Change-Id: I20b157e2a0809c17409fc65a8eff0858fe4aff29
2013-01-21 20:50:46 -08:00
Jenkins
3814f9fcdd Merge "Add --run-dir switch to swift-init" 2013-01-21 19:10:13 +00:00
Chmouel Boudjnah
3282e3885c Add --run-dir switch to swift-init
- Add ability to specify an alternative run_dir than the default
  /var/run/swift.
- DocImpact

Change-Id: I17677588f2c8da563b7fec2dc4fdc52da87126ed
2013-01-21 18:12:17 +01:00
Jenkins
0fce08a255 Merge "get swob.Request.blank to parse path" 2013-01-16 20:44:36 +00:00
David Goetz
54b7594056 get swob.Request.blank to parse path
Change-Id: I3327c915b3b868bb1829103adb718632e58b1b4a
2013-01-16 10:00:18 -08:00
Jenkins
b6d48c62e6 Merge "Fix HEAD request response when request not given to response." 2013-01-16 00:04:41 +00:00
Jenkins
4a909cf33b Merge "swob refactors needed for sos" 2013-01-15 19:14:08 +00:00
Jenkins
d69509a779 Merge "Fixed bug in object replicator" 2013-01-14 23:58:10 +00:00
David Goetz
c8b28ba4f4 swob refactors needed for sos
Change-Id: I839c2af9e524f712e6fbeb8bf74d860af1d243e2
2013-01-14 13:57:16 -08:00
Samuel Merritt
6ff644b945 Allow for multiple X-(Account|Container)-* headers.
When the number of account/container or container/object replicas are
different, Swift had a few misbehaviors. This commit fixes them.

* On an object PUT/POST/DELETE, if there were 3 object replicas and
  only 2 container replicas, then only 2 requests would be made to
  object servers. Now, 3 requests will be made, but the third won't
  have any X-Container-* headers in it.

* On an object PUT/POST/DELETE, if there were 3 object replicas and 4
  container replicas, then only 3/4 container servers would receive
  immediate updates; the fourth would be ignored. Now one of the
  object servers will receive multiple (comma-separated) values in the
  X-Container-* headers and it will attempt to contact both of them.

  One side effect is that multiple async_pendings may be written for
  updates to the same object. They'll have differing timestamps,
  though, so all but the newest will be deleted unread. To trigger
  this behavior, you have to have more container replicas than object
  replicas, 2 or more of the container servers must be down, and the
  headers sent to one object server must reference 2 or more down
  container servers; it's unlikely enough and the consequences are so
  minor that it didn't seem worth fixing.

The situation with account/containers is analogous, only without the
async_pendings.

Change-Id: I98bc2de93fb6b2346d6de1d764213d7563653e8d
2013-01-14 12:38:46 -08:00
Jenkins
586076fddf Merge "Make object-auditor to use one logger" 2013-01-14 18:26:11 +00:00
Hodong Hwang
d46f90e17a Make object-auditor to use one logger
This commit makes that AuditorWorker gets a logger from ObjectAuditor class
(instead of creating new one) so the auditor uses minimum unix-sockets.

Fixes: bug #1089215
Change-Id: Ia47d862cbe7505db821784b01fcce6f22196e79f
2013-01-14 18:38:49 +09:00
Jenkins
d904fd4c0f Merge "swift-recon: Added oldest and most recent repl" 2013-01-12 21:05:59 +00:00
gholt
95d5cf851b Fixed bug in object replicator
If the object replicator couldn't create a device's object directory
(due to permissions or whatever) it wouldn't do any work at all. This
fixes that.

Change-Id: I6a30439d036b29c9cfdb660428d13668e0dc8632
2013-01-12 07:25:15 +00:00
gholt
592d895e31 Reject names with NULL characters
Unfortunately, SQLite truncates strings with null characters.
Additionally, XML pretty much hates them too.

Change-Id: Id9a8eaa27b841db6350d6959c202d3e3d6462b35
2013-01-12 06:54:17 +00:00
gholt
a88b412e17 swift-recon: Added oldest and most recent repl
I've been doing this with cluster-wide log searches for far too long.
This adds support for reporting the oldest replication pass
completion as well as the most recent. This is quite useful for
finding those odd replicators that have hung up for some reason and
need intervention.

Change-Id: I7fd7260eca162d6b085f3e82aaa3cf90670f2d53
2013-01-12 05:49:14 +00:00
Darrell Bishop
e2929ec58a Fix HEAD request response when request not given to response.
If a middleware (swift3, I'm looking at you), doesn't pass a Request
object into the Response constructor, Response._response_iter cannot
know to send zero bytes in the body of the HEAD response.

This patch fixes this usage of swob by making Response.__call__
helpfully reify self.request from env if it wasn't already set by the
Response object's constructor.

This fixes a bug in swift3 + swob-enabled-Swift where HEAD requests to
swift3 resulted in a response with a body in violation of the relevant
RFC and confusing clients.

Thanks to kostecky for finding the bug and describing it accurately.

Change-Id: I2bdb098052b161e1cddf1e4e482ab4dfafeb18c0
2013-01-10 13:15:31 -08:00
John Dickinson
dc8d0e0692 Functional tests use x-auth-token rather than x-storage-token
This change allows other auth systems to test against the functests but not
require them to support x-storage-token (which was deprecated before swift
was even open-sourced). All other places in the code where x-storage-token is
used is only to populate x-auth-token if x-auth-token doesn't already exist.

Change-Id: Ie903d0f7135fc643353b74a61c14becf7dfc4d9d
2013-01-03 08:59:46 -08:00
gholt
5f19ccf28f Fix for subtle bug from 5c8f9c52e3f2944f01cea621326532e058a225f7
Change-Id: If2bd1d4a850936b2e575a96073c116a8b9522602
2012-12-21 19:40:49 +00:00
gholt
52a2a65ed4 Made 507s report drive, if known.
This functionality was lost with the swob change, but is back now.

Change-Id: I13b3154080a7c601235711b274e4899efb6adc93
2012-12-18 01:18:57 +00:00