libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [libcloud] 02/14: [ovh] Improved size data
Date Sun, 04 Oct 2020 15:39:21 GMT
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 7903c345f451b22563d5a8b53b95d2c6192715d1
Author: Dan Hunsaker <danhunsaker@gmail.com>
AuthorDate: Thu Oct 5 09:59:11 2017 -0600

    [ovh] Improved size data
---
 libcloud/compute/drivers/ovh.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libcloud/compute/drivers/ovh.py b/libcloud/compute/drivers/ovh.py
index ecd4957..7e7fcd8 100644
--- a/libcloud/compute/drivers/ovh.py
+++ b/libcloud/compute/drivers/ovh.py
@@ -457,6 +457,12 @@ class OvhNodeDriver(NodeDriver):
         response = self.connection.request(action, method='DELETE')
         return response.status == httplib.OK
 
+    def ex_get_pricing(self, size_id):
+        pricing = self.connection.request('%s/cloud/price' % (API_ROOT),
+            params={'flavorId': size_id}).object['instances'][0]
+        return {'hourly': pricing['price']['value'],
+            'monthly': pricing['monthlyPrice']['value']}
+
     def _to_volume(self, obj):
         extra = obj.copy()
         extra.pop('id')
@@ -495,8 +501,8 @@ class OvhNodeDriver(NodeDriver):
         extra = {'vcpus': obj['vcpus'], 'type': obj['type'],
                  'region': obj['region']}
         return NodeSize(id=obj['id'], name=obj['name'], ram=obj['ram'],
-                        disk=obj['disk'], bandwidth=None, price=None,
-                        driver=self, extra=extra)
+                        disk=obj['disk'], bandwidth=obj['outboundBandwidth'],
+                        price=None, driver=self, extra=extra)
 
     def _to_sizes(self, objs):
         return [self._to_size(obj) for obj in objs]


Mime
View raw message