使用apache libcloud连接到softlayer对象存储

时间:2018-01-02 22:49:57

标签: ibm-cloud python-3.6 ibm-cloud-infrastructure object-storage libcloud

问题:

尝试使用apache libcloud连接到Softlayer Swift对象存储,我无法使其工作。我已经尝试将不同的选项传递给提供者,但无论我传递什么,我都会得到同样的错误。我将非常感谢帮助我解决这个问题的所有指示。

代码:

from pprint import pprint
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver

_swift = get_driver(Provider.OPENSTACK_SWIFT)
_authurl = "https://lon02.objectstorage.softlayer.net/auth/v1.0"
_user = "IBMOS<redacted>"
_key = "redacted"

driver = _swift(_user, _key,
                region='lon02',
                ex_force_auth_url=_authurl,
                ex_force_auth_version='1.0',
                ex_force_service_type='object-store',
                ex_force_service_name='cloudFiles')


#pprint(driver.__dict__)
pprint(driver.list_containers())

堆栈追踪:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 441, in wrap_socket
    cnx.do_handshake()
  File "/usr/local/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1806, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/usr/local/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1539, in _raise_ssl_error
    raise SysCallError(-1, "Unexpected EOF")
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 448, in wrap_socket
    raise ssl.SSLError('bad handshake: %r' % e)
ssl.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='lon02.objectstorage.softlayer.net', port=443): Max retries exceeded with url: /auth/v1.0 (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "swift.py", line 19, in <module>
    pprint(driver.list_containers())
  File "/usr/local/lib/python3.6/site-packages/libcloud/storage/base.py", line 209, in list_containers
    return list(self.iterate_containers())
  File "/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py", line 275, in iterate_containers
    response = self.connection.request('')
  File "/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py", line 165, in request
    raw=raw)
  File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py", line 223, in request
    raw=raw)
  File "/usr/local/lib/python3.6/site-packages/libcloud/common/base.py", line 536, in request
    action = self.morph_action_hook(action)
  File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py", line 290, in morph_action_hook
    self._populate_hosts_and_request_paths()
  File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py", line 324, in _populate_hosts_and_request_paths
    osa = osa.authenticate(**kwargs)  # may throw InvalidCreds
  File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack_identity.py", line 761, in authenticate
    resp = self.request('/v1.0', headers=headers, method='GET')
  File "/usr/local/lib/python3.6/site-packages/libcloud/common/base.py", line 603, in request
    headers=headers, stream=stream)
  File "/usr/local/lib/python3.6/site-packages/libcloud/http.py", line 213, in request
    verify=self.verification
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='lon02.objectstorage.softlayer.net', port=443): Max retries exceeded with url: /auth/v1.0 (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))

1 个答案:

答案 0 :(得分:0)

要回答我自己的问题,上面看到的具体问题是由于我使用的系统。一旦我切换到另一个系统,它就会继续前进,但是我确定了一个错误,并在apache libcloud中提交了一个错误的文件,其中有一个记录在一起的解决方法https://issues.apache.org/jira/browse/LIBCLOUD-972