6238 Commits

Author SHA1 Message Date
zhangyanxian
ba1f285fe6 Fix typos in test_container.py
TrivialFix

Change-Id: I6d3422a88b6fd6d2a495d17ff75d292ac96cc251
2016-11-17 02:07:24 +00:00
Jenkins
98a635b242 Merge "Remove duplicated 'User-Agent' header from object-updater's requests" 2016-11-16 21:50:21 +00:00
Janie Richling
8e122c6fe8 Document X-Openstack-Request-Id in all responses
Swift returns `X-Openstack-Request-Id` for container and
object requests as well as account.  A couple api-ref docs are
missing this value in the response examples.

Change-Id: Ifcd67a620e04be5e92b43c7749ee4acb50bb171d
2016-11-15 13:15:59 -06:00
Jenkins
72e413a9ef Merge "remove double checks on account/container info" 2016-11-14 04:30:41 +00:00
Jenkins
c3f6727bec Merge "Show file parameters as mandatory in swift-*-info man pages" 2016-11-11 21:22:25 +00:00
Jenkins
6885d7956a Merge "Add OPTIONS in manpages" 2016-11-11 21:22:18 +00:00
Jenkins
2b116cffd3 Merge "Include debug message for rsync tempfiles" 2016-11-11 21:20:59 +00:00
Thiago da Silva
d25216bdda remove double checks on account/container info
Continuing the clean up in account and container
info, removed duplicated validation from account_info
and container_info methods, since the same validations
were recently added to get_account_info and get_container_info.

Change-Id: I1ad745fe809367d22649c83f38c4de7a74cac44e
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2016-11-11 10:46:17 -08:00
Alistair Coles
721cd1634a Show file parameters as mandatory in swift-*-info man pages
Changes the file parameters on command line to use the convention of
<file> for a mandatory option rather than [file] which suggests an
optional flag. Also drop to lower case as is convention in other man
pages.

Change-Id: Icfb4b4786343eb493a73b092cad1fdadc935d066
2016-11-11 16:34:15 +00:00
Mohit Motiani
243dd97c58 Add OPTIONS in manpages
swift-account-info, swift-container-info, swift-object-info
and swift-get-node do not contain any information about the available
options. This patch adds OPTIONS in these manpages.

Change-Id: I832c621460ee6bf19adac8e0aadeab32be4b8da0
2016-11-11 16:31:02 +00:00
Jenkins
7b69efe1b6 Merge "Py3: Fixes header key dict" 2016-11-11 13:32:07 +00:00
Christian Hugo
b69caeae7d Include debug message for rsync tempfiles
The warning message for rsync tempfiles was removed in the related
change.  However, because our regex match might result in a false
positive maybe it's still useful to log a debug message.  Instead of
silently ignoring rsync tempfiles, when running in debug we note the
file and how we classified it - but still no warning will occur.

I also consolidate our use of the regex for rsync tempfiles into the
diskfile module and move the negative test for the warning logger
message a little next to the positive test.

Change-Id: Idb2a1a76aa275c9c2e9bad8aceea913b8f5b1c71
Related-Change: I5a5d6e24710e4880776b32edcbc07021acf77676
2016-11-11 11:47:19 +00:00
Jenkins
71d0148034 Merge "adding reno sphinx tree" 2016-11-10 23:00:12 +00:00
John Dickinson
e6dea4d699 adding reno sphinx tree
This should give the necessary tooling to set up the right
links in the right places so Swift has release notes listed
alongside other projects.

Change-Id: I4e5f1ce1fcfbb2943036c821a24a0b4a3a2d9fc8
2016-11-10 21:34:14 +00:00
Jenkins
a30351bdfc Merge "Fix ZeroDivisionError in reconstructor.stats_line" 2016-11-09 04:54:15 +00:00
Tim Burke
5de9747e16 Stop shadowing built-in iter
Change-Id: I0e3fcddfef6968353e4c0aa6871a2e7a22598459
2016-11-08 12:32:18 -08:00
Lokesh S
2f31c0469d Py3: Fixes header key dict
Decode header to latin1 on python3
encode header to utf-8 on python2.

Co-Authored-By: Alistair Coles <alistair.coles@hpe.com>

