You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/04/10 02:23:01 UTC

[6/7] libcloud git commit: Add missing regions in AWS storage and compute drivers

Add missing regions in AWS storage and compute drivers

Instance types and prices have been updated to reflect the new regions.

Closes #1019


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/28df2de2
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/28df2de2
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/28df2de2

Branch: refs/heads/trunk
Commit: 28df2de244ebf8731cd26f748a9dc486ab17cb08
Parents: c879d3b
Author: Alex Misstear <am...@redhat.com>
Authored: Mon Mar 6 07:50:32 2017 -0500
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 12:21:25 2017 +1000

----------------------------------------------------------------------
 contrib/scrape-ec2-prices.py    |  7 +++-
 libcloud/compute/drivers/ec2.py | 78 +++++++++++++++++++++++++++++++++++-
 libcloud/data/pricing.json      |  2 +-
 libcloud/storage/drivers/s3.py  | 72 +++++++++++++++++++++++++++++++++
 libcloud/storage/providers.py   | 12 ++++++
 libcloud/storage/types.py       |  6 +++
 6 files changed, 173 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/28df2de2/contrib/scrape-ec2-prices.py
----------------------------------------------------------------------
diff --git a/contrib/scrape-ec2-prices.py b/contrib/scrape-ec2-prices.py
index a4a12f9..cb21a31 100755
--- a/contrib/scrape-ec2-prices.py
+++ b/contrib/scrape-ec2-prices.py
@@ -40,6 +40,7 @@ EC2_REGIONS = [
     'us-east-2',
     'us-west-1',
     'us-west-2',
+    'us-gov-west-1',
     'eu-west-1',
     'eu-west-2',
     'eu-central-1',
@@ -49,7 +50,8 @@ EC2_REGIONS = [
     'ap-northeast-1',
     'ap-northeast-2',
     'ap-south-1',
-    'sa-east-1'
+    'sa-east-1',
+    'cn-north-1',
 ]
 
 EC2_INSTANCE_TYPES = [
@@ -128,7 +130,8 @@ REGION_NAME_MAP = {
     'ap-northeast-2': 'ec2_ap_northeast',
     'ap-south-1': 'ec2_ap_south_1',
     'sa-east-1': 'ec2_sa_east',
-    'us-gov-west-1': 'ec2_us_govwest'
+    'us-gov-west-1': 'ec2_us_govwest',
+    'cn-north-1': 'ec2_cn_north',
 }
 
 INSTANCE_SIZES = [

http://git-wip-us.apache.org/repos/asf/libcloud/blob/28df2de2/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 7e52432..31b8b8e 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -736,6 +736,26 @@ INSTANCE_TYPES = {
             'cpu': 2
         }
     },
+    't2.xlarge': {
+        'id': 't2.xlarge',
+        'name': 'Burstable Performance Extra Large Instance',
+        'ram': GiB(16),
+        'disk': 0,  # EBS Only
+        'bandwidth': None,
+        'extra': {
+            'cpu': 4
+        }
+    },
+    't2.2xlarge': {
+        'id': 't2.2xlarge',
+        'name': 'Burstable Performance Double Extra Large Instance',
+        'ram': GiB(32),
+        'disk': 0,  # EBS Only
+        'bandwidth': None,
+        'extra': {
+            'cpu': 8
+        }
+    },
     'x1.32xlarge': {
         'id': 'x1.32xlarge',
         'name': 'Memory Optimized ThirtyTwo Extra Large instance',
@@ -886,7 +906,7 @@ REGION_DETAILS = {
         'endpoint': 'ec2.us-east-2.amazonaws.com',
         'api_name': 'ec2_us_east_ohio',
         'country': 'USA',
-        'signature_version': '2',
+        'signature_version': '4',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -1653,6 +1673,62 @@ REGION_DETAILS = {
             't2.large'
         ]
     },
+    # China (North) Region
+    'cn-north-1': {
+        'endpoint': 'ec2.cn-north-1.amazonaws.com.cn',
+        'api_name': 'ec2_cn_north',
+        'country': 'China',
+        'signature_version': '4',
+        'instance_types': [
+            't1.micro',
+            't2.micro',
+            't2.small',
+            't2.medium',
+            't2.large',
+            't2.xlarge',
+            't2.2xlarge',
+            'm4.large',
+            'm4.xlarge',
+            'm4.2xlarge',
+            'm4.4xlarge',
+            'm4.10xlarge',
+            'm4.16xlarge',
+            'm3.medium',
+            'm3.large',
+            'm3.xlarge',
+            'm3.2xlarge',
+            'm1.small',
+            'c4.large',
+            'c4.xlarge',
+            'c4.2xlarge',
+            'c4.4xlarge',
+            'c4.8xlarge',
+            'c3.large',
+            'c3.xlarge',
+            'c3.2xlarge',
+            'c3.4xlarge',
+            'c3.8xlarge',
+            'r4.large',
+            'r4.xlarge',
+            'r4.2xlarge',
+            'r4.4xlarge',
+            'r4.8xlarge',
+            'r4.16xlarge',
+            'r3.large',
+            'r3.xlarge',
+            'r3.2xlarge',
+            'r3.4xlarge',
+            'r3.8xlarge',
+            'd2.xlarge',
+            'd2.2xlarge',
+            'd2.4xlarge',
+            'd2.8xlarge',
+            'i2.xlarge',
+            'i2.2xlarge',
+            'i2.4xlarge',
+            'i2.8xlarge',
+        ]
+    },
     'nimbus': {
         # Nimbus clouds have 3 EC2-style instance types but their particular
         # RAM allocations are configured by the admin

http://git-wip-us.apache.org/repos/asf/libcloud/blob/28df2de2/libcloud/data/pricing.json
----------------------------------------------------------------------
diff --git a/libcloud/data/pricing.json b/libcloud/data/pricing.json
index 9627acd..6224fb2 100644
--- a/libcloud/data/pricing.json
+++ b/libcloud/data/pricing.json
@@ -1373,5 +1373,5 @@
         }
     },
     "storage": {},
-    "updated": 1491021422
+    "updated": 1491318968
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/28df2de2/libcloud/storage/drivers/s3.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index 541256f..b603a86 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -49,10 +49,15 @@ from libcloud.storage.types import ObjectHashMismatchError
 EXPIRATION_SECONDS = 15 * 60
 
 S3_US_STANDARD_HOST = 's3.amazonaws.com'
+S3_US_EAST2_HOST = 's3-us-east-2.amazonaws.com'
 S3_US_WEST_HOST = 's3-us-west-1.amazonaws.com'
 S3_US_WEST_OREGON_HOST = 's3-us-west-2.amazonaws.com'
+S3_US_GOV_WEST_HOST = 's3-us-gov-west-1.amazonaws.com'
 S3_CN_NORTH_HOST = 's3.cn-north-1.amazonaws.com.cn'
 S3_EU_WEST_HOST = 's3-eu-west-1.amazonaws.com'
+S3_EU_WEST2_HOST = 's3-eu-west-2.amazonaws.com'
+S3_EU_CENTRAL_HOST = 's3-eu-central-1.amazonaws.com'
+S3_AP_SOUTH_HOST = 's3-ap-south-1.amazonaws.com'
 S3_AP_SOUTHEAST_HOST = 's3-ap-southeast-1.amazonaws.com'
 S3_AP_SOUTHEAST2_HOST = 's3-ap-southeast-2.amazonaws.com'
 S3_AP_NORTHEAST1_HOST = 's3-ap-northeast-1.amazonaws.com'
@@ -60,6 +65,7 @@ S3_AP_NORTHEAST2_HOST = 's3-ap-northeast-2.amazonaws.com'
 S3_AP_NORTHEAST_HOST = S3_AP_NORTHEAST1_HOST
 S3_SA_EAST_HOST = 's3-sa-east-1.amazonaws.com'
 S3_SA_SOUTHEAST2_HOST = 's3-sa-east-2.amazonaws.com'
+S3_CA_CENTRAL_HOST = 's3-ca-central-1.amazonaws.com'
 
 API_VERSION = '2006-03-01'
 NAMESPACE = 'http://s3.amazonaws.com/doc/%s/' % (API_VERSION)
@@ -996,6 +1002,17 @@ class S3StorageDriver(AWSDriver, BaseS3StorageDriver):
     region_name = 'us-east-1'
 
 
+class S3USEast2Connection(S3SignatureV4Connection):
+    host = S3_US_EAST2_HOST
+
+
+class S3USEast2StorageDriver(S3StorageDriver):
+    name = 'Amazon S3 (us-east-2)'
+    connectionCls = S3USEast2Connection
+    ex_location_name = 'us-east-2'
+    region_name = 'us-east-2'
+
+
 class S3USWestConnection(S3SignatureV4Connection):
     host = S3_US_WEST_HOST
 
@@ -1018,6 +1035,17 @@ class S3USWestOregonStorageDriver(S3StorageDriver):
     region_name = 'us-west-2'
 
 
+class S3USGovWestConnection(S3SignatureV4Connection):
+    host = S3_US_GOV_WEST_HOST
+
+
+class S3USGovWestStorageDriver(S3StorageDriver):
+    name = 'Amazon S3 (us-gov-west-1)'
+    connectionCls = S3USGovWestConnection
+    ex_location_name = 'us-gov-west-1'
+    region_name = 'us-gov-west-1'
+
+
 class S3CNNorthConnection(S3SignatureV4Connection):
     host = S3_CN_NORTH_HOST
 
@@ -1040,6 +1068,28 @@ class S3EUWestStorageDriver(S3StorageDriver):
     region_name = 'eu-west-1'
 
 
+class S3EUWest2Connection(S3SignatureV4Connection):
+    host = S3_EU_WEST2_HOST
+
+
+class S3EUWest2StorageDriver(S3StorageDriver):
+    name = 'Amazon S3 (eu-west-2)'
+    connectionCls = S3EUWest2Connection
+    ex_location_name = 'eu-west-2'
+    region_name = 'eu-west-2'
+
+
+class S3EUCentralConnection(S3SignatureV4Connection):
+    host = S3_EU_CENTRAL_HOST
+
+
+class S3EUCentralStorageDriver(S3StorageDriver):
+    name = 'Amazon S3 (eu-central-1)'
+    connectionCls = S3EUCentralConnection
+    ex_location_name = 'eu-central-1'
+    region_name = 'eu-central-1'
+
+
 class S3APSEConnection(S3SignatureV4Connection):
     host = S3_AP_SOUTHEAST_HOST
 
@@ -1088,6 +1138,17 @@ class S3APNE2StorageDriver(S3StorageDriver):
     region_name = 'ap-northeast-2'
 
 
+class S3APSouthConnection(S3SignatureV4Connection):
+    host = S3_AP_SOUTH_HOST
+
+
+class S3APSouthStorageDriver(S3StorageDriver):
+    name = 'Amazon S3 (ap-south-1)'
+    connectionCls = S3APSouthConnection
+    ex_location_name = 'ap-south-1'
+    region_name = 'ap-south-1'
+
+
 class S3SAEastConnection(S3SignatureV4Connection):
     host = S3_SA_EAST_HOST
 
@@ -1097,3 +1158,14 @@ class S3SAEastStorageDriver(S3StorageDriver):
     connectionCls = S3SAEastConnection
     ex_location_name = 'sa-east-1'
     region_name = 'sa-east-1'
+
+
+class S3CACentralConnection(S3SignatureV4Connection):
+    host = S3_CA_CENTRAL_HOST
+
+
+class S3CACentralStorageDriver(S3StorageDriver):
+    name = 'Amazon S3 (ca-central-1)'
+    connectionCls = S3CACentralConnection
+    ex_location_name = 'ca-central-1'
+    region_name = 'ca-central-1'

http://git-wip-us.apache.org/repos/asf/libcloud/blob/28df2de2/libcloud/storage/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/providers.py b/libcloud/storage/providers.py
index f15ad12..56b049e 100644
--- a/libcloud/storage/providers.py
+++ b/libcloud/storage/providers.py
@@ -27,14 +27,24 @@ DRIVERS = {
     ('libcloud.storage.drivers.cloudfiles', 'OpenStackSwiftStorageDriver'),
     Provider.S3:
     ('libcloud.storage.drivers.s3', 'S3StorageDriver'),
+    Provider.S3_US_EAST2:
+    ('libcloud.storage.drivers.s3', 'S3USEast2StorageDriver'),
     Provider.S3_US_WEST:
     ('libcloud.storage.drivers.s3', 'S3USWestStorageDriver'),
     Provider.S3_US_WEST_OREGON:
     ('libcloud.storage.drivers.s3', 'S3USWestOregonStorageDriver'),
+    Provider.S3_US_GOV_WEST:
+    ('libcloud.storage.drivers.s3', 'S3USGovWestStorageDriver'),
     Provider.S3_CN_NORTH:
     ('libcloud.storage.drivers.s3', 'S3CNNorthStorageDriver'),
     Provider.S3_EU_WEST:
     ('libcloud.storage.drivers.s3', 'S3EUWestStorageDriver'),
+    Provider.S3_EU_WEST2:
+    ('libcloud.storage.drivers.s3', 'S3EUWest2StorageDriver'),
+    Provider.S3_EU_CENTRAL:
+    ('libcloud.storage.drivers.s3', 'S3EUCentralStorageDriver'),
+    Provider.S3_AP_SOUTH:
+    ('libcloud.storage.drivers.s3', 'S3APSouthStorageDriver'),
     Provider.S3_AP_SOUTHEAST:
     ('libcloud.storage.drivers.s3', 'S3APSEStorageDriver'),
     Provider.S3_AP_SOUTHEAST2:
@@ -47,6 +57,8 @@ DRIVERS = {
     ('libcloud.storage.drivers.s3', 'S3APNE2StorageDriver'),
     Provider.S3_SA_EAST:
     ('libcloud.storage.drivers.s3', 'S3SAEastStorageDriver'),
+    Provider.S3_CA_CENTRAL:
+    ('libcloud.storage.drivers.s3', 'S3CACentralStorageDriver'),
     Provider.S3_RGW:
     ('libcloud.storage.drivers.rgw', 'S3RGWStorageDriver'),
     Provider.S3_RGW_OUTSCALE:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/28df2de2/libcloud/storage/types.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/types.py b/libcloud/storage/types.py
index df20c3f..c093a0b 100644
--- a/libcloud/storage/types.py
+++ b/libcloud/storage/types.py
@@ -72,13 +72,19 @@ class Provider(object):
     S3_AP_NORTHEAST = 's3_ap_northeast'
     S3_AP_NORTHEAST1 = 's3_ap_northeast_1'
     S3_AP_NORTHEAST2 = 's3_ap_northeast_2'
+    S3_AP_SOUTH = 's3_ap_south'
     S3_AP_SOUTHEAST = 's3_ap_southeast'
     S3_AP_SOUTHEAST2 = 's3_ap_southeast2'
+    S3_CA_CENTRAL = 's3_ca_central'
     S3_CN_NORTH = 's3_cn_north'
     S3_EU_WEST = 's3_eu_west'
+    S3_EU_WEST2 = 's3_eu_west_2'
+    S3_EU_CENTRAL = 's3_eu_central'
     S3_SA_EAST = 's3_sa_east'
+    S3_US_EAST2 = 's3_us_east_2'
     S3_US_WEST = 's3_us_west'
     S3_US_WEST_OREGON = 's3_us_west_oregon'
+    S3_US_GOV_WEST = 's3_us_gov_west'
     S3_RGW = 's3_rgw'
     S3_RGW_OUTSCALE = 's3_rgw_outscale'