Project

General

Profile

dlo-byterange.txt

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

Download (2.71 KB)

 
1
Illustrating the ceph DLO/SLO byte range 
2

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

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

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

    
20
2.
21
	as root on the test host,
22
dnf install python-swiftclient
23

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

    
31
4. set, start python, initial configuration
32
python
33
import swiftclient.client
34
from os import environ
35

    
36
auth = environ.get('ST_AUTH')
37
auth_version = environ.get('ST_AUTH_VERSION', '1.0')
38
user = environ.get('ST_USER')
39
key = environ.get('ST_KEY')
40

    
41
container = "container"
42
myobj = "myobj"
43

    
44
3. connect to server
45

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

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

    
51
4. make container
52

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

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

    
60
e = swiftclient.client.put_object(url, token, container, myobj + "/00000001",
61
 "a short bit of text", http_conn = (parsed, c))
62
e
63
e = swiftclient.client.put_object(url, token, container, myobj + "/00000002",
64
 http_conn = (parsed, c))
65
e
66
e = swiftclient.client.put_object(url, token, container, myobj,
67
 headers={'X-Object-Manifest': container + "/" + myobj + "/"},
68
 http_conn = (parsed, c))
69
e
70
	# from here on, e values here will be etags: random strings.
71
	#	also rh, rc: rh headers, rc content.
72

    
73
5. try out a byte range.
74

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

    
77
rh,rc = swiftclient.client.get_object(url, token, container, myobj,
78
 http_conn = (parsed, c), headers=headers)
79
rh
80
rc
81

    
82
	error 416 is BAD.
83
	Should see: 
84
	rh = .. content length 14
85
	rc = 'rt bit of text'
86

    
87
9. cleanup - make all shiny and new
88
	at cmd line, with ST settings,
89
swift list
90
swift delete container
91
swift list
92

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