Change-Id: I10f205a05bb3a566e52a597d9315b3a8b8c14664
2016-11-08 12:22:12 -08:00
Clay Gerrard
f4adb2f28f Fix ZeroDivisionError in reconstructor.stats_line
Despite a check to prevent zero values in the denominator python
integer division could result in ZeroDivisionError in the compute_eta
helper function.  Make sure we always have a non-zero value even if it
is small.

NotImplemented:

 * stats calculation is still not great, see lp bug #1488608

Closes-Bug: #1549110
Change-Id: I54f2081c92c2a0b8f02c31e82f44f4250043d837
2016-11-07 18:19:20 -08:00
Jenkins
78527aaf7a Merge "EC: reconstruct using non-durable fragments" 2016-11-07 23:45:11 +00:00
Jenkins
c3f9c1cf25 Merge "Fix signal handling for daemons with InternalClient" 2016-11-07 18:36:07 +00:00
Jenkins
03c68dd145 Merge "update urls to newton" 2016-11-07 15:46:15 +00:00
Clay Gerrard
c2ce92acd6 Fix signal handling for daemons with InternalClient
The intentional use of "bare except" handling in catch_errors and some
daemons to prevent propagation on unexpected errors that do not
inherit from Exception (like eventlet.Timeout) or even BaseException
(like old-style classes) has the side effect of spuriously "handling"
*expected* errors like when a signal handler raises SystemExit.

