libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbogorods...@apache.org
Subject svn commit: r1100118 - in /incubator/libcloud/trunk/libcloud: common/base.py compute/drivers/rackspace.py compute/providers.py compute/types.py
Date Fri, 06 May 2011 07:44:08 GMT
Author: rbogorodskiy
Date: Fri May  6 07:44:07 2011
New Revision: 1100118

URL: http://svn.apache.org/viewvc?rev=1100118&view=rev
Log:
Extend Rackspace driver to allow connection to custom OpenStack installations.

Modified:
    incubator/libcloud/trunk/libcloud/common/base.py
    incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py
    incubator/libcloud/trunk/libcloud/compute/providers.py
    incubator/libcloud/trunk/libcloud/compute/types.py

Modified: incubator/libcloud/trunk/libcloud/common/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/common/base.py?rev=1100118&r1=1100117&r2=1100118&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/common/base.py (original)
+++ incubator/libcloud/trunk/libcloud/common/base.py Fri May  6 07:44:07 2011
@@ -261,9 +261,14 @@ class ConnectionKey(object):
         @returns: A connection
         """
         host = host or self.host
-        port = port or self.port[self.secure]
 
-        kwargs = {'host': host, 'port': port}
+        # port might be included in service url, so pick it if it's present
+        if ":" in host:
+            host, port = host.split(":")
+        else:
+            port = port or self.port[self.secure]
+
+        kwargs = {'host': host, 'port': int(port)}
 
         connection = self.conn_classes[self.secure](**kwargs)
         # You can uncoment this line, if you setup a reverse proxy server

Modified: incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py?rev=1100118&r1=1100117&r2=1100118&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py Fri May  6 07:44:07 2011
@@ -552,3 +552,14 @@ class RackspaceUKNodeDriver(RackspaceNod
 
     def list_locations(self):
         return [NodeLocation(0, 'Rackspace UK London', 'UK', self)]
+
+class OpenStackConnection(RackspaceConnection):
+
+    def __init__(self, user_id, key, secure, host, port):
+        super(OpenStackConnection, self).__init__(user_id, key, secure=False)
+        self.auth_host = host
+        self.port = (port, port)
+
+class OpenStackNodeDriver(RackspaceNodeDriver):
+    name = 'OpenStack'
+    connectionCls = OpenStackConnection

Modified: incubator/libcloud/trunk/libcloud/compute/providers.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/providers.py?rev=1100118&r1=1100117&r2=1100118&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/providers.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/providers.py Fri May  6 07:44:07 2011
@@ -82,7 +82,9 @@ DRIVERS = {
     Provider.GANDI:
         ('libcloud.compute.drivers.gandi', 'GandiNodeDriver'),
     Provider.OPSOURCE:
-        ('libcloud.compute.drivers.opsource', 'OpsourceNodeDriver')
+        ('libcloud.compute.drivers.opsource', 'OpsourceNodeDriver'),
+    Provider.OPENSTACK:
+        ('libcloud.compute.drivers.rackspace', 'OpenStackNodeDriver'),
 }
 
 def get_driver(provider):

Modified: incubator/libcloud/trunk/libcloud/compute/types.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/types.py?rev=1100118&r1=1100117&r2=1100118&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/types.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/types.py Fri May  6 07:44:07 2011
@@ -88,6 +88,7 @@ class Provider(object):
     BLUEBOX = 28
     GANDI = 29
     OPSOURCE = 30
+    OPENSTACK = 31
 
 class NodeState(object):
     """



Mime
View raw message