Repository: libcloud Updated Branches: refs/heads/trunk e33132dc6 -> f40c31118
[google compute] improve GCE create_node, make sure ex_get_disktype function will not fail Closes #448 Signed-off-by: Eric Johnson <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f40c3111 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f40c3111 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f40c3111 Branch: refs/heads/trunk Commit: f40c3111800285d5164523379c95dca92c0d3240 Parents: e33132d Author: Markos Gogoulos <[email protected]> Authored: Tue Feb 10 18:50:55 2015 +0200 Committer: Eric Johnson <[email protected]> Committed: Fri Feb 13 02:46:20 2015 +0000 ---------------------------------------------------------------------- CHANGES.rst | 4 ++++ libcloud/compute/drivers/gce.py | 4 ++-- .../gce/zones_europe-west1-a_diskTypes_pd_standard.json | 10 ++++++++++ libcloud/test/compute/test_gce.py | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f40c3111/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index 42ad0ad..7910c7b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,6 +16,10 @@ General Compute ~~~~~~~ +- Improve GCE create_node, make sure ex_get_disktype function + (GITHUB-448) + [Markos Gogoulos] + - GCE driver fix to handle unknown image projects (GITHUB-447) [Markos Gogoulos] http://git-wip-us.apache.org/repos/asf/libcloud/blob/f40c3111/libcloud/compute/drivers/gce.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index cfba8d6..b681e1c 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -2178,7 +2178,7 @@ n if image and not hasattr(image, 'name'): image = self.ex_get_image(image) if not hasattr(ex_disk_type, 'name'): - ex_disk_type = self.ex_get_disktype(ex_disk_type) + ex_disk_type = self.ex_get_disktype(ex_disk_type, zone=location) # Use disks[].initializeParams to auto-create the boot disk if not ex_disks_gce_struct and not ex_boot_disk: @@ -2364,7 +2364,7 @@ n if image and not hasattr(image, 'name'): image = self.ex_get_image(image) if not hasattr(ex_disk_type, 'name'): - ex_disk_type = self.ex_get_disktype(ex_disk_type) + ex_disk_type = self.ex_get_disktype(ex_disk_type, zone=location) node_attrs = {'size': size, 'image': image, http://git-wip-us.apache.org/repos/asf/libcloud/blob/f40c3111/libcloud/test/compute/fixtures/gce/zones_europe-west1-a_diskTypes_pd_standard.json ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/fixtures/gce/zones_europe-west1-a_diskTypes_pd_standard.json b/libcloud/test/compute/fixtures/gce/zones_europe-west1-a_diskTypes_pd_standard.json new file mode 100644 index 0000000..dea0e2f --- /dev/null +++ b/libcloud/test/compute/fixtures/gce/zones_europe-west1-a_diskTypes_pd_standard.json @@ -0,0 +1,10 @@ +{ +"creationTimestamp": "2014-06-02T11:07:28.530-07:00", + "defaultDiskSizeGb": "500", + "description": "Standard Persistent Disk", + "kind": "compute#diskType", + "name": "pd-standard", + "selfLink": "https://www.googleapis.com/compute/v1/projects/gifted-electron-225/zones/europe-west1-a/diskTypes/pd-standard", + "validDiskSize": "10GB-10240GB", + "zone": "https://www.googleapis.com/compute/v1/projects/gifted-electron-225/zones/europe-west1-a" +} http://git-wip-us.apache.org/repos/asf/libcloud/blob/f40c3111/libcloud/test/compute/test_gce.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py index 3b2c34e..6a6254e 100644 --- a/libcloud/test/compute/test_gce.py +++ b/libcloud/test/compute/test_gce.py @@ -2259,6 +2259,10 @@ class GCEMockHttp(MockHttpTestCase): body = self.fixtures.load('zones_europe-west1-a_instances.json') return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK]) + def _zones_europe_west1_a_diskTypes_pd_standard(self, method, url, body, headers): + body = self.fixtures.load('zones_europe-west1-a_diskTypes_pd_standard.json') + return (httplib.OK, body, self.json_hdr, httplib.responses[httplib.OK]) + def _zones_us_central1_a_instances(self, method, url, body, headers): if method == 'POST': body = self.fixtures.load(
