You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2014/05/27 14:55:19 UTC

git commit: Add new driver for Kili public cloud.

Repository: libcloud
Updated Branches:
  refs/heads/trunk 0452d98fd -> 4ffa70380


Add new driver for Kili public cloud.

Kili public cloud is a public cloud provider in Africa powered by
OpenStack.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4ffa7038
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4ffa7038
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4ffa7038

Branch: refs/heads/trunk
Commit: 4ffa70380ee76ecf0b4b3947d90b6e086085a44b
Parents: 0452d98
Author: Tomaz Muraus <to...@apache.org>
Authored: Tue May 27 14:21:55 2014 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue May 27 14:46:31 2014 +0200

----------------------------------------------------------------------
 CHANGES.rst                                     |  3 +
 .../_supported_methods_block_storage.rst        |  2 +
 .../_supported_methods_image_management.rst     |  2 +
 .../_supported_methods_key_pair_management.rst  |  2 +
 docs/compute/_supported_methods_main.rst        |  2 +
 docs/compute/_supported_providers.rst           |  2 +
 docs/compute/drivers/kili.rst                   | 35 ++++++++
 .../compute/openstack/kilicloud_native.py       | 10 +++
 libcloud/compute/drivers/kili.py                | 87 ++++++++++++++++++++
 libcloud/compute/providers.py                   |  2 +
 libcloud/compute/types.py                       |  1 +
 11 files changed, 148 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 8be428f..e1e0a39 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -159,6 +159,9 @@ Compute
   (GITHUB-299, LIBCLOUD-562)
   [Magnus Andersson]
 
