Repository: libcloud Updated Branches: refs/heads/trunk 77ce44703 -> 9e8fa1b85
update linode plans mapping Closes #351 Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9e8fa1b8 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9e8fa1b8 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9e8fa1b8 Branch: refs/heads/trunk Commit: 9e8fa1b850f3a378ef3788de070c11125d147e40 Parents: 77ce447 Author: Jon Chen <[email protected]> Authored: Mon Aug 25 16:26:18 2014 -0400 Committer: Tomaz Muraus <[email protected]> Committed: Tue Aug 26 22:08:36 2014 +0200 ---------------------------------------------------------------------- libcloud/common/linode.py | 19 +++--- .../fixtures/linode/_avail_linodeplans.json | 65 +++++++++++++++----- .../compute/fixtures/linode/_linode_list.json | 2 +- libcloud/test/compute/test_linode.py | 4 +- 4 files changed, 62 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e8fa1b8/libcloud/common/linode.py ---------------------------------------------------------------------- diff --git a/libcloud/common/linode.py b/libcloud/common/linode.py index 6ee9cc6..c547514 100644 --- a/libcloud/common/linode.py +++ b/libcloud/common/linode.py @@ -31,15 +31,16 @@ __all__ = [ API_HOST = 'api.linode.com' API_ROOT = '/' -# Constants that map a RAM figure to a PlanID (updated 4/25/14) -LINODE_PLAN_IDS = {2048: '1', - 4096: '3', - 8192: '5', - 16384: '6', - 32768: '7', - 49152: '8', - 65536: '9', - 98304: '11'} +# Constants that map a RAM figure to a PlanID (updated 2014-08-25) +LINODE_PLAN_IDS = {1024: '1', + 2048: '2', + 4096: '4', + 8192: '6', + 16384: '7', + 32768: '8', + 49152: '9', + 65536: '10', + 98304: '12'} class LinodeException(Exception): http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e8fa1b8/libcloud/test/compute/fixtures/linode/_avail_linodeplans.json ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/fixtures/linode/_avail_linodeplans.json b/libcloud/test/compute/fixtures/linode/_avail_linodeplans.json index c492e62..ac24889 100644 --- a/libcloud/test/compute/fixtures/linode/_avail_linodeplans.json +++ b/libcloud/test/compute/fixtures/linode/_avail_linodeplans.json @@ -1,10 +1,28 @@ { "ERRORARRAY": [], "DATA": [{ + "CORES": 1, + "PRICE": 10.00, + "RAM": 1024, + "XFER": 2000, + "PLANID": 1, + "LABEL": "Linode 1024", + "AVAIL": { + "3": 500, + "2": 500, + "7": 500, + "6": 500, + "4": 500, + "8": 500 + }, + "DISK": 24, + "HOURLY": 0.0150 + }, { + "CORES": 2, "PRICE": 20.00, "RAM": 2048, "XFER": 3000, - "PLANID": 1, + "PLANID": 2, "LABEL": "Linode 2048", "AVAIL": { "3": 500, @@ -14,12 +32,14 @@ "4": 500, "8": 500 }, - "DISK": 48 + "DISK": 48, + "HOURLY": 0.0300 }, { + "CORES": 4, "PRICE": 40.00, "RAM": 4096, "XFER": 4000, - "PLANID": 3, + "PLANID": 4, "LABEL": "Linode 4096", "AVAIL": { "3": 500, @@ -29,12 +49,14 @@ "4": 500, "8": 500 }, - "DISK": 96 + "DISK": 96, + "HOURLY": 0.0600 }, { + "CORES": 6, "PRICE": 80.00, "RAM": 8192, "XFER": 8000, - "PLANID": 5, + "PLANID": 6, "LABEL": "Linode 8192", "AVAIL": { "3": 500, @@ -44,12 +66,14 @@ "4": 500, "8": 500 }, - "DISK": 192 + "DISK": 192, + "HOURLY": 0.1200 }, { + "CORES": 8, "PRICE": 160.00, "RAM": 16384, "XFER": 16000, - "PLANID": 6, + "PLANID": 7, "LABEL": "Linode 16384", "AVAIL": { "3": 500, @@ -59,12 +83,14 @@ "4": 500, "8": 500 }, - "DISK": 384 + "DISK": 384, + "HOURLY": 0.2400 }, { + "CORES": 12, "PRICE": 320.00, "RAM": 32768, "XFER": 20000, - "PLANID": 7, + "PLANID": 8, "LABEL": "Linode 32768", "AVAIL": { "3": 500, @@ -74,12 +100,14 @@ "4": 500, "8": 500 }, - "DISK": 768 + "DISK": 768, + "HOURLY": 0.4800 }, { + "CORES": 16, "PRICE": 480.00, "RAM": 49152, "XFER": 20000, - "PLANID": 8, + "PLANID": 9, "LABEL": "Linode 49152", "AVAIL": { "3": 500, @@ -89,12 +117,14 @@ "4": 500, "8": 500 }, - "DISK": 1152 + "DISK": 1152, + "HOURLY": 0.7200 }, { + "CORES": 20, "PRICE": 640.00, "RAM": 65536, "XFER": 20000, - "PLANID": 9, + "PLANID": 10, "LABEL": "Linode 65536", "AVAIL": { "3": 500, @@ -104,12 +134,14 @@ "4": 500, "8": 500 }, - "DISK": 1536 + "DISK": 1536, + "HOURLY": 0.9600 }, { + "CORES": 20, "PRICE": 960.00, "RAM": 98304, "XFER": 20000, - "PLANID": 11, + "PLANID": 12, "LABEL": "Linode 98304", "AVAIL": { "3": 500, @@ -119,7 +151,8 @@ "4": 500, "8": 500 }, - "DISK": 1920 + "DISK": 1920, + "HOURLY": 1.4400 }], "ACTION": "avail.linodeplans" } http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e8fa1b8/libcloud/test/compute/fixtures/linode/_linode_list.json ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/fixtures/linode/_linode_list.json b/libcloud/test/compute/fixtures/linode/_linode_list.json index 4baf897..345f7ca 100644 --- a/libcloud/test/compute/fixtures/linode/_linode_list.json +++ b/libcloud/test/compute/fixtures/linode/_linode_list.json @@ -22,7 +22,7 @@ "ALERT_BWOUT_ENABLED": 1, "BACKUPSENABLED": 1, "ALERT_CPU_THRESHOLD": 90, - "PLANID": "1", + "PLANID": "2", "BACKUPWEEKLYDAY": 0, "LABEL": "api-node3", "LPM_DISPLAYGROUP": "test", http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e8fa1b8/libcloud/test/compute/test_linode.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_linode.py b/libcloud/test/compute/test_linode.py index 4c7c80f..090e4d8 100644 --- a/libcloud/test/compute/test_linode.py +++ b/libcloud/test/compute/test_linode.py @@ -43,7 +43,7 @@ class LinodeTest(unittest.TestCase, TestCaseMixin): node = nodes[0] self.assertEqual(node.id, "8098") self.assertEqual(node.name, 'api-node3') - self.assertEqual(node.extra['PLANID'], '1') + self.assertEqual(node.extra['PLANID'], '2') self.assertTrue('75.127.96.245' in node.public_ips) self.assertEqual(node.private_ips, []) @@ -77,7 +77,7 @@ class LinodeTest(unittest.TestCase, TestCaseMixin): def test_list_sizes(self): sizes = self.driver.list_sizes() - self.assertEqual(len(sizes), 8) + self.assertEqual(len(sizes), 9) for size in sizes: self.assertEqual(size.ram, int(size.name.split(" ")[1]))
