Add missing t2 instances to the EC2 driver.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ef823b95 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ef823b95 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ef823b95 Branch: refs/heads/trunk Commit: ef823b9552601b5012860858883ce5962180163f Parents: 8769b8a Author: Tomaz Muraus <[email protected]> Authored: Sat Sep 6 19:13:04 2014 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Sat Sep 6 19:13:04 2014 +0200 ---------------------------------------------------------------------- CHANGES.rst | 3 ++ contrib/scrape-ec2-prices.py | 8 ++++ libcloud/compute/drivers/ec2.py | 67 +++++++++++++++++++++++++++++++--- libcloud/data/pricing.json | 26 ++++++++++++- libcloud/test/compute/test_ec2.py | 8 ++-- 5 files changed, 101 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef823b95/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index e1253d4..de10bdd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -86,6 +86,9 @@ Compute with OpenStack floating IPs. [Andrew Mann] +- Add new t2 instance types to the EC2 driver. + [Tomaz Muraus] + Storage ~~~~~~~ http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef823b95/contrib/scrape-ec2-prices.py ---------------------------------------------------------------------- diff --git a/contrib/scrape-ec2-prices.py b/contrib/scrape-ec2-prices.py index 54a63e8..0013232 100755 --- a/contrib/scrape-ec2-prices.py +++ b/contrib/scrape-ec2-prices.py @@ -68,6 +68,14 @@ EC2_INSTANCE_TYPES = [ 'i2.2xlarge', 'i2.4xlarge', 'i2.8xlarge', + 'r3.large', + 'r3.xlarge', + 'r3.2xlarge', + 'r3.4xlarge', + 'r3.8xlarge', + 't2.micro', + 't2.small', + 't2.medium' ] # Maps EC2 region name to region name used in the pricing file http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef823b95/libcloud/compute/drivers/ec2.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py index af13a3d..f26797b 100644 --- a/libcloud/compute/drivers/ec2.py +++ b/libcloud/compute/drivers/ec2.py @@ -335,6 +335,37 @@ INSTANCE_TYPES = { 'ram': 244000, 'disk': 320, # x2 'bandwidth': None + }, + 't2.micro': { + 'id': 't2.micro', + 'name': 'Burstable Performance Micro Instance', + 'ram': 1024, + 'disk': 0, # EBS Only + 'bandwidth': None, + 'extra': { + 'cpu': 1 + } + }, + # Burstable Performance General Purpose + 't2.small': { + 'id': 't2.small', + 'name': 'Burstable Performance Small Instance', + 'ram': 2048, + 'disk': 0, # EBS Only + 'bandwidth': None, + 'extra': { + 'cpu': 11 + } + }, + 't2.medium': { + 'id': 't2.medium', + 'name': 'Burstable Performance Medium Instance', + 'ram': 4028, + 'disk': 0, # EBS Only + 'bandwidth': None, + 'extra': { + 'cpu': 2 + } } } @@ -377,7 +408,10 @@ REGION_DETAILS = { 'r3.xlarge', 'r3.2xlarge', 'r3.4xlarge', - 'r3.8xlarge' + 'r3.8xlarge', + 't2.micro', + 't2.small', + 't2.medium' ] }, # US West (Northern California) Region @@ -453,7 +487,10 @@ REGION_DETAILS = { 'r3.xlarge', 'r3.2xlarge', 'r3.4xlarge', - 'r3.8xlarge' + 'r3.8xlarge', + 't2.micro', + 't2.small', + 't2.medium' ] }, # EU (Ireland) Region @@ -492,7 +529,10 @@ REGION_DETAILS = { 'r3.xlarge', 'r3.2xlarge', 'r3.4xlarge', - 'r3.8xlarge' + 'r3.8xlarge', + 't2.micro', + 't2.small', + 't2.medium' ] }, # Asia Pacific (Singapore) Region @@ -525,6 +565,9 @@ REGION_DETAILS = { 'i2.2xlarge', 'i2.4xlarge', 'i2.8xlarge', + 't2.micro', + 't2.small', + 't2.medium' ] }, # Asia Pacific (Tokyo) Region @@ -562,7 +605,10 @@ REGION_DETAILS = { 'r3.xlarge', 'r3.2xlarge', 'r3.4xlarge', - 'r3.8xlarge' + 'r3.8xlarge', + 't2.micro', + 't2.small', + 't2.medium' ] }, # South America (Sao Paulo) Region @@ -584,7 +630,10 @@ REGION_DETAILS = { 'm3.xlarge', 'm3.2xlarge', 'c1.medium', - 'c1.xlarge' + 'c1.xlarge', + 't2.micro', + 't2.small', + 't2.medium' ] }, # Asia Pacific (Sydney) Region @@ -621,7 +670,13 @@ REGION_DETAILS = { 'r3.xlarge', 'r3.2xlarge', 'r3.4xlarge', - 'r3.8xlarge' + 'r3.8xlarge', + 't2.micro', + 't2.small', + 't2.medium' + 't2.micro', + 't2.small', + 't2.medium' ] }, 'nimbus': { http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef823b95/libcloud/data/pricing.json ---------------------------------------------------------------------- diff --git a/libcloud/data/pricing.json b/libcloud/data/pricing.json index e8aa7bf..3b4e869 100644 --- a/libcloud/data/pricing.json +++ b/libcloud/data/pricing.json @@ -1,6 +1,9 @@ { "compute": { "ec2_us_west_oregon": { + "t2.micro": "0.013", + "t2.small": "0.026", + "t2.medium": "0.052", "m3.medium": "0.070", "m3.large": "0.140", "m3.xlarge": "0.280", @@ -36,6 +39,9 @@ "t1.micro": "0.020" }, "ec2_us_west": { + "t2.micro": "0.017", + "t2.small": "0.034", + "t2.medium": "0.068", "m3.medium": "0.077", "m3.large": "0.154", "m3.xlarge": "0.308", @@ -67,6 +73,9 @@ "t1.micro": "0.025" }, "ec2_eu_west": { + "t2.micro": "0.014", + "t2.small": "0.028", + "t2.medium": "0.056", "m3.medium": "0.077", "m3.large": "0.154", "m3.xlarge": "0.308", @@ -121,6 +130,9 @@ "8": 1.612 }, "ec2_ap_southeast_2": { + "t2.micro": "0.020", + "t2.small": "0.040", + "t2.medium": "0.080", "m3.medium": "0.098", "m3.large": "0.196", "m3.xlarge": "0.392", @@ -155,6 +167,9 @@ "1": 0.416 }, "ec2_us_east": { + "t2.micro": "0.013", + "t2.small": "0.026", + "t2.medium": "0.052", "m3.medium": "0.070", "m3.large": "0.140", "m3.xlarge": "0.280", @@ -209,6 +224,9 @@ "8": 1.2 }, "ec2_sa_east": { + "t2.micro": "0.027", + "t2.small": "0.054", + "t2.medium": "0.108", "m3.medium": "0.095", "m3.large": "0.190", "m3.xlarge": "0.381", @@ -254,6 +272,9 @@ "8": 1.44 }, "ec2_ap_northeast": { + "t2.micro": "0.020", + "t2.small": "0.040", + "t2.medium": "0.080", "m3.medium": "0.101", "m3.large": "0.203", "m3.xlarge": "0.405", @@ -374,6 +395,9 @@ "1gb": 0.15 }, "ec2_ap_southeast": { + "t2.micro": "0.020", + "t2.small": "0.040", + "t2.medium": "0.080", "m3.medium": "0.098", "m3.large": "0.196", "m3.xlarge": "0.392", @@ -562,5 +586,5 @@ } }, "storage": {}, - "updated": 1397154837 + "updated": 1410023366 } http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef823b95/libcloud/test/compute/test_ec2.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py index 3f531cd..02ab8a8 100644 --- a/libcloud/test/compute/test_ec2.py +++ b/libcloud/test/compute/test_ec2.py @@ -373,7 +373,7 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin): self.assertTrue('m2.4xlarge' in ids) if region_name == 'us-east-1': - self.assertEqual(len(sizes), 33) + self.assertEqual(len(sizes), 36) self.assertTrue('cg1.4xlarge' in ids) self.assertTrue('cc2.8xlarge' in ids) self.assertTrue('cr1.8xlarge' in ids) @@ -382,11 +382,11 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin): if region_name == 'us-west-2': self.assertEqual(len(sizes), 29) elif region_name == 'ap-southeast-1': - self.assertEqual(len(sizes), 24) + self.assertEqual(len(sizes), 27) elif region_name == 'ap-southeast-2': - self.assertEqual(len(sizes), 29) + self.assertEqual(len(sizes), 32) elif region_name == 'eu-west-1': - self.assertEqual(len(sizes), 31) + self.assertEqual(len(sizes), 34) self.driver.region_name = region_old
