6736 Commits

Author SHA1 Message Date
Tim Burke
dfeae59824 Factor out a bunch of common testing setup
Rather than having a comment declaring that the stack/history modes
only diverge after the delete(), move the common code to a separate
function called by tests for both modes.

Change-Id: I657106b11bf0697338a776513d2a51ac6e562c0a
2017-03-23 00:27:39 +00:00
Jenkins
5507df14e8 Merge "Test EC chunk_transformer with larger input chunks" 2017-03-22 20:37:06 +00:00
Kota Tsuyuzaki
8fe4bfefaa TestObjectController refactoring
From the related change of ECDuplication, Swift have a couple of Test
classes for EC policy, normal EC and EC Duplication, in the
test/unit/proxy/test_server.py. To enable the classes, the related change
abstracts the EC test cases as the ECTestMixin class to gather test
methods into one place but it was worse because TestObjectController did
still have both test cases for replication and for ec that may be hard
to understand the test class structure.

Hence, this patch attempts to refactor the structure as

From:

     ECTestMixin
            |
    -------------------------------------
    |                                   |
TestObjectController           TestObjectControllerECDuplication
(for replication and EC)       (for EC Duplication Policy)

To:

    BaseTestObjectController
            |
    --------------------------------------
    |                                    |
TestReplicatedObjectController  BaseTestECObjectController
(for replication)                        |
                          ---------------------------------
                          |                               |
                TestECObjectController    TestECDuplicationObjectController
                (for EC policy)           (for EC Duplication Policy)

Some more cleanups are in follow up patches because this patch shows a lot
of moving code chunks which could be hard to compare the diff. To make
the review easy, this patch forcus on ONLY the structure changes as
possible.

Related-Change: Idd155401982a2c48110c30b480966a863f6bd305
Related-Change: I25a3f8fc837706d78dca226fe282d9e5ead65a0d
Change-Id: Ifd3d0fa66773e640bb61cc528f7a1b2358e97d91
2017-03-22 19:54:50 +00:00
Jenkins
050bb63b77 Merge "Include received frag_index in reconstructor log warnings" 2017-03-22 16:19:53 +00:00
Jenkins
39c7021aa4 Merge "Small fixes for ec duplication" 2017-03-22 16:14:23 +00:00
Jenkins
23cc5d1f18 Merge "Clean up unused function" 2017-03-22 11:14:48 +00:00
Jenkins
1954189483 Merge "Remove duplicate code in test_diskfile.py" 2017-03-22 07:48:17 +00:00
Jenkins
55075ea8be Merge "Add extra test for name_check /info" 2017-03-21 17:53:31 +00:00
Jenkins
809229203b Merge "Log the correct request type of a subrequest downstream of copy" 2017-03-21 17:37:12 +00:00
Tim Burke
7d08b0735f Clean up unused function
Also, use `==` instead of `is` for string comparison.

Change-Id: I12040d56afc239a7b7be1ae37b27cce708bf6f10
Related-Change: I1ccb2665b6cd2887659e548e55a26aa00de879e3
2017-03-21 08:46:17 -07:00
Jenkins
3abc664b7a Merge "add name_check to /info" 2017-03-21 14:23:32 +00:00
Alistair Coles
3b83bd42a6 Remove duplicate code in test_diskfile.py
DiskFileMixin and DiskFileManagerMixin has almost
identical setUp() and tearDown() methods, and both
inherit BaseDiskFileTestMixin, so this moves the common
code into the abstract superclass.

Also remove repeated declaration of vars in
test_diskfile.py:run_quarantine_invalids
and a duplicated qualified import in obj/test_server.py

Change-Id: Id99ba151c7802c3b61e483a7e766bf6f2b2fe3df
2017-03-21 11:37:33 +00:00
Alistair Coles
bd400dd22e Add extra test for name_check /info
Test that the actual configured options get reported in /info

Follow up to:
Related-Change: If1af43485b4708cab6c4b5d7f6f0a334d8752518

