Synnefo – Pithos – API: Incompatible with ‘Openstack object storage API’ for python-swiftclient – Openstack.

Synnefo Pithos declares, that a full compatible with ‘Openstack object storage API’. And what can be used with ANY cli client on this level (https://www.synnefo.org/docs/synnefo/latest/pithos.html).


…Pithos runs at the cloud layer and exposes the OpenStack Object Storage API to the outside
world, with custom extensions for syncing.
Any client speaking to OpenStack Swift can also be used to store objects
in a Pithos deployment…

It is lie in some cases ….

But by fact we see, that original python-swiftclient can’t work with Pithos installation. Merely due to different API of calls (https://www.synnefo.org/docs/synnefo/latest/object-api-guide.html#). 😉

Pithos requires next format of calls:


… The Pithos API
The URI requests supported by the Pithos API follow one of the following forms:
Account level: https://hostname/v1/account
Container level: https://hostname/v1/account/container
Object level: https://hostname/v1/account/container/object
All requests must include an X-Auth-Token – as a header, or a parameter.

Hewever, python-swoftclient (swift) doesn’t wants to send after number of version in URL – v1/account

For example, we use next call of swift cli

#!/bin/bash
export OS_USERNAME=39e4189d-7702-4380-986a-50bc47e6bb26
export OS_PASSWORD=...
export OS_AUTH_URL=https://astakos.skinefo.openstack.by:45544/astakos/identity/v2.0
swift -V 2 stat

In result, after authentication we will get from DB of Astakos(analog of keystone of Openstack) next PublicURL of object storage:

# snf-manage service-show 11
id       : 11
name     : pithos_object-store
component: pithos
type     : object-store

-------------------------------------------------------------------------------------
                                      Endpoints                                      
-------------------------------------------------------------------------------------
endpoint        key                                                             value
-------------------------------------------------------------------------------------
      11  versionId                                                                v1
      11  publicURL  https://pithos.skinefo.openstack.by:45545/pithos/object-store/v1

It is default installation and registration of pithos. And swiftclient will be use THIS url for request !!! Without a suffix – ‘account’. And in result will be an answer – 400 – BAD REQUEST.

[17/Aug/2016:15:58:16 +0300] V7RfaAo-AGYAAB-rDbkAAABS ... 40116 ... 45545
--4f5e1809-B--
HEAD /pithos/object-store/v1 HTTP/1.1
Host: pithos.skinefo.openstack.by:45545
Accept-Encoding: identity
X-Auth-Token: ...

--4f5e1809-F--
HTTP/1.1 400 BAD REQUEST
Content-Length: 81
Content-Language: en-us

If you will be still to want use a swift for access to pithos, you need to do small hack of code of swift. A namely in files – “/usr/lib/python2.7/site-packages/swiftclient/client.py”:

235 def get_keystoneclient_2_0(auth_url, user, key, os_options, **kwargs):
...                                                                                                                                                        
269     if service_type == 'object-store' and endpoint_type == 'publicURL':  << 
270             return (endpoint + '/' + user, _ksclient.auth_token)         <<
271     else:                                                                <<
272             return (endpoint, _ksclient.auth_token)

After of this, same request will return normal answer

--0ebfc948-A--
[18/Aug/2016:03:01:35 +0300] V7T63wo-AGYAADppBIgAAAAQ ... ... 45545
--0ebfc948-B--
HEAD /pithos/object-store/v1/39e4189d-7702-4380-986a-50bc47e6bb26 HTTP/1.1
Host: pithos.skinefo.openstack.by:45545
Accept-Encoding: identity
X-Auth-Token: ...

--0ebfc948-F--
HTTP/1.1 204 NO CONTENT
Content-Language: en-us
X-Account-Policy-Quota-39e4189d-7702-4380-986a-50bc47e6bb26: 1073741824
Vary: X-Auth-Token,Accept-Language
Expires: Thu, 18 Aug 2016 00:01:35 GMT
X-Account-Policy-Quota: 1073741824
Last-Modified: Fri, 12 Aug 2016 13:37:54 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
X-Account-Bytes-Used: 982077440
X-Account-Container-Count: 2
Content-Type: application/json; charset=UTF-8
StorageURL: https://pithos.skinefo.openstack.by:45545/pithos/object-store/v1/39e4189d-7702-4380-986a-50bc47e6bb26
Auth Token: ...
   Account: 39e4189d-7702-4380-986a-50bc47e6bb26
Containers: 2
   Objects: 0
     Bytes: 982077440
Content-Language: en-us
X-Account-Policy-Quota-39E4189D-7702-4380-986A-50Bc47E6Bb26: 1073741824
X-Account-Policy-Quota: 1073741824
   Expires: Thu, 18 Aug 2016 12:56:14 GMT
      Vary: X-Auth-Token,Accept-Language
    Server: gunicorn/0.14.5
Last-Modified: Fri, 12 Aug 2016 13:37:54 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Content-Type: application/json; charset=UTF-8
Scroll to top