Project

General

Profile

Bug #17632 ยป dlo-byterange.txt

Marcus Watts, 10/20/2016 04:09 AM

 
Illustrating the ceph DLO/SLO byte range

I used a fedora host for running the tests (the "test host")
python-swift client not available in rhel7 or epel.
( not tested: virtualenv+pip should work. )
ceph and radosgw can be hosted on fedora | centos | whatever. (the "radosgw host")
I used an all in one setup, but the details shouldn't matter.

1. create creds.
as root on the radosgw host.
radosgw-admin user create --uid=janedoe --display-name="Jane Doe" \
--access-key=11BS02LGFB6AL6H1ADMW \
--secret=vzCEkuryfn060dfee4fgQPqFrncKEIkh3ZcdOANY

radosgw-admin subuser create --uid janedoe --subuser=swift \
--display-name 'Jane Doe, Swift' \
--secret='E9T2rUZNu2gxUjcwUBO8n/Ev4KX6/GprEuH4qhu1' \
--key-type swift --access=full

2.
as root on the test host,
dnf install python-swiftclient

3.
as myself, on the test host
(vary url etc to match your setup
export ST_AUTH="http://10.17.152.69/auth/1.0"
export ST_KEY='E9T2rUZNu2gxUjcwUBO8n/Ev4KX6/GprEuH4qhu1'
export ST_USER=janedoe:swift

4. set, start python, initial configuration
python
import swiftclient.client
from os import environ

auth = environ.get('ST_AUTH')
auth_version = environ.get('ST_AUTH_VERSION', '1.0')
user = environ.get('ST_USER')
key = environ.get('ST_KEY')

container = "container"
myobj = "myobj"

3. connect to server

url, token = swiftclient.client.get_auth(auth, user, key,
auth_version=auth_version)

parsed, c = swiftclient.client.http_connection(url)

4. make container

e = swiftclient.client.put_container(url, token, container,
http_conn = (parsed, c))
e
# e here should be nothing (on success)

4. make object with nz + z segment: match customer pattern.

e = swiftclient.client.put_object(url, token, container, myobj + "/00000001",
"a short bit of text", http_conn = (parsed, c))
e
e = swiftclient.client.put_object(url, token, container, myobj + "/00000002",
http_conn = (parsed, c))
e
e = swiftclient.client.put_object(url, token, container, myobj,
headers={'X-Object-Manifest': container + "/" + myobj + "/"},
http_conn = (parsed, c))
e
# from here on, e values here will be etags: random strings.
# also rh, rc: rh headers, rc content.

5. try out a byte range.

headers = {'Range': 'bytes=5-20'}

rh,rc = swiftclient.client.get_object(url, token, container, myobj,
http_conn = (parsed, c), headers=headers)
rh
rc

error 416 is BAD.
Should see:
rh = .. content length 14
rc = 'rt bit of text'

9. cleanup - make all shiny and new
at cmd line, with ST settings,
swift list
swift delete container
swift list

refs,
python-swiftclient-doc-3.0.0-1.fc24.noarch
file:///usr/share/doc/python-swiftclient-doc/html/swiftclient.html#module-swiftclient.utils
http://docs.openstack.org/developer/swift/overview_large_objects.html
https://bugs.launchpad.net/swift/+bug/1047658
    (1-1/1)