简体   繁体   English

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

[英]Connecting to softlayer object storage using apache libcloud

Problem: 问题:

Trying to connect to Softlayer Swift Object Storage using apache libcloud and I can't get it to work. 尝试使用apache libcloud连接到Softlayer Swift对象存储,但我无法正常工作。 I have tried passing in different options to the provider but no matter what I pass in I get the same error. 我尝试将不同的选项传递给提供程序,但是无论我传递什么,都会遇到相同的错误。 I would appreciate any and all pointers to help me resolve this issue. 我将不胜感激任何指针可以帮助我解决此问题。

Code: 码:

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())

Stack Trace: 堆栈跟踪:

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')",),))

To answer my own question, the specific issue seen above was due to the system I was using. 为了回答我自己的问题,上面看到的特定问题是由于我使用的系统造成的。 Once I switched to another system it proceeded even further however there is a bug I identified and filed in apache libcloud with a documented workaround inside the jira ticket here https://issues.apache.org/jira/browse/LIBCLOUD-972 . 一旦切换到另一个系统,它就会继续前进,但是我发现了一个错误,并将该错误提交给Apache libcloud,并在https://issues.apache.org/jira/browse/LIBCLOUD-972上提供了jira票证中已记录的变通办法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM