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 2011/03/14 18:47:41 UTC

svn commit: r1081493 - in /incubator/libcloud/trunk: libcloud/compute/ libcloud/compute/drivers/ libcloud/data/ test/compute/

Author: tomaz
Date: Mon Mar 14 17:47:41 2011
New Revision: 1081493

URL: http://svn.apache.org/viewvc?rev=1081493&view=rev
Log:
Start updating the drivers to use the pricing module (w.i.p.)

Added:
    incubator/libcloud/trunk/libcloud/data/
    incubator/libcloud/trunk/libcloud/data/pricing.json
Modified:
    incubator/libcloud/trunk/libcloud/compute/base.py
    incubator/libcloud/trunk/libcloud/compute/drivers/cloudsigma.py
    incubator/libcloud/trunk/libcloud/compute/drivers/dreamhost.py
    incubator/libcloud/trunk/libcloud/compute/drivers/ec2.py
    incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py
    incubator/libcloud/trunk/test/compute/test_cloudsigma.py
    incubator/libcloud/trunk/test/compute/test_ec2.py

Modified: incubator/libcloud/trunk/libcloud/compute/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/base.py?rev=1081493&r1=1081492&r2=1081493&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/base.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/base.py Mon Mar 14 17:47:41 2011
@@ -22,11 +22,14 @@ import os
 import socket
 import struct
 
+from httplib import HTTPConnection as LibcloudHTTPConnection
+
+from libcloud.pricing import get_size_price
+
 from libcloud.common.base import ConnectionKey, ConnectionUserAndKey
 from libcloud.compute.types import NodeState, DeploymentError
 from libcloud.compute.ssh import SSHClient
 from libcloud.httplib_ssl import LibcloudHTTPSConnection
-from httplib import HTTPConnection as LibcloudHTTPConnection
 
 class Node(object):
     """
@@ -540,6 +543,12 @@ class NodeDriver(object):
           raise DeploymentError(node, e)
         return n
 
+    def _get_size_price(self, size_id):
+        return get_size_price(driver_type='compute',
+                              driver_name=self.api_name,
+                              size_id=size_id)
+
+
 def is_private_subnet(ip):
     """
     Utility function to check if an IP address is inside a private subnet.

