Search code examples
python-2.7ibm-cloud-infrastructureobject-storage

Softlayer Object Storage Containers: Unable to find the server


Problem:

I'm trying to debug some of my code that uses Softlayer Object Storage however I kept getting some errors from SL itself. Since I was getting the error from SL I went ahead and tried writing some code that reproduces the error. Which can be seen below followed by the stack trace I get.

Question:

Does anyone know why I'm getting the below error besides the possible security prevention from spamming sl so many times?

Source Code:

#!/usr/local/bin/python2.7
import argparse
import object_storage

def main():
    parser = argparse.ArgumentParser(description='Spam multiple sl storage containers.')

    parser.add_argument("--username", type=str, required=True, help="softlayer username")
    parser.add_argument("--apikey", type=str, required=True, help="softlayer api key")
    parser.add_argument("--datacenter", type=str, required=True, help="softlayer datacenter")
    parser.add_argument("--count", type=int, required=True, help="Amount of times to iterate")

    args = parser.parse_args()
    username = args.username
    api_key = args.apikey
    datacenter = args.datacenter
    count = args.count

    for i in range(0, count):
        print "Trying to create sl_storage.containers() #{0}".format(i)
        sl_storage = object_storage.get_client(username, api_key, datacenter=datacenter)
        containers = sl_storage.containers()
        del containers
        del sl_storage

if __name__ == "__main__":
    main()

Stack Trace:

Traceback (most recent call last):
  File "/root/sl_test.py", line 32, in <module>
    main()
  File "/root/sl_test.py", line 27, in main
    containers = sl_storage.containers()
  File "/usr/local/lib/python2.7/site-packages/object_storage/client.py", line 293, in containers
    formatter=_formatter)
  File "/usr/local/lib/python2.7/site-packages/object_storage/client.py", line 354, in make_request
    result = self.conn.make_request(method, url, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/object_storage/transport/httplib2conn.py", line 55, in make_request
    response = _make_request(headers)
  File "/usr/local/lib/python2.7/site-packages/object_storage/transport/httplib2conn.py", line 48, in _make_request
    body=data)
  File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1659, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1399, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1325, in _conn_request
    raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
httplib2.ServerNotFoundError: Unable to find the server at dal05.objectstorage.softlayer.net

Opened up an issues against softlayer-object_storage python package here https://github.com/softlayer/softlayer-object-storage-python/issues/50


Solution

  • First: I think you should have opened the issue here:

    https://github.com/softlayer/softlayer-object-storage-python

    second: I do not think this is an issue for me this is working fine, the error probably is due to you do not have any storage in dal05, you can verify that in the control portal by going https://control.softlayer.com/storage/objectstorage and make sure that there are containers in the dal05.

    third: the client that you are using only works for swift storages, it does not work for S3 containers