You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2010/08/13 01:11:29 UTC

svn commit: r985033 - /incubator/libcloud/trunk/libcloud/drivers/softlayer.py

Author: pquerna
Date: Thu Aug 12 23:11:29 2010
New Revision: 985033

URL: http://svn.apache.org/viewvc?rev=985033&view=rev
Log:
Softlayer lets you query prices on individual nodes.

Submitted by: Brad Morgan <morgabra cloudkick.com>

Modified:
    incubator/libcloud/trunk/libcloud/drivers/softlayer.py

Modified: incubator/libcloud/trunk/libcloud/drivers/softlayer.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/softlayer.py?rev=985033&r1=985032&r2=985033&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/softlayer.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/softlayer.py Thu Aug 12 23:11:29 2010
@@ -229,6 +229,9 @@ class SoftLayerNodeDriver(NodeDriver):
 
     Extra node attributes:
         - password: root password
+        - hourlyRecurringFee: hourly price (if applicable)
+        - recurringFee      : flat rate    (if applicable)
+        - recurringMonths   : The number of months in which the recurringFee will be incurred.
     """
     connectionCls = SoftLayerConnection
     name = 'SoftLayer'
@@ -248,6 +251,10 @@ class SoftLayerNodeDriver(NodeDriver):
         except (IndexError, KeyError):
             password = None
 
+        hourlyRecurringFee = host.get('billingItem', {}).get('hourlyRecurringFee', 0)
+        recurringFee       = host.get('billingItem', {}).get('recurringFee', 0)
+        recurringMonths    = host.get('billingItem', {}).get('recurringMonths', 0)
+
         return Node(
             id=host['id'],
             name=host['hostname'],
@@ -259,7 +266,10 @@ class SoftLayerNodeDriver(NodeDriver):
             private_ip=[host['primaryBackendIpAddress']],
             driver=self,
             extra={
-                'password': password
+                'password': password,
+                'hourlyRecurringFee': hourlyRecurringFee,
+                'recurringFee': recurringFee,
+                'recurringMonths': recurringMonths,
             }
         )
 
@@ -409,8 +419,9 @@ class SoftLayerNodeDriver(NodeDriver):
                 'powerState': '',
                 'softwareComponents': {
                     'passwords': ''
-                }
-            }
+                },
+                'billingItem': '',
+            },
         }
         res = self.connection.request(
             "SoftLayer_Account",