The signal handler installed in our Daemon is intended to ensure first
that the entire process group and any forked processes (like rsync's)
receive the SIGTERM signal and also that the process itself
terminates.

The use of sys.exit was not a concious grandiose plans for graceful
shutdown (like the running[0] = False trick that wsgi server parent
process do) - the desired behavior for SIGTERM is to stop - hard.

This change ensures the original goals and intentions of our signal
handler are fulfilled without the undesirable side effect that can
cause our daemons to confusingly log an expected message to stop as an
unexpected error, and start ignoring additional SIGTERM messages;
forcing our kind operators to resort to brutal process murder.

Closes-Bug: #1489209
Change-Id: I9d2886611f6db2498cd6a8f81a58f2a611f40905
2016-11-04 20:00:00 -07:00
Jenkins
71d3ce36b3 Merge "Ignore Range values like "bytes=--0"" 2016-11-05 02:27:29 +00:00
Jenkins
d1bb12cf1c Merge "Add probetest for response with duplicate frags" 2016-11-04 18:42:06 +00:00
Clay Gerrard
116462d8a5 Add probetest for response with duplicate frags
When an SSYNC connection fails after shipping a fragment, but before
cleaning itself up - it can lead to multiple replicas of the same
fragment index serviceable in the node_iter at the same time.  Or
perhaps more likely if a partner nodes win a race to rebuild waiting
on a handoff.  In this case, the proxy need not fail to service a GET
just because of extra information.  A similar guard was added to the
reconstructor in a related change [1].

This underlying bug is acctually fixed by the related change [2], this
probetest is just encoding the failure to help with future maintenance.

1. Related-Change: I91f3d4af52cbc66c9f7ce00726f247b5462e66f9
2. Related-Change: I2310981fd1c4622ff5d1a739cbcc59637ffe3fc3

Closes-Bug: 1624176

Change-Id: I06fc381a25613585dd18916d50e7ca2c68d406b6
2016-11-04 17:29:04 +00:00
Alistair Coles
6574ce31ee EC: reconstruct using non-durable fragments
Previously the reconstructor would only reconstruct a missing fragment
when a set of ec_ndata other fragments was available, *all* of which
were durable. Since change [1] it has been possible to retrieve
non-durable fragments from object servers. This patch changes the
reconstructor to take advantage of [1] and use non-durable fragments.

A new probe test is added to test scenarios with a mix of failed and
non-durable nodes. The existing probe tests in
test_reconstructor_rebuild.py and test_reconstructor_durable.py were
broken. These were intended to simulate cases where combinations of
nodes were either failed or had non-durable fragments, but the test
scenarios defined were not actually created - every test scenario
broke only one node instead of the intent of breaking multiple
nodes. The existing tests have been refactored to re-use most of their
setup and assertion code, and merged with the new test into a single
class in test_reconstructor_rebuild.py.

test_reconstructor_durable.py is removed.

[1] Related-Change: I2310981fd1c4622ff5d1a739cbcc59637ffe3fc3

Change-Id: Ic0cdbc7cee657cea0330c2eb1edabe8eb52c0567
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Closes-Bug: #1624088
2016-11-03 16:54:09 +00:00
Alistair Coles
a4d77d918d Fix KeyError when auditor finds an expired object
Since the related change [1] the auditor checks deleted objects in
case their tombstone is ready to be reclaimed. However, the auditor
mistakes an expired object for a deleted object because
DiskFileExpired is a subclass of DiskFileDeleted. This causes a
KeyError to be raised and logged because the expired object has no
tombstone info in the ondisk_info data structure.

This patch makes the auditor catch and ignore DiskFileExpired
exceptions before handling DiskFileDeleted exceptions.

[1] Related-Change: I3e99dc702d55a7424c6482969e03cb4afac854a4

Change-Id: I9872b6997d09dcfd8a868c4b91b9379407283b8e
Closes-Bug: #1638016
2016-11-03 15:19:25 +00:00
Jenkins
a852b1ecd7 Merge "Make NullLogger more logger like" 2016-11-03 02:07:48 +00:00
Jenkins
2df13f5ffc Merge "Use more specific asserts in test/probe tests" 2016-11-03 02:00:32 +00:00
Jenkins
b7c11512f1 Merge "Add unit test content" 2016-11-03 01:16:04 +00:00
Clay Gerrard
3b889331b3 Make NullLogger more logger like
eventlet.wsgi.server is adaptive to dealing with the named log
argument being either a file like or a log like [1], but message
handling is a more direct pass through if it's a log like.

Since all we want to do is make eventlet's logging it a noop - it's
easy to provide either interface!

1. https://github.com/eventlet/eventlet/blob/4d2cdc/eventlet/wsgi.py#L246

Change-Id: I2d792176c96931eafb3f140e6653ba8b31eda429
2016-11-02 17:29:22 -07:00
Gábor Antal
300d388825 Use more specific asserts in test/probe tests
I changed asserts with more specific assert methods.

e.g.: from assertTrue(sth == None) to assertIsNone(*) or
assertTrue(isinstance(inst, type)) to assertIsInstace(inst, type) or
assertTrue(not sth) to assertFalse(sth).

The code gets more readable, and a better description will be shown on fail.

Change-Id: I3768faa568e3964e726ecc48ac8cb133cb088284
2016-11-02 18:13:22 +00:00
Jenkins
fb910954b2 Merge "Mirror X-Trans-Id to X-Openstack-Request-Id" 2016-11-01 23:18:57 +00:00
Alistair Coles
2a75091c58 Make ECDiskFileReader check fragment metadata
This patch makes the ECDiskFileReader check the validity of EC
fragment metadata as it reads chunks from disk and quarantine a
diskfile with bad metadata. This in turn means that both the object
auditor and a proxy GET request will cause bad EC fragments to be
quarantined.

This change is motivated by bug 1631144 which may result in corrupt EC
fragments being written to disk but appear valid to the object auditor
md5 hash and content-length checks.

NotImplemented:

 * perform metadata check when a read starts on any frag_size
   boundary, not just at zero

Related-Bug: #1631144
Closes-Bug: #1633647

Change-Id: Ifa6a7f8aaca94c7d39f4aeb9d4fa3f59c4f6ee13
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Co-Authored-By: Kota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>
2016-11-01 13:11:02 -07:00
Kazuhiro MIYAHARA
e166e19b23 Remove duplicated 'User-Agent' header from object-updater's requests
When Object-Server saves async-update in pickle files,
'User-Agent: object-server %(pid)' (the key is title style) is included
in the pickles. However, Object-Updater will add
'user-agent: object-updater %(pid)' (the key is lower case style) to the
pickled headers and use it to make http connection. According to RFC
7230, each header field consists of a case-insensitive field name,
therefore either of 'User-Agent' and 'user-agent' should not be included
in the headers.

This patch removes old 'User-Agent' header from object-updater's
requests.

Change-Id: Ia624558395584457c718b311fe80e1a8406e22ad
Closes-Bug:#1635114
2016-11-01 11:50:12 +00:00
Jenkins
ebcc3ac8fa Merge "Suppress unexpected file warnings for rsync temp files" 2016-10-31 23:53:17 +00:00
Ondřej Nový
33c18c579e Remove executable flag from some test modules
Change-Id: I36560c2b54c43d1674b007b8105200869b5f7987
2016-10-31 21:22:10 +00:00
Christian Hugo
2bd8d050fb Suppress unexpected file warnings for rsync temp files
Do not log unexpected file warning for rsync temp files when the parsing
of the timespamp fails.  If the file passes a regex test suppress the
logger waring, but still return it as an unexpected file from
get_ondisk_files.

Closes-Bug: 1616504

Change-Id: I5a5d6e24710e4880776b32edcbc07021acf77676
2016-10-31 12:34:41 -07:00
karen chan
d0fe922904 Mirror X-Trans-Id to X-Openstack-Request-Id
Many other OpenStack services use a `[X-]OpenStack-Request-Id` header
to return a unique identifier for the request.  Swift will now return
`X-Trans-Id` as well as `X-Openstack-Request-Id`.

Change-Id: I56cd4738808b99c0a08463f83c100be51a62db05
Closes-Bug: #1572786
2016-10-30 20:02:39 -07:00
Tim Burke
c91ca5335f Ignore Range values like "bytes=--0"
This is consistent with what we already do for other
semantically-invalid values like "bytes=--1". Previously, we would
return a 416 Requested Range Not Satisfiable response like we do for the
semantically-valid-but-not-really-meaningful "bytes=-0"

Change-Id: I932b42406c9a5ee7eaa6978a655e61022a957415
2016-10-29 18:33:48 +02:00
Jenkins
e55f3ad203 Merge "Refactor SLO If-Match / HEAD tests" 2016-10-28 12:35:50 +00:00
Tim Burke
30f672e720 Refactor SLO If-Match / HEAD tests
Previously, we didn't make any assertions about the backend requests
but rather just verified the user-visible behavior.

Change-Id: Iddd4b705ee9b724a4a8a88c6fbaff36cca9612cf
2016-10-28 13:07:27 +02:00
Jenkins
ae24c802a9 Merge "Set owner of drive-audit recon cache to swift user" 2016-10-27 13:26:25 +00:00
Jenkins
27ca0fb2a8 Merge "Add links for more detailed overview in overview_architecture" 2016-10-25 09:34:23 +00:00
Hanxi Liu
c3bc9f31ca Add links for more detailed overview in overview_architecture
Change-Id: Ie1f171d0945e3f1f4daa61bc66786c01e68e9a0a
2016-10-23 12:13:57 +00:00
Ondřej Nový
99a13d9386 Fixed rysnc -> rsync typo
Change-Id: I671b4206072c6e22f4ae38033502336ec32e86ad
2016-10-19 20:17:00 +02:00
Ondřej Nový
9847796f01 Set owner of drive-audit recon cache to swift user
Fixies this problem:
* swift-drive-audit needs to be run by root, because only root have
  "umount" permission
* swift-object servers typically runs as user swift
* if swift-drive-audit is run by root, /var/cache/swift/drive.recon is
  owned by root, with 0o600
* recon middleware (inside swift-object-server) can't read this cache
  file: swift-object: Error reading recon cache file

This patch adds "user" option to drive-audit config file. Recon cache
is chowned to this user.

Change-Id: Ibf20543ee690b7c5a37fabd1540fd5c0c7b638c9
2016-10-19 17:16:42 +00:00
Thiago da Silva
a8b80f0727 update urls to newton
Change-Id: I9eb8c004e100b16de906d340b54e154cf21ddaab
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2016-10-18 15:33:02 -04:00
Jenkins
a79d8508df Merge "Make Content-Disposition support inline; filename=... format." 2016-10-15 21:07:10 +00:00
Jenkins
264e728364 Merge "Prevent ssync writing bad fragment data to diskfile" 2016-10-14 23:29:29 +00:00