Libcloud
  1. Libcloud
  2. LIBCLOUD-255

Driver registration and handling improvements

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      The following are limitations that can come up while using libcloud in production - because of usage of C/C++ style ENUM based mechanism of registering drivers.

      1) In a s/w setup which supports multiple cloud environments (or local), the admin/dev must be able to change the driver via a conf file. For eg: storage_driver = 's3', key = 'abcd' etc. In the current mechanism, the mapping of the driver name to number must be done externally.
      2) There is no mechanism for dynamically registering a driver. It is quite possible that user's might have drivers which are for private cloud setups. They may want to install libcloud via PYPI, but use their own private drivers. Currently, there is no mechanism to do this without changing libcloud code.

      Also, IMHO, the C/C++ style enumerations need not be there in python.

      The solution for this is pretty simple to implement (given the good design of libcloud).
      1) Replace the enum numbers with strings. Given the usage of a dictionary for registering drivers, this will work out of the box.
      2) Implement a set_driver() API which can be used for registering new drivers.

      With this change, libcloud usage can be controlled externally (via a config file or a db field etc.) as the admin sees fit.

        Activity

        Hide
        Mahendra M added a comment -

        yeah sure. I forgot about that in my hurry to submit the patch

        Show
        Mahendra M added a comment - yeah sure. I forgot about that in my hurry to submit the patch
        Tomaz Muraus made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Tomaz Muraus [ kami ]
        Hide
        Tomaz Muraus added a comment -

        Patch merged into trunk - http://svn.apache.org/viewvc?view=revision&revision=1407676, thanks!

        Just a small advice for the next time - when writing tests for different scenarios, split them in different test cases (e.g. test_set_driver_success, test_set_driver_import_error, test_set_driver_invalid_driver).

        Show
        Tomaz Muraus added a comment - Patch merged into trunk - http://svn.apache.org/viewvc?view=revision&revision=1407676 , thanks! Just a small advice for the next time - when writing tests for different scenarios, split them in different test cases (e.g. test_set_driver_success, test_set_driver_import_error, test_set_driver_invalid_driver).
        Hide
        Mahendra M added a comment -

        Cool. Also I have ensured that all the test cases passed

        Show
        Mahendra M added a comment - Cool. Also I have ensured that all the test cases passed
        Hide
        Tomaz Muraus added a comment -

        You are right, ignore my previous comment.

        I will work on getting it reviewed and merged later today. Thanks!

        Show
        Tomaz Muraus added a comment - You are right, ignore my previous comment. I will work on getting it reviewed and merged later today. Thanks!
        Hide
        Mahendra M added a comment -

        Actually, this patch does not break backwards compatibility. The old API will work as-is. The only thing that changes is that the constants are strings instead of numbers. Anyone who uses the constants will not notice the changes.

        Do let me know your thoughts.

        Show
        Mahendra M added a comment - Actually, this patch does not break backwards compatibility. The old API will work as-is. The only thing that changes is that the constants are strings instead of numbers. Anyone who uses the constants will not notice the changes. Do let me know your thoughts.
        Hide
        Tomaz Muraus added a comment -

        Another great patch.

        We should have changed this a long time ago, but we were keep pushing it back.

        I would like to minimize backward incompatible changes and because next release is already going to contain a couple I would like to support old-style constants for at least a couple of releases.

        Show
        Tomaz Muraus added a comment - Another great patch. We should have changed this a long time ago, but we were keep pushing it back. I would like to minimize backward incompatible changes and because next release is already going to contain a couple I would like to support old-style constants for at least a couple of releases.
        Mahendra M made changes -
        Field Original Value New Value
        Attachment libcloud-255.patch [ 12552460 ]
        Mahendra M created issue -

          People

          • Assignee:
            Tomaz Muraus
            Reporter:
            Mahendra M
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development