Modified: incubator/libcloud/trunk/libcloud/compute/drivers/cloudsigma.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/drivers/cloudsigma.py?rev=1081493&r1=1081492&r2=1081493&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/drivers/cloudsigma.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/drivers/cloudsigma.py Mon Mar 14 17:47:41 2011
@@ -50,7 +50,6 @@ INSTANCE_TYPES = {
         'cpu': 1100,
         'memory': 640,
         'disk': 50,
-        'price': '0.0548',
         'bandwidth': None,
     },
     'micro-high-cpu': {
@@ -59,7 +58,6 @@ INSTANCE_TYPES = {
         'cpu': 2200,
         'memory': 640,
         'disk': 80,
-        'price': '.381',
         'bandwidth': None,
     },
     'standard-small': {
@@ -68,7 +66,6 @@ INSTANCE_TYPES = {
         'cpu': 1100,
         'memory': 1741,
         'disk': 50,
-        'price': '0.0796',
         'bandwidth': None,
     },
     'standard-large': {
@@ -77,7 +74,6 @@ INSTANCE_TYPES = {
         'cpu': 4400,
         'memory': 7680,
         'disk': 250,
-        'price': '0.381',
         'bandwidth': None,
     },
     'standard-extra-large': {
@@ -86,7 +82,6 @@ INSTANCE_TYPES = {
         'cpu': 8800,
         'memory': 15360,
         'disk': 500,
-        'price': '0.762',
         'bandwidth': None,
     },
     'high-memory-extra-large': {
@@ -95,7 +90,6 @@ INSTANCE_TYPES = {
         'cpu': 7150,
         'memory': 17510,
         'disk': 250,
-        'price': '0.642',
         'bandwidth': None,
     },
     'high-memory-double-extra-large': {
@@ -104,7 +98,6 @@ INSTANCE_TYPES = {
         'cpu': 14300,
         'memory': 32768,
         'disk': 500,
-        'price': '1.383',
         'bandwidth': None,
     },
     'high-cpu-medium': {
@@ -113,7 +106,6 @@ INSTANCE_TYPES = {
         'cpu': 5500,
         'memory': 1741,
         'disk': 150,
-        'price': '0.211',
         'bandwidth': None,
     },
     'high-cpu-extra-large': {
@@ -122,9 +114,8 @@ INSTANCE_TYPES = {
         'cpu': 20000,
         'memory': 7168,
         'disk': 500,
-        'price': '0.780',
         'bandwidth': None,
-    },
+    }
 }
 
 NODE_STATE_MAP = {
@@ -263,9 +254,11 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         """
         sizes = []
         for key, value in INSTANCE_TYPES.iteritems():
-            size = CloudSigmaNodeSize(id = value['id'], name = value['name'], cpu = value['cpu'], ram = value['memory'],
-                            disk = value['disk'], bandwidth = value['bandwidth'], price = value['price'],
-                            driver = self.connection.driver)
+            size = CloudSigmaNodeSize(id = value['id'], name = value['name'],
+                                      cpu = value['cpu'], ram = value['memory'],
+                                      disk = value['disk'], bandwidth = value['bandwidth'],
+                                      price = self._get_size_price(size_id=key),
+                                      driver = self.connection.driver)
             sizes.append(size)
 
         return sizes
@@ -557,3 +550,4 @@ class CloudSigmaZrhNodeDriver(CloudSigma
     CloudSigma node driver for the Zurich end-point
     """
     connectionCls = CloudSigmaZrhConnection
+    api_name = 'cloudsigma_zrh'

Modified: incubator/libcloud/trunk/libcloud/compute/drivers/dreamhost.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/drivers/dreamhost.py?rev=1081493&r1=1081492&r2=1081493&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/drivers/dreamhost.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/drivers/dreamhost.py Mon Mar 14 17:47:41 2011
@@ -21,6 +21,9 @@ try:
 except:
     import simplejson as json
 
+import copy
+
+from libcloud.pricing import get_pricing
 from libcloud.common.base import ConnectionKey, Response
 from libcloud.common.types import InvalidCredsError
 from libcloud.compute.base import Node, NodeDriver, NodeLocation, NodeSize
@@ -37,7 +40,6 @@ DH_PS_SIZES = {
         'id' : 'minimum',
         'name' : 'Minimum DH PS size',
         'ram' : 300,
-        'price' : 15,
         'disk' : None,
         'bandwidth' : None
     },
@@ -45,7 +47,6 @@ DH_PS_SIZES = {
         'id' : 'maximum',
         'name' : 'Maximum DH PS size',
         'ram' : 4000,
-        'price' : 200,
         'disk' : None,
         'bandwidth' : None
     },
@@ -53,7 +54,6 @@ DH_PS_SIZES = {
         'id' : 'default',
         'name' : 'Default DH PS size',
         'ram' : 2300,
-        'price' : 115,
         'disk' : None,
         'bandwidth' : None
     },
@@ -61,7 +61,6 @@ DH_PS_SIZES = {
         'id' : 'low',
         'name' : 'DH PS with 1GB RAM',
         'ram' : 1000,
-        'price' : 50,
         'disk' : None,
         'bandwidth' : None
     },
@@ -69,7 +68,6 @@ DH_PS_SIZES = {
         'id' : 'high',
         'name' : 'DH PS with 3GB RAM',
         'ram' : 3000,
-        'price' : 150,
         'disk' : None,
         'bandwidth' : None
     },
@@ -133,8 +131,10 @@ class DreamhostNodeDriver(NodeDriver):
     Node Driver for DreamHost PS
     """
     type = Provider.DREAMHOST
+    api_name = 'dreamhost'
     name = "Dreamhost"
     connectionCls = DreamhostConnection
+
     _sizes = DH_PS_SIZES
 
     def create_node(self, **kwargs):
@@ -201,8 +201,13 @@ class DreamhostNodeDriver(NodeDriver):
         return images
 
     def list_sizes(self, **kwargs):
-        return [ NodeSize(driver=self.connection.driver, **i)
-            for i in self._sizes.values() ]
+        sizes = []
+        for key, values in self._sizes.iteritems():
+            attributes = copy.deepcopy(values)
+            attributes.update({ 'price': self._get_size_price(size_id=key) })
+            sizes.append(NodeSize(driver=self.connection.driver, **attributes))
+
+        return sizes
 
     def list_locations(self, **kwargs):
         raise NotImplementedError('You cannot select a location for DreamHost Private Servers at this time.')

Modified: incubator/libcloud/trunk/libcloud/compute/drivers/ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/drivers/ec2.py?rev=1081493&r1=1081492&r2=1081493&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/drivers/ec2.py Mon Mar 14 17:47:41 2011
@@ -21,6 +21,7 @@ import hmac
 import os
 import time
 import urllib
+import copy
 
 from hashlib import sha256
 from xml.etree import ElementTree as ET
@@ -134,55 +135,6 @@ EC2_EU_WEST_INSTANCE_TYPES = dict(EC2_IN
 EC2_AP_SOUTHEAST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES)
 EC2_AP_NORTHEAST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES)
 
-#
-# On demand prices must also be hardcoded, because Amazon doesn't provide an
-# API to fetch them. From http://aws.amazon.com/ec2/pricing/
-#
-EC2_US_EAST_INSTANCE_TYPES['t1.micro']['price'] = '.02'
-EC2_US_EAST_INSTANCE_TYPES['m1.small']['price'] = '.085'
-EC2_US_EAST_INSTANCE_TYPES['m1.large']['price'] = '.34'
-EC2_US_EAST_INSTANCE_TYPES['m1.xlarge']['price'] = '.68'
-EC2_US_EAST_INSTANCE_TYPES['c1.medium']['price'] = '.17'
-EC2_US_EAST_INSTANCE_TYPES['c1.xlarge']['price'] = '.68'
-EC2_US_EAST_INSTANCE_TYPES['m2.xlarge']['price'] = '.50'
-EC2_US_EAST_INSTANCE_TYPES['m2.2xlarge']['price'] = '1.0'
-EC2_US_EAST_INSTANCE_TYPES['m2.4xlarge']['price'] = '2.0'
-EC2_US_EAST_INSTANCE_TYPES['cg1.4xlarge']['price'] = '2.1'
-EC2_US_EAST_INSTANCE_TYPES['cc1.4xlarge']['price'] = '1.6'
-
-EC2_US_WEST_INSTANCE_TYPES['t1.micro']['price'] = '.025'
-EC2_US_WEST_INSTANCE_TYPES['m1.small']['price'] = '.095'
-EC2_US_WEST_INSTANCE_TYPES['m1.large']['price'] = '.38'
-EC2_US_WEST_INSTANCE_TYPES['m1.xlarge']['price'] = '.76'
-EC2_US_WEST_INSTANCE_TYPES['c1.medium']['price'] = '.19'
-EC2_US_WEST_INSTANCE_TYPES['c1.xlarge']['price'] = '.76'
-EC2_US_WEST_INSTANCE_TYPES['m2.xlarge']['price'] = '.57'
-EC2_US_WEST_INSTANCE_TYPES['m2.2xlarge']['price'] = '1.14'
-EC2_US_WEST_INSTANCE_TYPES['m2.4xlarge']['price'] = '2.28'
-
-EC2_EU_WEST_INSTANCE_TYPES['t1.micro']['price'] = '.025'
-EC2_EU_WEST_INSTANCE_TYPES['m1.small']['price'] = '.095'
-EC2_EU_WEST_INSTANCE_TYPES['m1.large']['price'] = '.38'
-EC2_EU_WEST_INSTANCE_TYPES['m1.xlarge']['price'] = '.76'
-EC2_EU_WEST_INSTANCE_TYPES['c1.medium']['price'] = '.19'
-EC2_EU_WEST_INSTANCE_TYPES['c1.xlarge']['price'] = '.76'
-EC2_EU_WEST_INSTANCE_TYPES['m2.xlarge']['price'] = '.57'
-EC2_EU_WEST_INSTANCE_TYPES['m2.2xlarge']['price'] = '1.14'
-EC2_EU_WEST_INSTANCE_TYPES['m2.4xlarge']['price'] = '2.28'
-
-# prices are the same
-EC2_AP_SOUTHEAST_INSTANCE_TYPES = dict(EC2_EU_WEST_INSTANCE_TYPES)
-
-EC2_AP_NORTHEAST_INSTANCE_TYPES['t1.micro']['price'] = '.027'
-EC2_AP_NORTHEAST_INSTANCE_TYPES['m1.small']['price'] = '.10'
-EC2_AP_NORTHEAST_INSTANCE_TYPES['m1.large']['price'] = '.40'
-EC2_AP_NORTHEAST_INSTANCE_TYPES['m1.xlarge']['price'] = '.80'
-EC2_AP_NORTHEAST_INSTANCE_TYPES['c1.medium']['price'] = '.20'
-EC2_AP_NORTHEAST_INSTANCE_TYPES['c1.xlarge']['price'] = '.80'
-EC2_AP_NORTHEAST_INSTANCE_TYPES['m2.xlarge']['price'] = '.60'
-EC2_AP_NORTHEAST_INSTANCE_TYPES['m2.2xlarge']['price'] = '1.20'
-EC2_AP_NORTHEAST_INSTANCE_TYPES['m2.4xlarge']['price'] = '2.39'
-
 class EC2NodeLocation(NodeLocation):
     def __init__(self, id, name, country, driver, availability_zone):
         super(EC2NodeLocation, self).__init__(id, name, country, driver)
@@ -301,6 +253,7 @@ class EC2NodeDriver(NodeDriver):
 
     connectionCls = EC2Connection
     type = Provider.EC2
+    api_name = 'ec2_us_east'
     name = 'Amazon EC2 (us-east-1)'
     friendly_name = 'Amazon US N. Virginia'
     country = 'US'
@@ -428,12 +381,14 @@ class EC2NodeDriver(NodeDriver):
         return sizes
 
     def _get_sizes(self, include_cluser_instances=False):
-        sizes = [ NodeSize(driver=self.connection.driver, **i)
-                         for i in self._instance_types.values() ]
-
-        if not include_cluser_instances:
-            sizes = [ size for size in sizes if \
-                      size.id not in CLUSTER_INSTANCES_IDS]
+        sizes = []
+        for key, values in self._instance_types.iteritems():
+            if not include_cluser_instances and \
+               key in CLUSTER_INSTANCES_IDS:
+               continue
+            attributes = copy.deepcopy(values)
+            attributes.update({'price': self._get_size_price(size_id=key)})
+            sizes.append(NodeSize(driver=self, **attributes))
         return sizes
 
     def list_images(self, location=None):
@@ -846,6 +801,7 @@ class EC2EUNodeDriver(EC2NodeDriver):
     Driver class for EC2 in the Western Europe Region
     """
 
+    api_name = 'ec2_eu_west'
     name = 'Amazon EC2 (eu-west-1)'
     friendly_name = 'Amazon Europe Ireland'
     country = 'IE'
@@ -865,6 +821,7 @@ class EC2USWestNodeDriver(EC2NodeDriver)
     Driver class for EC2 in the Western US Region
     """
 
+    api_name = 'ec2_us_west'
     name = 'Amazon EC2 (us-west-1)'
     friendly_name = 'Amazon US N. California'
     country = 'US'
@@ -891,6 +848,7 @@ class EC2APSENodeDriver(EC2NodeDriver):
     Driver class for EC2 in the Southeast Asia Pacific Region
     """
 
+    api_name = 'ec2_ap_southeast'
     name = 'Amazon EC2 (ap-southeast-1)'
     friendly_name = 'Amazon Asia-Pacific Singapore'
     country = 'SG'
@@ -903,6 +861,7 @@ class EC2APNENodeDriver(EC2NodeDriver):
     Driver class for EC2 in the Northeast Asia Pacific Region
     """
 
+    api_name = 'ec2_ap_northeast'
     name = 'Amazon EC2 (ap-northeast-1)'
     friendly_name = 'Amazon Asia-Pacific Tokyo'
     country = 'JP'

Modified: incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py?rev=1081493&r1=1081492&r2=1081493&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py (original)
+++ incubator/libcloud/trunk/libcloud/compute/drivers/rackspace.py Mon Mar 14 17:47:41 2011
@@ -23,7 +23,9 @@ import urlparse
 from xml.etree import ElementTree as ET
 from xml.parsers.expat import ExpatError
 
-from libcloud.common.base import Response
+from libcloud.pricing import get_pricing
+
+from libcloud.common.base import ConnectionUserAndKey, Response
 from libcloud.common.types import InvalidCredsError, MalformedResponseError
 from libcloud.compute.types import NodeState, Provider
 from libcloud.compute.base import NodeDriver, Node
@@ -33,20 +35,6 @@ from libcloud.common.rackspace import AU
 
 NAMESPACE='http://docs.rackspacecloud.com/servers/api/v1.0'
 
-#
-# Prices need to be hardcoded as Rackspace doesn't expose them through
-# the API. Prices are associated with flavors, of which there are 7.
-# See - http://www.rackspacecloud.com/cloud_hosting_products/servers/pricing
-#
-RACKSPACE_PRICES = {
-    '1':'.015',
-    '2':'.030',
-    '3':'.060',
-    '4':'.120',
-    '5':'.240',
-    '6':'.480',
-    '7':'.960',
-}
 
 class RackspaceResponse(Response):
 
@@ -146,7 +134,8 @@ class RackspaceNodeDriver(NodeDriver):
     type = Provider.RACKSPACE
     name = 'Rackspace'
 
-    _rackspace_prices = RACKSPACE_PRICES
+    _rackspace_prices = get_pricing(driver_type='compute',
+                                    driver_name='rackspace')
 
     features = {"create_node": ["generates_password"]}
 

Added: incubator/libcloud/trunk/libcloud/data/pricing.json
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/data/pricing.json?rev=1081493&view=auto
==============================================================================
--- incubator/libcloud/trunk/libcloud/data/pricing.json (added)
+++ incubator/libcloud/trunk/libcloud/data/pricing.json Mon Mar 14 17:47:41 2011
@@ -0,0 +1,93 @@
+{
+    "rackspace": {
+        "1": 0.015,
+        "2": 0.030,
+        "3": 0.060,
+        "4": 0.120,
+        "5": 0.240,
+        "6": 0.480,
+        "7": 0.960
+    },
+
+    "dreamhost": {
+        "minimum": 15,
+        "maximum": 200,
+        "default": 115,
+        "low": 50,
+        "high": 150
+    },
+
+    "ec2_us_east": {
+        "t1.micro": 0.02,
+        "m1.small": 0.085,
+        "m1.large": 0.34,
+        "m1.xlarge": 0.68,
+        "c1.medium": 0.17,
+        "c1.xlarge": 0.68,
+        "m2.xlarge": 0.50,
+        "m2.2xlarge": 1.0,
+        "m2.4xlarge": 2.0,
+        "cg1.4xlarge": 2.1,
+        "cc1.4xlarge": 1.6
+    },
+
+    "ec2_us_west": {
+        "t1.micro": 0.025,
+        "m1.small": 0.095,
+        "m1.large": 0.38,
+        "m1.xlarge": 0.76,
+        "c1.medium": 0.19,
+        "c1.xlarge": 0.76,
+        "m2.xlarge": 0.57,
+        "m2.2xlarge": 1.14,
+        "m2.4xlarge": 2.28
+    },
+
+   "ec2_eu_west": {
+        "t1.micro": 0.025,
+        "m1.small": 0.095,
+        "m1.large": 0.38,
+        "m1.xlarge": 0.76,
+        "c1.medium": 0.19,
+        "c1.xlarge": 0.76,
+        "m2.xlarge": 0.57,
+        "m2.2xlarge": 1.14,
+        "m2.4xlarge": 2.28
+    },
+
+   "ec2_ap_southeast": {
+        "t1.micro": 0.025,
+        "m1.small": 0.095,
+        "m1.large": 0.38,
+        "m1.xlarge": 0.76,
+        "c1.medium": 0.19,
+        "c1.xlarge": 0.76,
+        "m2.xlarge": 0.57,
+        "m2.2xlarge": 1.14,
+        "m2.4xlarge": 2.28
+    },
+
+   "ec2_ap_northeast": {
+        "t1.micro": 0.027,
+        "m1.small": 0.10,
+        "m1.large": 0.40,
+        "m1.xlarge": 0.80,
+        "c1.medium": 0.20,
+        "c1.xlarge": 0.80,
+        "m2.xlarge": 0.60,
+        "m2.2xlarge": 1.20,
+        "m2.4xlarge": 2.39
+    },
+
+    "cloudsigma_zrh": {
+        "micro-regular": 0.0548,
+        "micro-high-cpu": 0.381,
+        "standard-small": 0.0796,
+        "standard-large": 0.381,
+        "standard-extra-large": 0.762,
+        "high-memory-extra-large": 0.642,
+        "high-memory-double-extra-large": 1.383,
+        "high-cpu-medium": 0.211,
+        "high-cpu-extra-large": 0.780
+    }
+}

Modified: incubator/libcloud/trunk/test/compute/test_cloudsigma.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/compute/test_cloudsigma.py?rev=1081493&r1=1081492&r2=1081493&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/compute/test_cloudsigma.py (original)
+++ incubator/libcloud/trunk/test/compute/test_cloudsigma.py Mon Mar 14 17:47:41 2011
@@ -18,7 +18,7 @@ import unittest
 import httplib
 
 from libcloud.compute.base import Node
-from libcloud.compute.drivers.cloudsigma import CloudSigmaBaseNodeDriver
+from libcloud.compute.drivers.cloudsigma import CloudSigmaZrhNodeDriver
 from libcloud.utils import str2dicts, str2list, dict2str
 
 from test import MockHttp
@@ -28,9 +28,9 @@ from test.file_fixtures import ComputeFi
 
 class CloudSigmaTestCase(unittest.TestCase, TestCaseMixin):
     def setUp(self):
-        CloudSigmaBaseNodeDriver.connectionCls.conn_classes = (None,
+        CloudSigmaZrhNodeDriver.connectionCls.conn_classes = (None,
                                                                CloudSigmaHttp)
-        self.driver = CloudSigmaBaseNodeDriver('foo', 'bar')
+        self.driver = CloudSigmaZrhNodeDriver('foo', 'bar')
 
     def test_list_nodes(self):
         nodes = self.driver.list_nodes()

Modified: incubator/libcloud/trunk/test/compute/test_ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/compute/test_ec2.py?rev=1081493&r1=1081492&r2=1081493&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/compute/test_ec2.py (original)
+++ incubator/libcloud/trunk/test/compute/test_ec2.py Mon Mar 14 17:47:41 2011
@@ -113,8 +113,14 @@ class EC2Tests(unittest.TestCase, TestCa
     def test_list_sizes(self):
         region_old = self.driver.region_name
 
-        for region_name in [ 'us-east-1', 'us-west-1', 'eu-west-1',
-                             'ap-southeast-1' ]:
+        names = [ ('ec2_us_east', 'us-east-1'),
+                  ('ec2_us_west', 'us-west-1'),
+                  ('ec2_eu_west', 'eu-west-1'),
+                  ('ec2_ap_southeast', 'ap-southeast-1'),
+                  ('ec2_ap_northeast', 'ap-northeast-1')
+                ]
+        for api_name, region_name in names:
+            self.driver.api_name = api_name
             self.driver.region_name = region_name
             sizes = self.driver.list_sizes()