Skip to content

Commit

Permalink
[google compute] improve GCE create_node, make sure ex_get_disktype f…
Browse files Browse the repository at this point in the history
…unction will not fail

Closes #448

Signed-off-by: Eric Johnson <erjohnso@google.com>
  • Loading branch information
Markos Gogoulos authored and erjohnso committed Feb 13, 2015
1 parent e33132d commit f40c311
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions libcloud/compute/drivers/gce.py
Expand Up @@ -2178,7 +2178,7 @@ def create_node(self, name, size, image, location=None,
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:
Expand Down Expand Up @@ -2364,7 +2364,7 @@ def ex_create_multiple_nodes(self, base_name, size, image, number,
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,
Expand Down
@@ -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"
}
4 changes: 4 additions & 0 deletions libcloud/test/compute/test_gce.py
Expand Up @@ -2259,6 +2259,10 @@ def _zones_europe_west1_a_instances(self, method, url, body, headers):
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(
Expand Down

0 comments on commit f40c311

Please sign in to comment.