You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by po...@apache.org on 2010/05/04 02:47:09 UTC
svn commit: r940685 - in /incubator/libcloud/trunk: libcloud/drivers/ec2.py
test/test_ec2.py
Author: polvi
Date: Tue May 4 00:47:09 2010
New Revision: 940685
URL: http://svn.apache.org/viewvc?rev=940685&view=rev
Log:
add ec2 ap southeast
Modified:
incubator/libcloud/trunk/libcloud/drivers/ec2.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=940685&r1=940684&r2=940685&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/ec2.py Tue May 4 00:47:09 2010
@@ -30,6 +30,7 @@ from xml.etree import ElementTree as ET
EC2_US_EAST_HOST = 'ec2.us-east-1.amazonaws.com'
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'
API_VERSION = '2009-11-30'
@@ -94,6 +95,7 @@ EC2_INSTANCE_TYPES = {
EC2_US_EAST_INSTANCE_TYPES = dict(EC2_INSTANCE_TYPES)
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_US_EAST_INSTANCE_TYPES['m1.small']['price'] = '.085'
EC2_US_EAST_INSTANCE_TYPES['m1.large']['price'] = '.34'
@@ -119,6 +121,9 @@ EC2_EU_WEST_INSTANCE_TYPES['c1.xlarge'][
EC2_EU_WEST_INSTANCE_TYPES['m2.2xlarge']['price'] = '1.34'
EC2_EU_WEST_INSTANCE_TYPES['m2.4xlarge']['price'] = '2.68'
+# prices are the same
+EC2_AP_SOUTHEAST_INSTANCE_TYPES = dict(EC2_EU_WEST_INSTANCE_TYPES)
+
class EC2Response(Response):
def parse_body(self):
@@ -436,7 +441,7 @@ class EC2EUConnection(EC2Connection):
class EC2EUNodeDriver(EC2NodeDriver):
- name = 'Amazon EC2 (eu-east-1)'
+ name = 'Amazon EC2 (eu-west-1)'
connectionCls = EC2EUConnection
_instance_types = EC2_EU_WEST_INSTANCE_TYPES
def list_locations(self):
@@ -454,6 +459,18 @@ class EC2USWestNodeDriver(EC2NodeDriver)
def list_locations(self):
return [NodeLocation(0, 'Amazon US N. California', 'US', self)]
+class EC2APSEConnection(EC2Connection):
+
+ host = EC2_AP_SOUTHEAST_HOST
+
+class EC2APSENodeDriver(EC2NodeDriver):
+
+ name = 'Amazon EC2 (ap-southeast-1)'
+ connectionCls = EC2APSEConnection
+ _instance_types = EC2_AP_SOUTHEAST_INSTANCE_TYPES
+ def list_locations(self):
+ return [NodeLocation(0, 'Amazon Asia-Pacific Singapore', 'SG', self)]
+
class EucConnection(EC2Connection):
host = None
Modified: incubator/libcloud/trunk/test/test_ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_ec2.py?rev=940685&r1=940684&r2=940685&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_ec2.py (original)
+++ incubator/libcloud/trunk/test/test_ec2.py Tue May 4 00:47:09 2010
@@ -15,7 +15,7 @@
import sys
import unittest
-from libcloud.drivers.ec2 import EC2NodeDriver
+from libcloud.drivers.ec2 import EC2NodeDriver, EC2APSENodeDriver
from libcloud.base import Node, NodeImage, NodeSize
from test import MockHttp, TestCaseMixin
@@ -93,5 +93,11 @@ class EC2MockHttp(MockHttp):
body = self.fixtures.load('terminate_instances.xml')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+class EC2APSETests(EC2Tests):
+ def setUp(self):
+ EC2APSENodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
+ EC2MockHttp.use_param = 'Action'
+ self.driver = EC2APSENodeDriver(EC2_ACCESS_ID, EC2_SECRET)
+
if __name__ == '__main__':
sys.exit(unittest.main())