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 2013/12/23 19:20:33 UTC

[4/5] git commit: Also pass "size" attribute to EC2ReservedNode constructor.

Also pass "size" attribute to EC2ReservedNode constructor.


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

Branch: refs/heads/trunk
Commit: 11abec495e0125cf037e468b2dbed70d5254a055
Parents: 49e2f3b
Author: Tomaz Muraus <to...@apache.org>
Authored: Mon Dec 23 19:16:46 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Mon Dec 23 19:16:46 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/ec2.py | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/11abec49/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index c7ab920..c9b4271 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -692,6 +692,12 @@ class BaseEC2NodeDriver(NodeDriver):
                              namespace=NAMESPACE)
             extra[attribute] = type_func(value)
 
+        try:
+            size = [size for size in self.list_sizes() if
+                    size.id == extra['instance_type']][0]
+        except IndexError:
+            size = None
+
         return EC2ReservedNode(id=findtext(element=element,
                                            xpath='reservedInstancesId',
                                            namespace=NAMESPACE),
@@ -699,6 +705,7 @@ class BaseEC2NodeDriver(NodeDriver):
                                               xpath='state',
                                               namespace=NAMESPACE),
                                driver=self,
+                               size=size,
                                extra=extra)
 
     def _to_nodes(self, object, xpath, groups=None):