156 Commits

Author SHA1 Message Date
Matthew Oliver
d2fc261457 Authorise versioned write PUTs before copy
Currently a versioned write PUT uses a pre-authed request to move
it into the versioned container before checking whether the
user is authorised. This can lead to some interesting behaviour
whereby a user can select a versioned object path that it does not
have access to, request a put on that versioned object, and this
request will execute the copy part of the request before it fails
due to lack of permissions.

This patch changes the behaviour to be the same as versioned DELETE
where the request is authorised before anything is moved.

Change-Id: Ia8b92251718d10b1eb44a456f28d3d2569a30003
Closes-Bug: #1562175
2016-08-26 11:44:44 -04:00
Janie Richling
13747021a8 Add test for POST to DLO manifest file
In the past, a POST to a DLO manifest file when object_post_as_copy
was true resulted in the manifest file contents being replaced
by the concatenation of the DLO segments.  This no longer
happens, but tests for this case are missing.

This patch adds a functional test to assert that the manifest
file is preserved in a POST request.

Change-Id: I90546014a7dcc7266f0d0e0ff6339688b7954b96
Related-bug: #1487791
Related-bug: #1514317
2016-08-18 09:31:57 -05:00
Jenkins
9d29ca1c76 Merge "Last-Modified header support on HEAD/GET container" 2016-08-11 14:44:12 +00:00
Jenkins
22184eb882 Merge "Fix encryption-delimiter interaction" 2016-08-10 04:04:00 +00:00
Tim Burke
fb5fcb189e Fix encryption-delimiter interaction
Previously, if a container listing produced `subdir` elements
the decrypter would raise a KeyError.

Additionally, update the functests so this sort of thing would
have been caught at the gate.

Closes-Bug: 1609904
Change-Id: Idc1907d19f90af7a086f45f8faecee9fbc3c69c2
2016-08-04 17:55:26 +00:00
Michael Barton
303e4a1d83 missing parens in functional test
I was watching the logs and noticed it creates an object named:
"<bound method type.create_ascii_name of <class 'test.functional.tests.Utils'>>"

Change-Id: I8dcbb40125b84a914e3c01566ae9c3f08dc9ea0f
2016-08-04 03:45:14 +00:00
Alistair Coles
afe3968dd1 Copy headers correctly when copying object
Fix copy middleware so that all client-defined object
headers that object servers allow to be persisted are copied.
For example, content-encoding and content-disposition will
now be copied.

Fix treatment of x-fresh-metadata header so that, when it is
used, new object sysmeta is applied to the object copy in the
same way as a copy without x-fresh-metadata.

Remove unnecessary passing of original request headers to
sink PUT request constructor: passing the environ is sufficient
to have the new request inherit the original's headers.

Add tests for this change and to verify that content-type
gets either copied or updated if supplied with the copy
request.

Add tests for x-fresh-metadata treatment.

Closes-Bug: #1391826
Closes-Bug: #1600247
Co-Authored-By: Thiago da Silva <thiago@redhat.com>
Change-Id: I917fb0b4e831c13e04ade1c5e0b9821802dec967
2016-07-22 17:18:20 +01:00
Gábor Antal
e278179b08 Use more specific asserts in functional 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: I80ec96e0b729bef38213a6be4ff4b6eb65c7612d
2016-07-15 13:33:56 +00:00
Jenkins
5566c69b4d Merge "added note to testFileSizeLimit functional test" 2016-07-07 19:26:57 +00:00
Jenkins
813b293e0f Merge "Remove an unused variable from tests.py" 2016-07-07 19:06:21 +00:00
Kazuhiro MIYAHARA
2be1d6a77e Remove an unused variable from tests.py
The varialbe 'size' in TestFile.testMetadataNumberLimit is not used.
This patch remove the variable from the test.

Change-Id: I255a1dcee12bb6b8dec6ff26ed7edf93ab2acf64
2016-07-07 21:28:07 +09:00
John Dickinson
5885d97b7d added note to testFileSizeLimit functional test
Change-Id: I0323ff2511506c354db3416f1b37ede772acaedb
2016-06-17 12:25:26 -07:00
Alistair Coles
928c4790eb Refactor tests and add tests
Relocates some test infrastructure in preparation for
use with encryption tests, in particular moves the test
server setup code from test/unit/proxy/test_server.py
to a new helpers.py so that it can be re-used, and adds
ability to specify additional config options for the
test servers (used in encryption tests).

