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/03 02:01:23 UTC
svn commit: r1076474 - in /incubator/libcloud/trunk: libcloud/drivers/ec2.py
libcloud/providers.py libcloud/types.py test/test_ec2.py
Author: tomaz
Date: Thu Mar 3 01:01:22 2011
New Revision: 1076474
URL: http://svn.apache.org/viewvc?rev=1076474&view=rev
Log:
Add support for the new Amazon region (Tokyo).
Modified:
incubator/libcloud/trunk/libcloud/drivers/ec2.py
incubator/libcloud/trunk/libcloud/providers.py
incubator/libcloud/trunk/libcloud/types.py
incubator/libcloud/trunk/test/test_ec2.py
Modified: incubator/libcloud/trunk/libcloud/drivers/ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/ec2.py?rev=1076474&r1=1076473&r2=1076474&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/ec2.py Thu Mar 3 01:01:22 2011
@@ -32,6 +32,7 @@ EC2_US_EAST_HOST = 'ec2.us-east-1.amazon
EC2_US_WEST_HOST = 'ec2.us-west-1.amazonaws.com'
EC2_EU_WEST_HOST = 'ec2.eu-west-1.amazonaws.com'
EC2_AP_SOUTHEAST_HOST = 'ec2.ap-southeast-1.amazonaws.com'
+EC2_AP_NORTHEAST_HOST = 'ec2.ap-northeast-1.amazonaws.com'
API_VERSION = '2010-08-31'
@@ -127,6 +128,7 @@ EC2_US_EAST_INSTANCE_TYPES = dict(EC2_IN
EC2_US_WEST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES)
EC2_EU_WEST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES)
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
@@ -167,6 +169,15 @@ EC2_EU_WEST_INSTANCE_TYPES['m2.4xlarge']
# 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):
@@ -864,6 +875,13 @@ class EC2APSEConnection(EC2Connection):
host = EC2_AP_SOUTHEAST_HOST
+class EC2APNEConnection(EC2Connection):
+ """
+ Connection class for EC2 in the Northeast Asia Pacific Region
+ """
+
+ host = EC2_AP_NORTHEAST_HOST
+
class EC2APSENodeDriver(EC2NodeDriver):
"""
Driver class for EC2 in the Southeast Asia Pacific Region
@@ -876,6 +894,18 @@ class EC2APSENodeDriver(EC2NodeDriver):
connectionCls = EC2APSEConnection
_instance_types = EC2_AP_SOUTHEAST_INSTANCE_TYPES
+class EC2APNENodeDriver(EC2NodeDriver):
+ """
+ Driver class for EC2 in the Northeast Asia Pacific Region
+ """
+
+ name = 'Amazon EC2 (ap-northeast-1)'
+ friendly_name = 'Amazon Asia-Pacific Tokyo'
+ country = 'JP'
+ region_name = 'ap-northeast-1'
+ connectionCls = EC2APNEConnection
+ _instance_types = EC2_AP_NORTHEAST_INSTANCE_TYPES
+
class EucConnection(EC2Connection):
"""
Connection class for Eucalyptus
Modified: incubator/libcloud/trunk/libcloud/providers.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/providers.py?rev=1076474&r1=1076473&r2=1076474&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/providers.py (original)
+++ incubator/libcloud/trunk/libcloud/providers.py Thu Mar 3 01:01:22 2011
@@ -29,6 +29,8 @@ DRIVERS = {
('libcloud.drivers.ec2', 'EC2USWestNodeDriver'),
Provider.EC2_AP_SOUTHEAST:
('libcloud.drivers.ec2', 'EC2APSENodeDriver'),
+ Provider.EC2_AP_NORTHEAST:
+ ('libcloud.drivers.ec2', 'EC2APNENodeDriver'),
Provider.ECP:
('libcloud.drivers.ecp', 'ECPNodeDriver'),
Provider.ELASTICHOSTS_UK1:
Modified: incubator/libcloud/trunk/libcloud/types.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/types.py?rev=1076474&r1=1076473&r2=1076474&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/types.py (original)
+++ incubator/libcloud/trunk/libcloud/types.py Thu Mar 3 01:01:22 2011
@@ -66,6 +66,7 @@ class Provider(object):
RACKSPACE_UK = 23
BRIGHTBOX = 24
CLOUDSIGMA = 25
+ EC2_AP_NORTHEAST = 26
class NodeState(object):
"""
Modified: incubator/libcloud/trunk/test/test_ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_ec2.py?rev=1076474&r1=1076473&r2=1076474&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_ec2.py (original)
+++ incubator/libcloud/trunk/test/test_ec2.py Thu Mar 3 01:01:22 2011
@@ -16,6 +16,7 @@ import sys
import unittest
from libcloud.drivers.ec2 import EC2NodeDriver, EC2APSENodeDriver, IdempotentParamError
+from libcloud.drivers.ec2 import EC2APNENodeDriver
from libcloud.base import Node, NodeImage, NodeSize, NodeLocation
from test import MockHttp, TestCaseMixin
@@ -261,5 +262,12 @@ class EC2APSETests(EC2Tests):
EC2MockHttp.type = None
self.driver = EC2APSENodeDriver(EC2_ACCESS_ID, EC2_SECRET)
+class EC2APNETests(EC2Tests):
+ def setUp(self):
+ EC2APNENodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
+ EC2MockHttp.use_param = 'Action'
+ EC2MockHttp.type = None
+ self.driver = EC2APNENodeDriver(EC2_ACCESS_ID, EC2_SECRET)
+
if __name__ == '__main__':
sys.exit(unittest.main())