libcloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From imered...@apache.org
Subject svn commit: r908315 - in /incubator/libcloud/trunk/libcloud: base.py drivers/dummy.py drivers/ec2.py drivers/gogrid.py drivers/linode.py drivers/rackspace.py drivers/rimuhosting.py drivers/slicehost.py drivers/vcloud.py drivers/vpsnet.py interface.py
Date Wed, 10 Feb 2010 01:59:49 GMT
Author: imeredith
Date: Wed Feb 10 01:59:48 2010
New Revision: 908315

URL: http://svn.apache.org/viewvc?rev=908315&view=rev
Log:
Added location=None to list_images and list_sizes for all drivers. Added the impl of that
for RimuHosting in list_sizes.

Modified:
    incubator/libcloud/trunk/libcloud/base.py
    incubator/libcloud/trunk/libcloud/drivers/dummy.py
    incubator/libcloud/trunk/libcloud/drivers/ec2.py
    incubator/libcloud/trunk/libcloud/drivers/gogrid.py
    incubator/libcloud/trunk/libcloud/drivers/linode.py
    incubator/libcloud/trunk/libcloud/drivers/rackspace.py
    incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py
    incubator/libcloud/trunk/libcloud/drivers/slicehost.py
    incubator/libcloud/trunk/libcloud/drivers/vcloud.py
    incubator/libcloud/trunk/libcloud/drivers/vpsnet.py
    incubator/libcloud/trunk/libcloud/interface.py

Modified: incubator/libcloud/trunk/libcloud/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/base.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/base.py (original)
+++ incubator/libcloud/trunk/libcloud/base.py Wed Feb 10 01:59:48 2010
@@ -521,7 +521,7 @@
         raise NotImplementedError, \
             'list_nodes not implemented for this driver'
 
-    def list_images(self):
+    def list_images(self, location=None):
         """
         List images on a provider
         @return: C{list} of L{NodeImage} objects
@@ -529,7 +529,7 @@
         raise NotImplementedError, \
             'list_images not implemented for this driver'
 
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         """
         List sizes on a provider
         @return: C{list} of L{NodeSize} objects

Modified: incubator/libcloud/trunk/libcloud/drivers/dummy.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/dummy.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/dummy.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/dummy.py Wed Feb 10 01:59:48 2010
@@ -72,14 +72,14 @@
         self.nl.remove(node)
         return True
 