Adds unit test coverage for extract_swift_bytes and functional
test coverage for container listings. Adds a check on the content
and metadata of reconciled objects in probe tests.

Change-Id: I9bfbf4e47cb0eb370e7a74d18c78d67b6b9d6645
2016-06-15 16:36:25 +01:00
Kota Tsuyuzaki
fcb6e4cd3a Last-Modified header support on HEAD/GET container
This patch enables to show a x-put-timestamp as
a last-modified header in container-server.

Note that the last-modified header will be changed only when a
request for container (PUT container or POST container) comes into
Swift. i.e. some requests for objects (e.g. PUT object, POST object)
will never affect the last-modified value but only when using
python-swiftclient like as "swift upload", the last-modified will
be close to the upload time because python-swiftclient will make
a PUT container request for "swift upload" each time.

Change-Id: I9971bf90d24eee8921f67c02b7e2c80fd8995623
2016-06-07 12:02:03 +01:00
Alistair Coles
d0ec1adb78 Make SLO manifest copies retain correct content-type
When copying an SLO manifest with multipart-manifest=get the actual
manifest content-type should get copied to the destination, rather
than the application/json value that is synthesised by SLO in a GET
response. That way the result of a HEAD on the copied manifest is the
same as a HEAD to the source, and the container listings for the two
are consistent.