Change-Id: I1d76d40c70a38b959dd0103f3c56b1da4dae068f
2017-03-21 10:59:50 +00:00
John Dickinson
cd39778824 add name_check to /info
Also removed a bunch of unnecessary unquotes. Just use path_info
instead (it's already unquoted).

Partial-Bug: #1670915

Change-Id: If1af43485b4708cab6c4b5d7f6f0a334d8752518
2017-03-21 10:58:41 +00:00
Janie Richling
108501a8c1 Log the correct request type of a subrequest downstream of copy
Before this change, subrequests made while servicing a copy would
result in logging the request type from the copy PUT/GET request
instead of the type from the subrequest being logged.

In order to have the correct requst type logged for subrequests:
- Changed subrequest environments to not inherit the orig_req_method
  of the enclosing request.
- Changed copy to be more picky about when it sets orig_req_method

In addition, subrequest environments will no longer inherit the
swift.log_info from the enclosing request.  That inheritance had
been added at Ic96a92e938589a2f6add35a40741fd062f1c29eb
along with swift.orig_req_method.

Change-Id: I1ccb2665b6cd2887659e548e55a26aa00de879e3
Closes-Bug: #1657246
2017-03-20 22:11:33 -05:00
Alistair Coles
52a23ddb3c Fix race when consolidating new partition
Suffix hash invalidations in hashes.invalid can be lost when two
concurrent calls to get_hashes consolidate the hashes of a new
partition with no hashes.pkl:

- suffix S has been invalidated and is listed in hashes.invalid
- process X calls get_hashes when there is no existing hashes.pkl
- process X removes hashes.invalids file in consolidate_hashes
- process X calculates the hash of suffix S (note, process X has
  not yet written hashes.pkl)
- process Y invalidates suffix S, appends S to hashes.invalid, so the
  hash of suffix S *should* be recalculated at some point
- process Z calls get_hashes->consolidate_hashes, deletes hashes.invalid
  because there is still no hashes.pkl
- process Z fails
- process X writes hashes.pkl with stale hash value for suffix S
- the invalidation of S that was made by process Y is lost

The solution is to never remove hashes.invalid during consolidate_hashes
without first recording any invalid suffixes in hashes and writing hashes
to disk in hashes.pkl. This is already the behaviour when hashes.pkl
exists. The cost of an additional write to hashes.pkl, introduced by this
patch, is only incurred once, when get_hashes first encounters a
partition with no hashes.pkl.

Related-Change: Ia43ec2cf7ab715ec37f0044625a10aeb6420f6e3

Change-Id: I08c8cf09282f737103e580c1f57923b399abe58c
2017-03-20 12:49:57 +00:00
cheng
99412d4830 fix get ring name
replace ring_name = basename(ring_path)[:len('ring.gz')]
with ring_name = basename(ring_path)[:-len('.ring.gz')]

Change-Id: I741e46d116c8fc7c2e91a51da4284302eec3aa41
Closes-bug: #1668736
2017-03-18 03:43:32 +00:00
Alistair Coles
aa9afb5384 Test EC chunk_transformer with larger input chunks
The tests were lacking coverage for the chunk_transformer
reading multiple segment_size pieces from an input chunk.
This patch modifies test_chunk_transformer to exercise more
input chunk scenarios.

Also improve variable naming and comments in
_test_determine_chunk_destinations_prioritize

Change-Id: I4eb55ee3e87dae478828f7ccba86fec267492bd8
Related-Change: Ib9e8a6f67c2985164dd20b049c7f144f19fd1822
2017-03-17 09:19:47 +00:00
Alistair Coles
56349e022d Include received frag_index in reconstructor log warnings
The Related-Change removed the frag_index expected from a
node response from the full_path included in log messages.
This made sense because the *expected* frag_index is not
necessarily the index that was actually received from the
node. However, it would be useful to include the *actual*
received frag_index in log messages.

This patch also:

- makes _full_path a module level function
- renames unique_index to be resp_frag_index to aid
  understanding of the various indexes we deal with during
  reconstruction.

Change-Id: Ic932835b3c1ed51a8456fce775fb59445fcb834b
Related-Change: I8096202f5f8d91296963f7a409a29d57fa7828e4
2017-03-17 09:18:17 +00:00
Kota Tsuyuzaki
a2f4046624 Small fixes for ec duplication
To address Alistair's comment at
https://review.openstack.org/#/c/219165.

This includes:

- Fix reconstructor log message to avoid redundant frag index info
- Fix incorrect FabricatedRing setting to have ec_k + ec_m replicas
- Use policy.ec_n_unique_fragments for testing frag index election
- Plus some various minor cleanup and docs additions

Huge refactoring around TestECMixin at the test/unit/proxy/test_server.py
is in https://review.openstack.org/#/c/440466/ to clarify the change.

Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>

Change-Id: I8096202f5f8d91296963f7a409a29d57fa7828e4
2017-03-16 21:59:56 -07:00
Jenkins
5c0814daa6 Merge "Add assertions to test_reconstructor test_get_response" 2017-03-17 04:52:04 +00:00
Jenkins
31ccc2740a Merge "Fix intermittent EC GET test failure" 2017-03-16 20:46:36 +00:00
Alistair Coles
4f5c03c89d Fix intermittent EC GET test failure
test_GET_with_mixed_etags_at_same_timestamp in
test.unit.proxy.controllers.test_obj:TestECObjController
will fail intermittently when the randomly chosen bodies
of the two objects are identical. In conjunction with the
timestamps of the two objects being deliberately equal,
this makes the two objects identical.

Fix it by explicitly setting unique base strings for the
object bodies.

Change-Id: Idb1081edfa26b9f229f44b00c439cda33a7385fa
2017-03-16 16:56:32 +00:00
Jenkins
b43414c905 Merge "Accept storage_domain as a list in domain_remap" 2017-03-16 12:35:48 +00:00
Jenkins
2dd8357269 Merge "refactor some common code from crypto" 2017-03-14 17:22:30 +00:00
Jenkins
4143c3579c Merge "Fixed indentation in common/ and obj/" 2017-03-14 14:18:34 +00:00
Jenkins
612a6bb976 Merge "Update calling super class constructor style in proxy controllers" 2017-03-14 07:38:19 +00:00
Jenkins
1e9b8888bf Merge "Enable cluster-wide CORS Expose-Headers setting" 2017-03-13 19:24:20 +00:00
Kazuhiro MIYAHARA
7dd1985b90 Update calling super class constructor style in proxy controllers
"swift.proxy.controllers.base.Controller" inherits "object", so the
Controller class and its sub classes (AccountController,
ContainerController, BaseObjectController, InfoController) are
"new style class".  In new style class, if a class call super class's
constructor, "super(SubClass, self).__init__(foo, bar)" is recommended.
But, AccountController, ContainerController, BaseObjectController,
and InfoController use "Controller.__init__(self, app)", and it is
deprecated.

This patch fixes the calling super class constructor codes.

Change-Id: I4b94ec3131c7c7be4609716867a36490a70d5009
Closes-Bug: #1672285
2017-03-13 17:13:46 +09:00
Jenkins
8b2f01a619 Merge "More port number cleanup" 2017-03-10 23:31:59 +00:00
Jenkins
d6edefe886 Merge "Add another failing test for 412 logging" 2017-03-10 22:15:11 +00:00
Tim Burke
b958466a72 More port number cleanup
Closes-Bug: #1671896
Related-Change: Ie4fee05b5f7e0c0879a7b42973bca459f7c85408
Change-Id: I18db1937a0991497027a4d096fb95cdda81f7d68
2017-03-10 18:28:04 +00:00
Alistair Coles
b1f6de4ec2 Update .mailmap
Change-Id: I463263288ac1f7745c363f6eb78820d988cecc22
2017-03-10 10:50:33 +00:00
Jenkins
a3efca5027 Merge "Support EC policy for in process functional tests" 2017-03-10 04:38:12 +00:00
Jenkins
455827716d Merge "Optimize ec duplication and its md5 hashing" 2017-03-09 21:55:56 +00:00
Jenkins
4c236f0303 Merge "Log correct status code for conditional requests" 2017-03-09 21:54:50 +00:00
Clay Gerrard
9afe2bafb4 Add another failing test for 412 logging
I tried to move res.fix_conditional_response() into the get_log_line
method in utils but couldn't find a container request that was
*actually* conditional.  We return 412 from the container on a couple
of bad requests where we really probably shouldn't - but regardless those
responses aren't really conditional.

Plus I'd have to make a synthetic test in utils somewhere.

So this seems better - leave the fix closer to the problem.

Change-Id: I76237d5d5025a653e879141b03df863205c59f3a
Related-Change-Id: I66c871f1f15fb43f19d59331b05cc7567ce10063
2017-03-09 12:09:08 -08:00
Thiago da Silva
4d3aa4ea78 refactor some common code from crypto
This patch moves some code from the crypto files
to a more common modules that will be used by symlinks

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>

Change-Id: I1758693c5dd428f9f2157966aac49d97c2c7ab12
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2017-03-09 11:12:29 -05:00
Alistair Coles
5f610c76bd Support EC policy for in process functional tests
Add support for a 2+1 EC policy to be optionally used as default
policy when running in process functional tests.

The EC policy may be selected by setting the env var:

  SWIFT_TEST_IN_PROCESS_CONF_LOADER=ec tox

when running .functests, or by using the new tox test env:

  tox -e func-ec

Change-Id: I02e3553a74a024efdab91dcd609ac1cf4e4f3208
2017-03-09 10:42:34 +00:00
chenaidong1
3cabafa326 Fix the typo
delete redundant 'that'

Change-Id: If61727e28fa57dfb82165ab5ea2e98e3d7965474
2017-03-09 16:45:36 +08:00
Jenkins
21e593fabe Merge "Use real mocking in unit tests test_cname_lookup" 2017-03-09 07:12:25 +00:00
Romain LE DISEZ
110d7856de Use real mocking in unit tests test_cname_lookup
Replacing function without mocking creates weird behaviors as the results
of the tests sometimes depends on the order of the execution. Use real
mocking to avoid such behaviors.

Example: using real mock showed that test test_host_is_storage_domain was
wrong because it was not "reseting" the lookup_cname function at the
beginning of the test.

Change-Id: Ibc60697c9c850e6e3a108f0d906e8906c3f53ced
2017-03-08 18:20:48 +01:00
Monty Taylor
3c844d02b9
Replace references to swift.openstack.org
The policy of giving projects vanity domains stopped about 5 years ago.
swift.openstack.org is a redirect to the canonical location -
docs.openstack.org/developer/swift. While we are not aiming to remove
the redirect any time in the forseeable future due to existing published
links pointing to it, we should at the very least stop adding more of
those links to the world.

Change-Id: I10e92309f5d3b5f908fe4438f5cc0b184f161cba
2017-03-08 09:46:41 -06:00
Alistair Coles
adcb4c270e Document SAIO rsync service setup for ubuntu 16
SAIO docs do suggest using Ubuntu 14.04, but if using
16.04 then systemctl needs to be used to have rsync service
restart on reboot.

Change-Id: I4fb0d3d063df61fbdfca981f06911148f3c4dc04
2017-03-08 15:07:13 +00:00
Alistair Coles
54fe738a0e Add assertions to test_reconstructor test_get_response
Tighten up test to verify that 404 response results in a None
return from reconstructor _get_response. Merge this test case
into the test_get_response method to make use of the do_test()
infrastructure. Add check for 503 response status.

Also, use assertFalse to verify empty log lines, since a failure
will then result in any log lines being shown in failure message.

Related-Change: Iba86b495a14c15fc6eca8bf8a7df7d110256b0af
Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>

Change-Id: Ia83517e6d4c2f5eeb136abd4c04ddab639d40b9e
2017-03-08 10:31:02 +00:00
Jenkins
b522edf96d Merge "Cache all answers from nameservers in cname_lookup" 2017-03-08 09:47:04 +00:00
Kota Tsuyuzaki
4187c839c3 Optimize ec duplication and its md5 hashing
Originally, ec duplication is designed to make duplicated copy at
chunk_transformer function for each node. However, it can cause doubled
(or more than, depends on ec_duplication_factor) etag calculation which
should be expensive for Swift proxy work.

Since this patch, chunk_transformer keeps only an unique fragments slot
to store, and then, send_chunk in ECObjectController._transfer_data
picks up the suitable chunk by unique backend fragment index assigned by
_determine_chunk_destination function to send to object server.

Note that, Putter still keeps node_index but the new putter_to_frag_index
dict and frag_hasher (chunk_index and chunk_hasher in the old names)
now refers the value by fragment index.

Change-Id: Ib9e8a6f67c2985164dd20b049c7f144f19fd1822
2017-03-08 01:12:09 -08:00
Jenkins
b7e0494be2 Merge "Global EC Under Development Documentation" 2017-03-08 08:12:26 +00:00
Romain LE DISEZ
da92fe4c1a Cache all answers from nameservers in cname_lookup
Unlinke DNSException, NXDOMAIN and NoAnswer are not errors. Thus, they
should be cached so that a misconfiguration from a cname_lookup user do
not generate too many requests on the nameservers.

This patch cache NXDOMAIN and NoAnswer response for 60 seconds.

Change-Id: I1d3002bceaf5f5bee364fea6afe52cbf2aeb5fd2
2017-03-07 16:55:09 +01:00
Clay Gerrard
38b99ad195 Global EC Under Development Documentation
Layout the foundation for documenting the features which will enable
Global EC.

The formatting on the sections in our existing EC docs didn't follow
best practices [1] and it caused some sphinx build warnings.

1. http://www.sphinx-doc.org/en/stable/rest.html#sections

Change-Id: I2d164dafeb84629c75c3c2ff774329ee84270b7f
2017-03-07 15:25:54 +00:00