2015-09-15 22:14:38 |
Felipe Reyes |
description |
If ceph-radosgw (which provides a Swift API for Ceph) is used instead of
Swift, simplestreams sync fail to create the simplestreams bucket.
I tried using the glance-simplestreams-sync charm, and got the following
error:
INFO * 07-22 14:05:30 [PID:3620] * swiftclient * REQ: curl -i http://10.96.
2.27:80/swift/simplestreams -X PUT -H "Content-Length: 0" -H "X-Auth-Token: a7f0
37d3245a4005834709b99e3e08f3" -H "X-Container-Read: .r:*,.rlistings"
INFO * 07-22 14:05:30 [PID:3620] * swiftclient * RESP STATUS: 405 Method No
t Allowed
INFO * 07-22 14:05:30 [PID:3620] * swiftclient * RESP HEADERS: [('date', 'T
ue, 22 Jul 2014 14:05:30 GMT'), ('accept-ranges', 'bytes'), ('content-type', 'ap
plication/json; charset=utf-8'), ('content-length', '27'), ('server', 'Apache/2.
4.7 (Ubuntu)')]
INFO * 07-22 14:05:30 [PID:3620] * swiftclient * RESP BODY: {"Code":"Method
NotAllowed"}
ERROR * 07-22 14:05:30 [PID:3620] * swiftclient * Container PUT failed: http
://10.96.2.27:80:80/swift/simplestreams 405 Method Not Allowed {"Code":"Method
NotAllowed"}
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1189, in _
retry
rv = func(self.url, self.token, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 674, in pu
t_container
http_response_content=body)
ClientException: Container PUT failed: http://10.96.2.27:80:80/swift/simplestrea
ms 405 Method Not Allowed {"Code":"MethodNotAllowed"}
ERROR * 07-22 14:05:30 [PID:3620] * root * Exception during do_sync
Traceback (most recent call last):
File "/etc/cron.daily/glance-simplestreams-sync.py", line 286, in <module>
do_sync(charm_conf)
File "/etc/cron.daily/glance-simplestreams-sync.py", line 140, in do_sync
store = SwiftObjectStore(SWIFT_DATA_DIR)
File "/usr/lib/python2.7/dist-packages/simplestreams/objectstores/swift.py", l
ine 70, in __init__
'.r:*,.rlistings'})
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1265, in p
ut_container
response_dict=response_dict)
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1189, in _
retry
rv = func(self.url, self.token, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 674, in pu
t_container
http_response_content=body)
ClientException: Container PUT failed: http://10.96.2.27:80:80/swift/simplestrea
ms 405 Method Not Allowed {"Code":"MethodNotAllowed"}
Note that it tries to PUT to http://10.96.2.27:80:80/swift/simplestreams, where
it should PUT to http://10.96.2.27:80:80/swift/v1/simplestreams. There seems
to be code in simplestreams that strip the version from the endpoint URL, but
even after I remove that I get a 409 error. |
[Impact]
This bug prevents from using simplestreams bucket creation, so new deployments
that want to benefit from the glance-simplestreams-sync charm to keep
up-to-date images in their private repos is broken.
[Test Case]
1) Deploy an OpenStack cloud
bzr branch lp:~freyes/+junk/lp1346935
cd lp1346935
juju deployer -c default-radosgw.yaml -d -v -s 10 SERIES-kilo # SERIES -> trusty or kilo depending on which package you're verifying
2) Once everything has settled down, run glance-simplestreams-sync.py
juju ssh glance-simplestreams-sync/0 sudo /var/lib/juju/agents/unit-glance-simplestreams-sync-0/charm/scripts/glance-simplestreams-sync.py
3) Check /var/log/glance-simplestreams-sync.log
tail -n 16 /var/log/glance-simplestreams-sync.log
4) Log before applying the fix:
ERROR * 09-15 19:15:15 [PID:10596] * root * Exception during do_sync
Traceback (most recent call last):
File "./glance-simplestreams-sync.py", line 286, in <module>
do_sync(charm_conf)
File "./glance-simplestreams-sync.py", line 140, in do_sync
store = SwiftObjectStore(SWIFT_DATA_DIR)
File "/usr/lib/python2.7/dist-packages/simplestreams/objectstores/swift.py", line 69, in __init__
'.r:*,.rlistings'})
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1319, in put_container
response_dict=response_dict)
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1243, in _retry
rv = func(self.url, self.token, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 731, in put_container
http_response_content=body)
ClientException: Container PUT failed: http://10.5.150.54:80/swift/simplestreams 405 Method Not Allowed {"Code":"MethodNotAllowed"}
INFO * 09-15 19:15:15 [PID:10596] * root * sync done.
5) Install the patched package
6) Re-run glance-simplestreams-sync.py (step 2)
7) Check glance-simplestreams-sync.log, log should look like:
DEBUG * 09-15 19:38:22 [PID:10789] * urllib3.connectionpool * "PUT /swift/v1/simplestreams HTTP/1.1" 201 0
DEBUG * 09-15 19:38:22 [PID:10789] * swiftclient * REQ: curl -i http://10.5.150.54:80/swift/v1/simplestreams -X PUT -H "Content-Length: 0" -H "X-Auth-Token: d2bb7d174eb84a4aa09fb27a0d06092f" -H "X-Container-Read: .r:*,.rlistings"
DEBUG * 09-15 19:38:22 [PID:10789] * swiftclient * RESP STATUS: 201 Created
DEBUG * 09-15 19:38:22 [PID:10789] * swiftclient * RESP HEADERS: [('content-length', '0'), ('accept-ranges', 'bytes'), ('keep-alive', 'timeout=5, max=100'), ('server', 'Apache/2.4.10 (Ubuntu)'), ('connection', 'Keep-Alive'), ('date', 'Tue, 15 Sep 2015 19:38:21 GMT'), ('content-type', 'text/plain; charset=utf-8')]
[Regression Potential]
- Minor, this patch is already integrated in Wily[0] and the change only gets rid
of the logic that removes the version from the endpoint.
- I tested this patch using a real swift endpoint and there is no regression
detected
[Other Info]
If ceph-radosgw (which provides a Swift API for Ceph) is used instead of
Swift, simplestreams sync fail to create the simplestreams bucket.
I tried using the glance-simplestreams-sync charm, and got the following
error:
INFO * 07-22 14:05:30 [PID:3620] * swiftclient * REQ: curl -i http://10.96.
2.27:80/swift/simplestreams -X PUT -H "Content-Length: 0" -H "X-Auth-Token: a7f0
37d3245a4005834709b99e3e08f3" -H "X-Container-Read: .r:*,.rlistings"
INFO * 07-22 14:05:30 [PID:3620] * swiftclient * RESP STATUS: 405 Method No
t Allowed
INFO * 07-22 14:05:30 [PID:3620] * swiftclient * RESP HEADERS: [('date', 'T
ue, 22 Jul 2014 14:05:30 GMT'), ('accept-ranges', 'bytes'), ('content-type', 'ap
plication/json; charset=utf-8'), ('content-length', '27'), ('server', 'Apache/2.
4.7 (Ubuntu)')]
INFO * 07-22 14:05:30 [PID:3620] * swiftclient * RESP BODY: {"Code":"Method
NotAllowed"}
ERROR * 07-22 14:05:30 [PID:3620] * swiftclient * Container PUT failed: http
://10.96.2.27:80:80/swift/simplestreams 405 Method Not Allowed {"Code":"Method
NotAllowed"}
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1189, in _
retry
rv = func(self.url, self.token, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 674, in pu
t_container
http_response_content=body)
ClientException: Container PUT failed: http://10.96.2.27:80:80/swift/simplestrea
ms 405 Method Not Allowed {"Code":"MethodNotAllowed"}
ERROR * 07-22 14:05:30 [PID:3620] * root * Exception during do_sync
Traceback (most recent call last):
File "/etc/cron.daily/glance-simplestreams-sync.py", line 286, in <module>
do_sync(charm_conf)
File "/etc/cron.daily/glance-simplestreams-sync.py", line 140, in do_sync
store = SwiftObjectStore(SWIFT_DATA_DIR)
File "/usr/lib/python2.7/dist-packages/simplestreams/objectstores/swift.py", l
ine 70, in __init__
'.r:*,.rlistings'})
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1265, in p
ut_container
response_dict=response_dict)
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1189, in _
retry
rv = func(self.url, self.token, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 674, in pu
t_container
http_response_content=body)
ClientException: Container PUT failed: http://10.96.2.27:80:80/swift/simplestrea
ms 405 Method Not Allowed {"Code":"MethodNotAllowed"}
Note that it tries to PUT to http://10.96.2.27:80:80/swift/simplestreams, where
it should PUT to http://10.96.2.27:80:80/swift/v1/simplestreams. There seems
to be code in simplestreams that strip the version from the endpoint URL, but
even after I remove that I get a 409 error.
[0] http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/simplestreams/wily/revision/18 |
|