libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject git commit: LIBCLOUD-560: Add support for new resourcetypes in the 4.3 version of Cloudstack's listResourceLimits response
Date Thu, 22 May 2014 14:54:35 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 0a08bc6e1 -> de69f0428


LIBCLOUD-560: Add support for new resourcetypes in the 4.3 version of Cloudstack's listResourceLimits
response

Closes #298

Signed-off-by: Tomaz Muraus <tomaz@apache.org>


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

Branch: refs/heads/trunk
Commit: de69f0428ddc8b981623c464d23d5a65435562d9
Parents: 0a08bc6
Author: Chris DeRamus <chris@divvycloud.com>
Authored: Thu May 22 08:01:49 2014 -0400
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Thu May 22 15:44:09 2014 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudstack.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/de69f042/libcloud/compute/drivers/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py
index 0cd48e8..9af9995 100644
--- a/libcloud/compute/drivers/cloudstack.py
+++ b/libcloud/compute/drivers/cloudstack.py
@@ -1809,6 +1809,9 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
         CloudStack uses integers as the resource type so we will convert
         them to a more human readable string using the resource map
 
+        A list of the resource type mappings can be found at
+        http://goo.gl/17C6Gk
+
         :return: dict
         :rtype: ``dict``
         """
@@ -1825,11 +1828,18 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
             4: 'max_images',
             5: 'max_projects',
             6: 'max_networks',
-            7: 'max_vpc'
+            7: 'max_vpc',
+            8: 'max_cpu',
+            9: 'max_memory',
+            10: 'max_primary_storage',
+            11: 'max_secondary_storage'
         }
 
         for limit in result.get('resourcelimit', []):
-            resource = resource_map[int(limit['resourcetype'])]
+            # We will ignore unknown types
+            resource = resource_map.get(int(limit['resourcetype']), None)
+            if not resource:
+                continue
             limits[resource] = int(limit['max'])
 
         return limits


Mime
View raw message