-    def list_images(self):
+    def list_images(self, location=None):
         return [
             NodeImage(id=1, name="Ubuntu 9.10", driver=self),
             NodeImage(id=2, name="Ubuntu 9.04", driver=self),
             NodeImage(id=3, name="Slackware 4", driver=self),
         ]
 
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         return [
           NodeSize(id=1,
                    name="Small",

Modified: incubator/libcloud/trunk/libcloud/drivers/ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/ec2.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/ec2.py Wed Feb 10 01:59:48 2010
@@ -285,11 +285,11 @@
                     'reservationSet/item/instancesSet/item')
         return nodes
 
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         return [ NodeSize(driver=self.connection.driver, **i) 
                     for i in self._instance_types.values() ]
     
-    def list_images(self):
+    def list_images(self, location=None):
         params = {'Action': 'DescribeImages'}
         images = self._to_images(
             self.connection.request('/', params=params).object

Modified: incubator/libcloud/trunk/libcloud/drivers/gogrid.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/gogrid.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/gogrid.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/gogrid.py Wed Feb 10 01:59:48 2010
@@ -162,7 +162,7 @@
         return [ self._to_image(el)
                  for el in object['list'] ]
 
-    def list_images(self):
+    def list_images(self, location=None):
         images = self._to_images(
                     self.connection.request('/api/grid/image/list').object)
         return images
@@ -209,7 +209,7 @@
         object = self.connection.request("/api/grid/ip/list", params).object
         return object['list'][0]['ip']
 
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         return [ NodeSize(driver=self.connection.driver, **i) 
                     for i in self._instance_types.values() ]
 

Modified: incubator/libcloud/trunk/libcloud/drivers/linode.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/linode.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/linode.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/linode.py Wed Feb 10 01:59:48 2010
@@ -344,7 +344,7 @@
         data = self.connection.request(LINODE_ROOT, params=params).object
         return self._to_node(data[0])
 
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         # List Sizes
         # Retrieve all available Linode plans.
         # FIXME: Prices get mangled due to 'float'.
@@ -358,7 +358,7 @@
             sizes.append(n)
         return sizes
     
-    def list_images(self):
+    def list_images(self, location=None):
         # List Images
         # Retrieve all available Linux distributions.
         params = { "api_action": "avail.distributions" }

Modified: incubator/libcloud/trunk/libcloud/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/rackspace.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/rackspace.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/rackspace.py Wed Feb 10 01:59:48 2010
@@ -152,10 +152,10 @@
     def list_nodes(self):
         return self.to_nodes(self.connection.request('/servers/detail').object)
 
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         return self.to_sizes(self.connection.request('/flavors/detail').object)
 
-    def list_images(self):
+    def list_images(self, location=None):
         return self.to_images(self.connection.request('/images/detail').object)
 
     def list_locations(self):

Modified: incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py Wed Feb 10 01:59:48 2010
@@ -145,11 +145,16 @@
             name=image['distro_description'],
             driver=self.connection.driver)
         
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         # Returns a list of sizes (aka plans)
         # Get plans. Note this is really just for libcloud.
         # We are happy with any size.
-        res = self.connection.request('/pricing-plans;server-type=VPS').object
+        if location == None:
+            location = '';
+        else:
+            location = ";dc_location=%s" % (location.id)
+
+        res = self.connection.request('/pricing-plans;server-type=VPS%s' % (location)).object
         return map(lambda x : self._to_size(x), res['pricing_plan_infos'])
 
     def list_nodes(self):
@@ -158,9 +163,10 @@
         res = self.connection.request('/orders;include_inactive=N').object
         return map(lambda x : self._to_node(x), res['about_orders'])
     
-    def list_images(self):
+    def list_images(self, location=None):
         # Get all base images.
         # TODO: add other image sources. (Such as a backup of a VPS)
+        # All Images are available for use at all locations
         res = self.connection.request('/distributions').object
         return map(lambda x : self._to_image(x), res['distro_infos'])
 

Modified: incubator/libcloud/trunk/libcloud/drivers/slicehost.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/slicehost.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/slicehost.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/slicehost.py Wed Feb 10 01:59:48 2010
@@ -68,10 +68,10 @@
     def list_nodes(self):
         return self._to_nodes(self.connection.request('/slices.xml').object)
 
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         return self._to_sizes(self.connection.request('/flavors.xml').object)
 
-    def list_images(self):
+    def list_images(self, location=None):
         return self._to_images(self.connection.request('/images.xml').object)
 
     def list_locations(self):

Modified: incubator/libcloud/trunk/libcloud/drivers/vcloud.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/vcloud.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/vcloud.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/vcloud.py Wed Feb 10 01:59:48 2010
@@ -430,7 +430,7 @@
         )
         return ns
 
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         sizes = [self._to_size(i) for i in VIRTUAL_MEMORY_VALS]
         return sizes
 
@@ -464,7 +464,7 @@
 
         return res
 
-    def list_images(self):
+    def list_images(self, location=None):
         images = []
         for vdc in self.vdcs:
             res = self.connection.request(vdc).object

Modified: incubator/libcloud/trunk/libcloud/drivers/vpsnet.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/vpsnet.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/vpsnet.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/vpsnet.py Wed Feb 10 01:59:48 2010
@@ -148,7 +148,7 @@
         node = self._to_node(res.object['virtual_machine'])
         return True
     
-    def list_sizes(self):
+    def list_sizes(self, location=None):
         res = self.connection.request('/nodes.%s' % (API_VERSION,))
         available_nodes = len([size for size in res.object 
                             if not size['slice']["virtual_machine_id"]])
@@ -165,7 +165,7 @@
         res = self.connection.request('/virtual_machines.%s' % (API_VERSION,))
         return [self._to_node(i['virtual_machine']) for i in res.object] 
 
-    def list_images(self):
+    def list_images(self, location=None):
         res = self.connection.request('/available_clouds.%s' % (API_VERSION,))
 
         images = []

Modified: incubator/libcloud/trunk/libcloud/interface.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/interface.py?rev=908315&r1=908314&r2=908315&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/interface.py (original)
+++ incubator/libcloud/trunk/libcloud/interface.py Wed Feb 10 01:59:48 2010
@@ -160,12 +160,12 @@
         Returns a list of nodes for this provider
         """
 
-    def list_images():
+    def list_images(location=None):
         """
         Returns a list of images for this provider
         """
 
-    def list_sizes():
+    def list_sizes(location=None):
         """
         Returns a list of sizes for this provider
         """



Mime
View raw message