Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Compute
    • Labels:
      None

      Description

      OpenStack compute driver APIs fail.

      I can not run openstack examples under docs/examples/compute. After updating with credentials (user/password) and setting ex_force_auth_url to point to my keystone service of my latest devstack, it immediately fail on every API call (e.g. driver.list_images, driver.list_sizes, ..):

      Traceback (most recent call last):
        File "docs/examples/compute/openstack/tenant_name.py", line 10, in <module>
          print driver.list_sizes()
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/compute/drivers/openstack.py", line 283, in list_sizes
          self.connection.request('/flavors/detail').object)
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/openstack.py", line 200, in request
          raw=raw)
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/base.py", line 738, in request
          headers=headers)
        File "/usr/lib/python2.7/httplib.py", line 973, in request
          self._send_request(method, url, body, headers)
        File "/usr/lib/python2.7/httplib.py", line 1007, in _send_request
          self.endheaders(body)
        File "/usr/lib/python2.7/httplib.py", line 969, in endheaders
          self._send_output(message_body)
        File "/usr/lib/python2.7/httplib.py", line 829, in _send_output
          self.send(msg)
        File "/usr/lib/python2.7/httplib.py", line 791, in send
          self.connect()
        File "/usr/lib/python2.7/httplib.py", line 772, in connect
          self.timeout, self.source_address)
        File "/usr/lib/python2.7/socket.py", line 556, in create_connection
          for res in getaddrinfo(host, port, 0, SOCK_STREAM):
      socket.error: getaddrinfo() argument 2 must be integer or string
      

      I can see that the port is being parsed into a unicode type and I assume that this is the reason create_connection of socket.py fails.

      When running it in debug mode (e.g. LIBCLOUD_DEBUG=/dev/stderr LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE=1 python docs/examples/compute/openstack/tenant_name.py)
      then it fails with the following exception:

      Traceback (most recent call last):
        File "docs/examples/compute/openstack/tenant_name.py", line 10, in <module>
          print driver.list_sizes()
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/compute/drivers/openstack.py", line 283, in list_sizes
          self.connection.request('/flavors/detail').object)
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/openstack.py", line 200, in request
          raw=raw)
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/base.py", line 674, in request
          action = self.morph_action_hook(action)
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/openstack.py", line 255, in morph_action_hook
          self._populate_hosts_and_request_paths()
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/openstack.py", line 288, in _populate_hosts_and_request_paths
          osa = osa.authenticate(**kwargs)  # may throw InvalidCreds
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/openstack_identity.py", line 841, in authenticate
          return self._authenticate_2_0_with_password()
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/openstack_identity.py", line 866, in _authenticate_2_0_with_password
          return self._authenticate_2_0_with_body(reqbody)
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/openstack_identity.py", line 871, in _authenticate_2_0_with_body
          method='POST')
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/base.py", line 738, in request
          headers=headers)
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/base.py", line 440, in request
          self._log_curl(method, url, body, headers) + "\n")
        File "/.my-virtenv/local/lib/python2.7/site-packages/apache_libcloud-0.17.1.dev0-py2.7.egg/libcloud/common/base.py", line 390, in _log_curl
          self.port, url))])
      TypeError: %d format: a number is required, not str
      

      _log_curl expects the port to be an int.

        Activity

        Hide
        aviweit Avi Weit added a comment -

        From looking into the code, I get the impression that ports are integers.

        I will soon provide a PR with a fix suggestion that is working for me.

        Show
        aviweit Avi Weit added a comment - From looking into the code, I get the impression that ports are integers. I will soon provide a PR with a fix suggestion that is working for me.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user aviweit opened a pull request:

        https://github.com/apache/libcloud/pull/533

        LIBCLOUD-716 Fix port type error

        Fixes issue: https://issues.apache.org/jira/browse/LIBCLOUD-716

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/aviweit/libcloud jira_716_openstack_port

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/libcloud/pull/533.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #533


        commit ad1944949625804209ab6cc4728a5d5fc7e00306
        Author: Avi Weit <weit@il.ibm.com>
        Date: 2015-06-03T11:22:45Z

        LIBCLOUD-716 Fix port type error


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user aviweit opened a pull request: https://github.com/apache/libcloud/pull/533 LIBCLOUD-716 Fix port type error Fixes issue: https://issues.apache.org/jira/browse/LIBCLOUD-716 You can merge this pull request into a Git repository by running: $ git pull https://github.com/aviweit/libcloud jira_716_openstack_port Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/533.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #533 commit ad1944949625804209ab6cc4728a5d5fc7e00306 Author: Avi Weit <weit@il.ibm.com> Date: 2015-06-03T11:22:45Z LIBCLOUD-716 Fix port type error
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 590c7197ab073f5b2145f02ae7115396ccdbf008 in libcloud's branch refs/heads/trunk from Avi Weit
        [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=590c719 ]

        LIBCLOUD-716 Fix port type error.

        Closes #533

        Signed-off-by: Tomaz Muraus <tomaz@tomaz.me>

        Show
        jira-bot ASF subversion and git services added a comment - Commit 590c7197ab073f5b2145f02ae7115396ccdbf008 in libcloud's branch refs/heads/trunk from Avi Weit [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=590c719 ] LIBCLOUD-716 Fix port type error. Closes #533 Signed-off-by: Tomaz Muraus <tomaz@tomaz.me>
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user aviweit closed the pull request at:

        https://github.com/apache/libcloud/pull/533

        Show
        githubbot ASF GitHub Bot added a comment - Github user aviweit closed the pull request at: https://github.com/apache/libcloud/pull/533

          People

          • Assignee:
            Unassigned
            Reporter:
            aviweit Avi Weit
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development