+- Add new driver for Kili public cloud (http://kili.io/)
+  [Tomaz Muraus]
+
 Storage
 ~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/docs/compute/_supported_methods_block_storage.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_block_storage.rst b/docs/compute/_supported_methods_block_storage.rst
index 36aa971..1776d0a 100644
--- a/docs/compute/_supported_methods_block_storage.rst
+++ b/docs/compute/_supported_methods_block_storage.rst
@@ -39,6 +39,7 @@ Provider                              list volumes create volume destroy volume
 `IBM SmartCloud Enterprise`_          yes          yes           yes            yes           yes           no             no             
 `Ikoula`_                             yes          yes           yes            yes           yes           no             no             
 `Joyent`_                             no           no            no             no            no            no             no             
+`Kili Public Cloud`_                  yes          yes           yes            yes           yes           no             no             
 `KTUCloud`_                           yes          yes           yes            yes           yes           no             no             
 `Libvirt`_                            no           no            no             no            no            no             no             
 `Linode`_                             no           no            no             no            no            no             no             
@@ -101,6 +102,7 @@ Provider                              list volumes create volume destroy volume
 .. _`IBM SmartCloud Enterprise`: http://ibm.com/services/us/en/cloud-enterprise/
 .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack
 .. _`Joyent`: http://www.joyentcloud.com
+.. _`Kili Public Cloud`: http://kili.io/
 .. _`KTUCloud`: https://ucloudbiz.olleh.com/
 .. _`Libvirt`: http://libvirt.org/
 .. _`Linode`: http://www.linode.com/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/docs/compute/_supported_methods_image_management.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_image_management.rst b/docs/compute/_supported_methods_image_management.rst
index 5516774..0734374 100644
--- a/docs/compute/_supported_methods_image_management.rst
+++ b/docs/compute/_supported_methods_image_management.rst
@@ -39,6 +39,7 @@ Provider                              list images get image create image delete
 `IBM SmartCloud Enterprise`_          yes         no        yes          no           no        
 `Ikoula`_                             yes         no        no           no           no        
 `Joyent`_                             yes         no        no           no           no        
+`Kili Public Cloud`_                  yes         yes       yes          yes          no        
 `KTUCloud`_                           yes         no        no           no           no        
 `Libvirt`_                            no          no        no           no           no        
 `Linode`_                             yes         no        no           no           no        
@@ -101,6 +102,7 @@ Provider                              list images get image create image delete
 .. _`IBM SmartCloud Enterprise`: http://ibm.com/services/us/en/cloud-enterprise/
 .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack
 .. _`Joyent`: http://www.joyentcloud.com
+.. _`Kili Public Cloud`: http://kili.io/
 .. _`KTUCloud`: https://ucloudbiz.olleh.com/
 .. _`Libvirt`: http://libvirt.org/
 .. _`Linode`: http://www.linode.com/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/docs/compute/_supported_methods_key_pair_management.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_key_pair_management.rst b/docs/compute/_supported_methods_key_pair_management.rst
index 938ceeb..f474959 100644
--- a/docs/compute/_supported_methods_key_pair_management.rst
+++ b/docs/compute/_supported_methods_key_pair_management.rst
@@ -39,6 +39,7 @@ Provider                              list key pairs get key pair create key pai
 `IBM SmartCloud Enterprise`_          no             no           no              no                            no                          no             
 `Ikoula`_                             yes            yes          yes             yes                           no                          yes            
 `Joyent`_                             no             no           no              no                            no                          no             
+`Kili Public Cloud`_                  yes            yes          yes             yes                           no                          yes            
 `KTUCloud`_                           yes            yes          yes             yes                           no                          yes            
 `Libvirt`_                            no             no           no              no                            no                          no             
 `Linode`_                             no             no           no              no                            no                          no             
@@ -101,6 +102,7 @@ Provider                              list key pairs get key pair create key pai
 .. _`IBM SmartCloud Enterprise`: http://ibm.com/services/us/en/cloud-enterprise/
 .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack
 .. _`Joyent`: http://www.joyentcloud.com
+.. _`Kili Public Cloud`: http://kili.io/
 .. _`KTUCloud`: https://ucloudbiz.olleh.com/
 .. _`Libvirt`: http://libvirt.org/
 .. _`Linode`: http://www.linode.com/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/docs/compute/_supported_methods_main.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_main.rst b/docs/compute/_supported_methods_main.rst
index 3510369..5fab349 100644
--- a/docs/compute/_supported_methods_main.rst
+++ b/docs/compute/_supported_methods_main.rst
@@ -39,6 +39,7 @@ Provider                              list nodes create node reboot node destroy
 `IBM SmartCloud Enterprise`_          yes        yes         yes         yes          yes         yes        no         
 `Ikoula`_                             yes        yes         yes         yes          yes         yes        yes        
 `Joyent`_                             yes        yes         yes         yes          yes         yes        yes        
+`Kili Public Cloud`_                  yes        yes         yes         yes          yes         yes        yes        
 `KTUCloud`_                           yes        yes         yes         yes          yes         yes        yes        
 `Libvirt`_                            yes        no          yes         yes          no          no         no         
 `Linode`_                             yes        yes         yes         yes          yes         yes        yes        
@@ -101,6 +102,7 @@ Provider                              list nodes create node reboot node destroy
 .. _`IBM SmartCloud Enterprise`: http://ibm.com/services/us/en/cloud-enterprise/
 .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack
 .. _`Joyent`: http://www.joyentcloud.com
+.. _`Kili Public Cloud`: http://kili.io/
 .. _`KTUCloud`: https://ucloudbiz.olleh.com/
 .. _`Libvirt`: http://libvirt.org/
 .. _`Linode`: http://www.linode.com/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/docs/compute/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_providers.rst b/docs/compute/_supported_providers.rst
index 0528390..53c7099 100644
--- a/docs/compute/_supported_providers.rst
+++ b/docs/compute/_supported_providers.rst
@@ -39,6 +39,7 @@ Provider                              Documentation
 `IBM SmartCloud Enterprise`_                                                       IBM                 :mod:`libcloud.compute.drivers.ibm_sce`        :class:`IBMNodeDriver`              
 `Ikoula`_                             :doc:`Click </compute/drivers/ikoula>`       IKOULA              :mod:`libcloud.compute.drivers.ikoula`         :class:`IkoulaNodeDriver`           
 `Joyent`_                                                                          JOYENT              :mod:`libcloud.compute.drivers.joyent`         :class:`JoyentNodeDriver`           
+`Kili Public Cloud`_                  :doc:`Click </compute/drivers/kili>`         KILI                :mod:`libcloud.compute.drivers.kili`           :class:`KiliCloudNodeDriver`        
 `KTUCloud`_                                                                        KTUCLOUD            :mod:`libcloud.compute.drivers.ktucloud`       :class:`KTUCloudNodeDriver`         
 `Libvirt`_                            :doc:`Click </compute/drivers/libvirt>`      LIBVIRT             :mod:`libcloud.compute.drivers.libvirt_driver` :class:`LibvirtNodeDriver`          
 `Linode`_                                                                          LINODE              :mod:`libcloud.compute.drivers.linode`         :class:`LinodeNodeDriver`           
@@ -101,6 +102,7 @@ Provider                              Documentation
 .. _`IBM SmartCloud Enterprise`: http://ibm.com/services/us/en/cloud-enterprise/
 .. _`Ikoula`: http://express.ikoula.co.uk/cloudstack
 .. _`Joyent`: http://www.joyentcloud.com
+.. _`Kili Public Cloud`: http://kili.io/
 .. _`KTUCloud`: https://ucloudbiz.olleh.com/
 .. _`Libvirt`: http://libvirt.org/
 .. _`Linode`: http://www.linode.com/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/docs/compute/drivers/kili.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/kili.rst b/docs/compute/drivers/kili.rst
new file mode 100644
index 0000000..71a93e2
--- /dev/null
+++ b/docs/compute/drivers/kili.rst
@@ -0,0 +1,35 @@
+Kili Cloud Computer Driver Documentation
+========================================
+
+`Kili Cloud`_ is a public cloud provider based in Africa.
+
+Kili Cloud driver is based on the OpenStack one. For more information
+information and OpenStack specific documentation, please refer to
+:doc:`OpenStack Compute Driver Documentation <openstack>` page.
+
+Examples
+--------
+
+1. Instantiating the driver
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Unlike other OpenStack based providers, Kili cloud also requires you to specify
+tenant name when connecting to their cloud. You can do that by passing
+``tenant_name`` argument to the driver constructor as shown in the code example
+bellow.
+
+This attribute represents a company name you have entered while signing up for
+Kili.
+
+.. literalinclude:: /examples/compute/openstack/kilicloud_native.py
+   :language: python
+
+API Docs
+--------
+
+.. autoclass:: libcloud.compute.drivers.kili.KiliCloudNodeDriver
+    :members:
+    :inherited-members:
+
+.. _`Kili Cloud`: http://kili.io/
+.. _`Kili Cloud dashboard`: https://dash.kili.io

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/docs/examples/compute/openstack/kilicloud_native.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/openstack/kilicloud_native.py b/docs/examples/compute/openstack/kilicloud_native.py
new file mode 100644
index 0000000..2c83e12
--- /dev/null
+++ b/docs/examples/compute/openstack/kilicloud_native.py
@@ -0,0 +1,10 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+USERNAME = 'your account username'
+PASSWORD = 'your account password'
+TENANT_NAME = 'project name'
+
+cls = get_driver(Provider.KILI)
+driver = cls(USERNAME, PASSWORD, tenant_name=TENANT_NAME)
+print(driver.list_nodes())

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/libcloud/compute/drivers/kili.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/kili.py b/libcloud/compute/drivers/kili.py
new file mode 100644
index 0000000..de61067
--- /dev/null
+++ b/libcloud/compute/drivers/kili.py
@@ -0,0 +1,87 @@
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+HP Public cloud driver which is esentially just a small wrapper around
+OpenStack driver.
+"""
+
+from libcloud.compute.types import Provider, LibcloudError
+from libcloud.compute.drivers.openstack import OpenStack_1_1_Connection
+from libcloud.compute.drivers.openstack import OpenStack_1_1_NodeDriver
+
+__all__ = [
+    'KiliCloudNodeDriver'
+]
+
+ENDPOINT_ARGS = {
+    'service_type': 'compute',
+    'name': 'nova',
+    'region': 'RegionOne'
+}
+
+AUTH_URL = 'https://api.kili.io/keystone/v2.0/tokens'
+
+
+class KiliCloudConnection(OpenStack_1_1_Connection):
+    _auth_version = '2.0_password'
+
+    def __init__(self, *args, **kwargs):
+        self.region = kwargs.pop('region', None)
+        self.get_endpoint_args = kwargs.pop('get_endpoint_args', None)
+        super(KiliCloudConnection, self).__init__(*args, **kwargs)
+
+    def get_endpoint(self):
+        if not self.get_endpoint_args:
+            raise LibcloudError(
+                'KiliCloudConnection must have get_endpoint_args set')
+
+        if '2.0_password' in self._auth_version:
+            ep = self.service_catalog.get_endpoint(**self.get_endpoint_args)
+        else:
+            raise LibcloudError(
+                'Auth version "%s" not supported' % (self._auth_version))
+
+        public_url = ep.get('publicURL', None)
+
+        if not public_url:
+            raise LibcloudError('Could not find specified endpoint')
+
+        return public_url
+
+
+class KiliCloudNodeDriver(OpenStack_1_1_NodeDriver):
+    name = 'Kili Public Cloud'
+    website = 'http://kili.io/'
+    connectionCls = KiliCloudConnection
+    type = Provider.HPCLOUD
+
+    def __init__(self, key, secret, tenant_name, secure=True,
+                 host=None, port=None, **kwargs):
+        """
+        Note: tenant_name argument is required for Kili cloud.
+        """
+        self.tenant_name = tenant_name
+        super(KiliCloudNodeDriver, self).__init__(key=key, secret=secret,
+                                                  secure=secure, host=host,
+                                                  port=port,
+                                                  **kwargs)
+
+    def _ex_connection_class_kwargs(self):
+        kwargs = self.openstack_connection_kwargs()
+        kwargs['get_endpoint_args'] = ENDPOINT_ARGS
+        kwargs['ex_force_auth_url'] = AUTH_URL
+        kwargs['ex_tenant_name'] = self.tenant_name
+
+        return kwargs

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/libcloud/compute/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/providers.py b/libcloud/compute/providers.py
index 3de579c..87b3f32 100644
--- a/libcloud/compute/providers.py
+++ b/libcloud/compute/providers.py
@@ -81,6 +81,8 @@ DRIVERS = {
     ('libcloud.compute.drivers.rackspace', 'RackspaceFirstGenNodeDriver'),
     Provider.HPCLOUD:
     ('libcloud.compute.drivers.hpcloud', 'HPCloudNodeDriver'),
+    Provider.KILI:
+    ('libcloud.compute.drivers.kili', 'KiliCloudNodeDriver'),
     Provider.VPSNET:
     ('libcloud.compute.drivers.vpsnet', 'VPSNetNodeDriver'),
     Provider.LINODE:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4ffa7038/libcloud/compute/types.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py
index b2edf2d..9f7a308 100644
--- a/libcloud/compute/types.py
+++ b/libcloud/compute/types.py
@@ -124,6 +124,7 @@ class Provider(object):
 
     # OpenStack based providers
     HPCLOUD = 'hpcloud'
+    KILI = 'kili'
 
     # Deprecated constants which are still supported
     EC2_US_EAST = 'ec2_us_east'