libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [2/3] git commit: LIBCLOUD-509: Add extra dictionary to the NodeSize object within the base compute API. This will allow additional properties specific to providers to be stored within the object. The GCE driver was updated and the addition of the # of C
Date Mon, 03 Feb 2014 15:06:36 GMT
LIBCLOUD-509: Add extra dictionary to the NodeSize object within the base compute API. This
will allow additional properties specific to providers to be stored within the object. The
GCE driver was updated and the addition of the # of CPUs was added into the CloudStack driver.

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/bee946e2
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bee946e2
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bee946e2

Branch: refs/heads/trunk
Commit: bee946e28f0f7d79bc30f283ac1c6180adf5d230
Parents: cf1930c
Author: Chris DeRamus <chris@divvycloud.com>
Authored: Sun Feb 2 13:44:53 2014 -0500
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Mon Feb 3 15:53:33 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/base.py               | 8 +++++++-
 libcloud/compute/drivers/cloudstack.py | 3 ++-
 libcloud/compute/drivers/gce.py        | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/bee946e2/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 5e09650..46cdefe 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -272,7 +272,8 @@ class NodeSize(UuidMixin):
     4
     """
 
-    def __init__(self, id, name, ram, disk, bandwidth, price, driver):
+    def __init__(self, id, name, ram, disk, bandwidth, price,
+                 driver, extra=None):
         """
         :param id: Size ID.
         :type id: ``str``
@@ -294,6 +295,10 @@ class NodeSize(UuidMixin):
 
         :param driver: Driver this image belongs to.
         :type driver: :class:`.NodeDriver`
+
+        :param extra: Optional provider specific attributes associated with
+                      this node.
+        :type  extra: ``dict``
         """
         self.id = str(id)
         self.name = name
@@ -302,6 +307,7 @@ class NodeSize(UuidMixin):
         self.bandwidth = bandwidth
         self.price = price
         self.driver = driver
+        self.extra = extra or {}
         UuidMixin.__init__(self)
 
     def __repr__(self):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/bee946e2/libcloud/compute/drivers/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py
index f7e1847..a48ce81 100644
--- a/libcloud/compute/drivers/cloudstack.py
+++ b/libcloud/compute/drivers/cloudstack.py
@@ -589,8 +589,9 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
                                  method='GET')
         sizes = []
         for sz in szs['serviceoffering']:
+            extra = {'cpu': sz['cpunumber']}
             sizes.append(NodeSize(sz['id'], sz['name'], sz['memory'], 0, 0,
-                                  0, self))
+                                  0, self, extra=extra))
         return sizes
 
     def create_node(self, **kwargs):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/bee946e2/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 84bf7a2..69dfb44 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -259,7 +259,7 @@ class GCENodeSize(NodeSize):
                  extra=None):
         self.extra = extra
         super(GCENodeSize, self).__init__(id, name, ram, disk, bandwidth,
-                                          price, driver)
+                                          price, driver, extra=extra)
 
 
 class GCEProject(UuidMixin):


Mime
View raw message