This patch also un-skips a functional test and adds functional tests
that verify this patch and also verify that etags and size also get
correctly copied and updated in destination container (bug #1260446).

Closes-Bug: #1260446
Closes-Bug: #1583756

Change-Id: Ie7fa82f70b3ec3ef568f5355c69f6bce460ba25d
2016-05-23 17:25:05 +01:00
Jenkins
9482ef89a2 Merge "Bypass Account Mgmt Functional Cases When Disabled" 2016-05-17 08:02:58 +00:00
Brian Ober
1adc6047f0 Bypass Account Mgmt Functional Cases When Disabled
The testPUT case is failing when keystone was enabled and
allow_account_management is set to True.   There were a few issues
needing addressed.

First the case was renamed to call out what it was actually doing which
is verifying an error scenario for which a PUT on a storage account was
not allowed.

Second the case was running even when allow_account_management is
enabled, which is incorrect.   It "accidently" works with TempAuth
because it requires a reseller permission, so the Keystone failure here
has more to do with not requiring a reseller permission to do a PUT on a
storage account for which a user has an operator role on.

The common sense fix here is to not execute this test case when
allow_account_management is enabled.

Change-Id: Id29f5ca48f92cd139535be7064107b8a61b02856
2016-05-14 14:31:32 -05:00
Jenkins
b6c3ab26a1 Merge "Refactor server side copy as middleware" 2016-05-12 02:48:14 +00:00
Prashanth Pai
46d61a4dcd Refactor server side copy as middleware
Rewrite server side copy and 'object post as copy' feature as middleware to
simplify the PUT method in the object controller code. COPY is no longer
a verb implemented as public method in Proxy application.

The server side copy middleware is inserted to the left of dlo, slo and
versioned_writes middlewares in the proxy server pipeline. As a result,
dlo and slo copy_hooks are no longer required. SLO manifests are now
validated when copied so when copying a manifest to another account the
referenced segments must be readable in that account for the manifest
copy to succeed (previously this validation was not made, meaning the
manifest was copied but could be unusable if the segments were not
readable).

With this change, there should be no change in functionality or existing
behavior. This is asserted with (almost) no changes required to existing
functional tests.

Some notes (for operators):
* Middleware required to be auto-inserted before slo and dlo and
  versioned_writes
* Turning off server side copy is not configurable.
* object_post_as_copy is no longer a configurable option of proxy server
  but of this middleware. However, for smooth upgrade, config option set
  in proxy server app is also read.

DocImpact: Introducing server side copy as middleware

Co-Authored-By: Alistair Coles <alistair.coles@hpe.com>
Co-Authored-By: Thiago da Silva <thiago@redhat.com>

Change-Id: Ic96a92e938589a2f6add35a40741fd062f1c29eb
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2016-05-11 14:55:51 -04:00
Jenkins
ce6c850258 Merge "Fix versioned_writes functional test skipping" 2016-04-26 23:23:33 +00:00
Tim Burke
5e420efc72 Fix versioned_writes functional test skipping
Previously, if object versioning was enabled via the old-style
allow_versions container-server setting rather than the new-style
allow_versioned_writes proxy-server setting,
TestCrossPolicyObjectVersioning would skip tests while
TestObjectVersioning and TestObjectVersioningUTF8 would run them.

Additionally, if versioned_writes was explicitly included in the
proxy-server's pipeline and allow_versioned_writes was disabled,
the functional tests would fail with a 412.

Now, all three will use the same logic to check whether versioning is
enabled. Specifically, they will all try to set an X-Versions-Location
header and skip if it doesn't stick.

Additionally, the TestCrossPolicyObjectVersioningEnv will now properly
clean up after itself.

Change-Id: I4c788a0e18587ff17d3c6e346fd22b881495f06d
2016-04-26 21:37:09 +00:00
Jenkins
72372c1464 Merge "decouple versioned writes from COPY" 2016-04-21 07:35:59 +00:00
Tim Burke
fb3692c9bb Don't include conditional headers in SLO HEAD requests
Previously, attempting to PUT a SLO manifest with `If-None-Match: *`
would include the header when validating the segments, causing the
upload to fail.

Now when SLO validates segments, no conditional headers will be
included in the HEAD request.

Change-Id: I03ad454092d3caa73d29e6d30d8033b45bc96136
Closes-Bug: #1569253
2016-04-13 21:56:10 -07:00
Thiago da Silva
b13a85367e decouple versioned writes from COPY
This change removes the use of the COPY request in the versioned
writes middleware. It changes the COPY verb for GETs and PUTs
requests. The main reasoning for this change is to remove any
dependency that versioning had on copy, which will allow for the COPY
functionality to be moved to middleware and to be to the left of the
versioned writes middleware in the proxy pipeline. In this way,
no COPY request will ever arrive at the versioned writes middleware.

A side benefit of this change is that it removes a HEAD request from
the PUT path. Instead of checking if a current version exists, a
GET request is sent, in case of success, a PUT is sent to the
versions container.

A unit test was removed that tested non-default storage policies.
This test is no longer necessary, since it was used to test
specific policy handling code in the COPY method in the proxy
object controller.

Closes-Bug: #1365862

Change-Id: Idf34fa8d04ff292df7134b6d4aa94ff40887b3a4
Co-Authored-By: Alistair Coles <alistair.coles@hp.com>
Co-Authored-By: Janie Richling <jrichli@us.ibm.com>
Co-Authored-By: Kota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2016-04-11 13:45:36 -04:00
Jenkins
f227072974 Merge "Correctly handle keys starting with the delimiter." 2016-04-01 02:02:44 +00:00
Bill Huber
e1f1296088 Re-format the SLO manifest file on new multipart-manifest GET call
Currently, the multipart-manifest=get call returns output in json
format that is inconsistent with the format that is used for the
multipart-manifest=put.

This in turn introduces a new call: ?multipart-manifest=get&format=raw

Change-Id: I2242943a738f667cbda6363bcb6a017f341e834f
Closes-Bug: 1252482
2016-03-18 18:45:31 +00:00
Alistair Coles
12dd408823 Put correct Etag and Accept-Ranges in EC 304 and 416 responses
When using an EC policy, 304 responses to conditional GETs
are missing the Accept-Ranges header and have the wrong ETag
value. 412 responses also have the wrong etag.

416 responses to ranged GETs also have the wrong ETag.

This patch ensures behaviour with EC policy is consistent
with replication policy:

  - 304 and 416 responses have correct etag and Accept-Ranges
  - 412 responses have correct Etag but no Accept-Ranges

Co-Authored-By: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Co-Authored-By: Thiago da Silva <thiago@redhat.com>

Closes-Bug: #1496234
Closes-Bug: #1558197
Closes-Bug: #1558193
Change-Id: Ic21317b9e4f632f0751133a3383eb5487379e11f
2016-03-17 11:47:33 +00:00
Alistair Coles
e91de49d68 Update container on fast-POST
This patch makes a number of changes to enable content-type
metadata to be updated when using the fast-POST mode of
operation, as proposed in the associated spec [1].

* the object server and diskfile are modified to allow
  content-type to be updated by a POST and the updated value
  to be stored in .meta files.

* the object server accepts PUTs and DELETEs with older
  timestamps than existing .meta files. This is to be
  consistent with replication that will leave a later .meta
  file in place when replicating a .data file.

* the diskfile interface is modified to provide accessor
  methods for the content-type and its timestamp.

* the naming of .meta files is modified to encode two
  timestamps when the .meta file contains a content-type value
  that was set prior to the latest metadata update; this
  enables consistency to be achieved when rsync is used for
  replication.

* ssync is modified to sync meta files when content-type
  differs between local and remote copies of objects.

* the object server issues container updates when handling
  POST requests, notifying the container server of the current
  immutable metadata (etag, size, hash, swift_bytes),
  content-type with their respective timestamps, and the
  mutable metadata timestamp.

* the container server maintains the most recently reported
  values for immutable metadata, content-type and mutable
  metadata, each with their respective timestamps, in a single
  db row.

* new probe tests verify that replication achieves eventual
  consistency of containers and objects after discrete updates
  to content-type and mutable metadata, and that container-sync
  sync's objects after fast-post updates.

[1] spec change-id: I60688efc3df692d3a39557114dca8c5490f7837e

Change-Id: Ia597cd460bb5fd40aa92e886e3e18a7542603d01
2016-03-03 14:25:10 +00:00
Jenkins
a2405e99af Merge "Add functional test for access control (RBAC) with Keystone" 2016-02-11 15:07:39 +00:00
Alistair Coles
87fc21c7cf Speed up functional testing
test/functional/tests.py:TestObjectVersioningUTF8 does not clean
up the versions files it creates because the class's multiple
inheritance is such that it does not call the tearDown method in
TestObjectVersioning.

As a result, any attempt to clean up account containers wastes
time retrying container delete requests. This occurs either in
the setUp for TestSloEnv, if the TestSlo class is included in a
test run, or in the tests.py package tearDown method.

On the author's dev machine this patch reduces the execution
time of functional tests in tests.py by approx 30% or 1 minute.

Change-Id: I8194672bf2ca82435df5868720b6a55a79b94413
2016-02-08 15:56:20 +00:00
Tim Burke
fc9a3852e4 Don't .lower() a literal
It feels silly, and we don't do it for any of the other headers in
headers_to_container_info.

While we're at it, clean up a stray '

Change-Id: I0745038cc3832a77d064e515c37cacbdcb97c4d9
Related-Change: Iea3d06de80210e9e504e296d4572583d7ffabeac
2016-01-25 09:28:19 -08:00
Hisashi Osanai
09b188f03c Add functional test for access control (RBAC) with Keystone
This patch adds test cases for PUT, DELETE, GET, HEAD, POST and OPTIONS
requests to accounts, containers and objects using various combinations
of users/projects, roles and/or service tokens.

Change-Id: Iea8141ac74ad949a3ae7fa47fda3135d0f2612f6
2016-01-19 01:08:36 +00:00
Jonathan Hinson
4ffc4ba411 Functional tests for if-match with multiple etags
Multiple etags can be provided on an if-match or if-none-match
request. This is currently being tested in the unit tests, but not
in the functional tests. Since these etags can be modified by
middleware, we need functional tests to assert multiple-etag
requests are handled correctly.

Change-Id: Idc409c85e8aa82b59dc2bc28af6ca2617de82699
2016-01-12 14:26:38 -06:00
Timur Alperovich
432e280aef Correctly handle keys starting with the delimiter.
When processing keys where the names start with the delimiter
character, swift should list only the delimiter character. To get the
list of nested keys, the caller should also supply the prefix which is
equal to the delimiter.

Added a functional test and unit tests to verify this behavior.

Fixes Bug: 1475018

Change-Id: I27701a31bfa22842c272b7781738e8c546b82cbc
2016-01-06 12:29:20 -08:00
Jenkins
d0f5e38f84 Merge "Pass HTTP_REFERER down to subrequests" 2015-12-18 03:04:55 +00:00
Matthew Oliver
87f7e907ee Pass HTTP_REFERER down to subrequests
Currently a HTTP_REFERER (Referer) header isn't passed down to
subrequests. This means *LO subrequests to segment containers
return a 403 on a *LO GET when accessed by requests using referer
ACLs.
Currently the only way around referer access to *LO's is to make the
segments container world readable.

This change makes sure the referer header is passed into subrequests
allowing a segments container to only need to be locked down with
the same referer as the *LO container.

This is a 1 line change to code, but also adds a unit and 2 functional
functional tests (one for DLO and one for SLO).

Change-Id: I1fa5328979302d9c8133aa739787c8dae6084f54
Closes-Bug: #1526575
2015-12-17 14:28:40 +00:00
Alistair Coles
169a7c7f9e Fix func test --until-failure and --no-discover options
This patch changes functional test classes to subclass
unittest2.TestCase rather than unittest.TestCase.
This fixes errors when attempting to use

tox -e func -- -n <test_path_including_test_method>

and

tox -e func -- --until-failure

Also migrate from using nose.SkipTest to unittest2.SkipTest

Change-Id: I903033f5e01833550b2f2b945894edca4233c4a2
Closes-Bug: 1526725
Co-Authored-By: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
2015-12-16 15:28:25 +00:00
Richard Hawkins
9d7f71d575 Modify functional tests to use ostestr/testr
Defcore uses Tempest, which uses Test Repository.
This change makes it easier for Defcore to pull functional
tests from Swift and run them.  Additionally, using testr
allows tests to be run in parallel.

Concurrency set to 1 for now, >1 causes failures for
reasons that are still TBD.

With switch to ostestr all the server logs are being sent to stdout
which makes it completely unreadable. Suppressing the logs by default
now with a flag to enable it if desired.

Co-Authored-By: John Dickinson <me@not.mn>
Co-Authored-By: Robert Collins <rbtcollins@hpe.com>
Co-Authored-By: Matthew Oliver <matt@oliver.net.au>
Co-Authored-By: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>

Change-Id: I53ef4a116996a772cf1f3abc2eb0ad60047322d5
Related-Bug: 1177924
2015-12-15 22:30:44 +00:00
Christian Schwede
73ded056af Add functional test for repeated SLO segments
Currently fails on master, passes with change
If13af444ed301ebd8fd34a0d96a330ded648f0c4 applied.

Change-Id: I05b231cc232d5b4117bccee40eebc7093114c61c
2015-12-02 07:58:20 +00:00
Alistair Coles
6c43bdc82b Test for content-type params in multi-range response
Updates the functional test to verify the fix applied by
change Iff7274aa631a92cd7332212ed8b4378c27da4a1f

Change-Id: Iae63ac027e4f4acfe46a36dc1325888b1f834ea4
2015-11-26 14:57:16 +00:00
Samuel Merritt
b339e529c3 Add functional test for multi-range GET requests.
Change-Id: I9d417faede707e4f3570074e410344cc8955007b
2015-11-26 14:47:16 +00:00
Jenkins
72ea23f590 Merge "Add more functional tests for reverse listings" 2015-11-26 04:40:02 +00:00
Jenkins
f48c6f508e Merge "Add container and account reverse listings" 2015-11-24 17:54:57 +00:00
Alistair Coles
aeccbc2074 Add more functional tests for reverse listings
Also fix typo in the api doc.

Follow-on to change I5eb655360ac95042877da26d18707aebc11c02f6

Change-Id: Ic1ea63c74a0a3b90a505865fba8fcfac584d0825
2015-11-24 17:13:47 +00:00
Matthew Oliver
7c1e6cd583 Add container and account reverse listings
This change adds the ability to tell the container or account server to
reverse their listings. This is done by sending a reverse=TRUE_VALUE,

Where TRUE_VALUE is one of the values true can be in common/utils:

  TRUE_VALUES = set(('true', '1', 'yes', 'on', 't', 'y'))

For example:

  curl -i -X GET -H "X-Auth-Token: $TOKEN" $STORAGE_URL/c/?reverse=on

I borrowed the swapping of the markers code from Kevin's old change,
thanks Kevin. And Tim Burke added some real nuggets of awesomeness.

DocImpact
Co-Authored-By: Kevin McDonald <kmcdonald@softlayer.com>
Co-Authored-By: Tim Burke <tim.burke@gmail.com>
Implements: blueprint reverse-object-listing

Change-Id: I5eb655360ac95042877da26d18707aebc11c02f6
2015-11-24 15:08:45 +00:00
Samuel Merritt
c0866ceaac Improve SLO PUT error checking
This commit tries to give the user a reason that their SLO manifest
was invalid instead of just saying "Invalid SLO Manifest File". It
doesn't get every error condition, but it's better than before.

Examples of things that now have real error messages include:
 * bad keys in manifest (e.g. using "name" instead of "path")
 * bogus range (e.g. "bytes=123-taco")
 * multiple ranges (e.g. "bytes=10-20,30-40")
 * bad JSON structure (i.e. not a list of objects)
 * non-integer size_bytes

Also fixed an annoyance with unspecified-size segments that are too
small. Previously, if you uploaded a segment reference with
'{"size_bytes": null, ...}' in it and the referenced segment was less
than 1 MiB, you'd get a response that looked like this:

    HTTP/1.1 400 Bad Request
    Content-Length: 62
    Content-Type: text/html; charset=UTF-8
    X-Trans-Id: txd9ee3b25896642098e4d9-0055dd095a
    Date: Wed, 26 Aug 2015 00:33:30 GMT

    Each segment, except the last, must be at least 1048576 bytes.

This is true, but not particularly helpful, since it doesn't tell you
which of your segments violated the rule.

Now you get something more like this:

    HTTP/1.1 400 Bad Request
    Content-Length: 49
    Content-Type: text/plain
    X-Trans-Id: tx586e52580bac4956ad8e2-0055dd09c2
    Date: Wed, 26 Aug 2015 00:35:14 GMT

    Errors:
    /segs/small, Too Small; each segment, except the last...

It's not exactly a tutorial on SLO manifests, but at least it names
the problematic segment.

This also changes the status code for a self-referential manifest from
409 to 400. The rest of the error machinery was using 400, and
special-casing self-reference would be really annoying. Besides, now
that we're showing more than one error message at a time, what would
the right status code be for a manifest with a self-referential
segment *and* a segment with a bad range? 400? 409? 404.5? It's much
more consistent to just say invalid manifest --> 400.

Change-Id: I2275683230b36bc273319254e37c16b9e9b9d69c
2015-10-12 16:31:26 -07:00
janonymous
f5f9d791b0 pep8 fix: assertEquals -> assertEqual
assertEquals is deprecated in py3, replacing it.

Change-Id: Ida206abbb13c320095bb9e3b25a2b66cc31bfba8
Co-Authored-By: Ondřej Nový <ondrej.novy@firma.seznam.cz>
2015-10-11 12:57:25 +02:00
Victor Stinner
c0af385173 py3: Replace urllib imports with six.moves.urllib
The urllib, urllib2 and urlparse modules of Python 2 were reorganized
into a new urllib namespace on Python 3. Replace urllib, urllib2 and
urlparse imports with six.moves.urllib to make the modified code
compatible with Python 2 and Python 3.

The initial patch was generated by the urllib operation of the sixer
tool on: bin/* swift/ test/.

Change-Id: I61a8c7fb7972eabc7da8dad3b3d34bceee5c5d93
2015-10-08 15:24:13 +02:00
Victor Stinner
f2cac20d17 py3: Replace unicode with six.text_type
The unicode type was renamed to str in Python 3. Use six.text_type to
make the modified code compatible with Python 2 and Python 3.

The initial patch was generated by the unicode operation of the sixer
tool on: bin/* swift/ test/.

Change-Id: I9e13748ccde36ee8110756202d55d3ae945d4860
2015-10-08 13:16:43 +02:00
Tim Burke
25d5e686a1 Add the ability to specify ranges for SLO segments
Users can now include an optional 'range' field in segment descriptions
to specify which bytes from the underlying object should be used for the
segment data. Only one range may be specified per segment. Note that the
'etag' and 'size_bytes' fields still describe the backing object as a
whole. So, if a user uploads a manifest like:

    [{"path": "/con/obj_seg_1", "etag": null, "size_bytes": 1048576,
      "range": "0-1023"},
     {"path": "/con/obj_seg_2", "etag": null, "size_bytes": 1048576,
      "range": "512-4095"},
     {"path": "/con/obj_seg_1", "etag": null, "size_bytes": 1048576,
      "range": "-2048"}]

then the segment will consist of the first 1024 bytes of /con/obj_seg_1,
followed by bytes 513 through 4096 (inclusive) of /con/obj_seg_2, and
finally bytes 1046528 through 1048576 (i.e., the last 2048 bytes) of
/con/obj_seg_1.

ETag generation for SLOs had been updated to prevent collisions when
using different ranges for the same set of objects.

Additionally, there are two performance enhancements:

 * On download, multiple sequential requests for segments from the same
   underlying object will be coalesced into a single ranged request,
   provided it still does not meet Swift's "egregious range requests"
   critieria.

 * On upload, multiple sequential segments referencing the same object
   will be validated against the response from a single HEAD request.

Change-Id: Ia21d51c2cef4e2ee5162161dd2c1d3069009b52c
DocImpact
2015-09-23 09:23:39 -07:00