Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-205

Cloud Files Storage driver doesn't work for accounts with DFW endpoints

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.10.1
    • Fix Version/s: 0.11.0
    • Component/s: Storage
    • Labels:
      None
    • Environment:

      OS X 10.7.4, Python 2.7.1

      Description

      The Cloud Files storage driver assumes the service catalog will have an endpoint for ORD. Some Cloud Files accounts have endpoints in DFW instead of ORD. Trying to list containers gives the following error for those accounts:

      File "/Users/ggreer/code/libcloud/libcloud/storage/drivers/cloudfiles.py", line 229, in list_containers
      response = self.connection.request('')
      File "/Users/ggreer/code/libcloud/libcloud/storage/drivers/cloudfiles.py", line 149, in request
      self._populate_hosts_and_request_paths()
      File "/Users/ggreer/code/libcloud/libcloud/common/openstack.py", line 471, in _populate_hosts_and_request_paths
      (self.host, self.port, self.secure, self.request_path) = self._tuple_from_url(self._ex_force_base_url or self.get_endpoint())
      File "/Users/ggreer/code/libcloud/libcloud/storage/drivers/cloudfiles.py", line 136, in get_endpoint
      raise LibcloudError('Could not find specified endpoint')
      libcloud.common.types.LibcloudError: <LibcloudError in None 'Could not find specified endpoint'>

      1. example_storage.py
        0.4 kB
        Geoff Greer
      2. fix_cloud_files_with_tests.patch
        4 kB
        Geoff Greer
      3. fix_cloud_files.patch
        3 kB
        Geoff Greer
      4. response.json
        2 kB
        Geoff Greer

        Activity

        Hide
        angryparsley Geoff Greer added a comment -

        This patch fixes Cloud Files for users with DFW endpoints returned in the service catalog.

        Show
        angryparsley Geoff Greer added a comment - This patch fixes Cloud Files for users with DFW endpoints returned in the service catalog.
        Hide
        angryparsley Geoff Greer added a comment -

        Service catalog returned for my account.

        Show
        angryparsley Geoff Greer added a comment - Service catalog returned for my account.
        Hide
        angryparsley Geoff Greer added a comment -

        The python script I ran to produce the error.

        Show
        angryparsley Geoff Greer added a comment - The python script I ran to produce the error.
        Hide
        kami Tomaz Muraus added a comment -

        Some feedback:

        1. Python doesn't support method overloading so if we decide to go with this approach we need to remove the old get_endpoint method
        2. This potentially changes the behavior of the existing drivers (currently all the drivers explicitly specify a region) so I would do the following:

        • Change get_endpoint signature to get_endpoint(self, service_type=None, name=None) and make it return a first endpoint in the catalog - basically what you already do
        • Add new get_endpoint_for_region(self, service_type=None, name=None, region=None) method which does the same thing as the current get_endpoint implementation
        • Update all the existing drivers besides cloudfiles to preserve the current behavior and use get_endpoint_for_region
        • Add tests
        Show
        kami Tomaz Muraus added a comment - Some feedback: 1. Python doesn't support method overloading so if we decide to go with this approach we need to remove the old get_endpoint method 2. This potentially changes the behavior of the existing drivers (currently all the drivers explicitly specify a region) so I would do the following: Change get_endpoint signature to get_endpoint(self, service_type=None, name=None) and make it return a first endpoint in the catalog - basically what you already do Add new get_endpoint_for_region(self, service_type=None, name=None, region=None) method which does the same thing as the current get_endpoint implementation Update all the existing drivers besides cloudfiles to preserve the current behavior and use get_endpoint_for_region Add tests
        Hide
        kami Tomaz Muraus added a comment -

        Edit: Ignore my first point - like you have said on the IRC, existing method name is get_endpoints and not get_endpoint.

        In this case the patch looks good, only thing which is missing are tests.

        Show
        kami Tomaz Muraus added a comment - Edit: Ignore my first point - like you have said on the IRC, existing method name is get_endpoints and not get_endpoint. In this case the patch looks good, only thing which is missing are tests.
        Hide
        angryparsley Geoff Greer added a comment -

        Added tests to my patch.

        Show
        angryparsley Geoff Greer added a comment - Added tests to my patch.
        Hide
        kami Tomaz Muraus added a comment -

        Merged, thanks.

        Show
        kami Tomaz Muraus added a comment - Merged, thanks.

          People

          • Assignee:
            Unassigned
            Reporter:
            angryparsley Geoff Greer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development