adding disk_type option to choose from pd-ssd or pd-standard

pull/18777/head
Peter Mooshammer 10 years ago committed by Matt Clay
parent 49f5b28fbd
commit d741b57b91

@ -108,6 +108,14 @@ options:
required: false required: false
default: null default: null
aliases: [] aliases: []
disk_type:
version_added: "1.9"
description:
- type of disk provisioned
required: false
default: "pd-standard"
choices: ["pd-standard", "pd-ssd"]
aliases: []
requirements: [ "libcloud" ] requirements: [ "libcloud" ]
author: Eric Johnson <erjohnso@google.com> author: Eric Johnson <erjohnso@google.com>
@ -144,6 +152,7 @@ def main():
mode = dict(default='READ_ONLY', choices=['READ_WRITE', 'READ_ONLY']), mode = dict(default='READ_ONLY', choices=['READ_WRITE', 'READ_ONLY']),
name = dict(required=True), name = dict(required=True),
size_gb = dict(default=10), size_gb = dict(default=10),
disk_type = dict(default='pd-standard'),
image = dict(), image = dict(),
snapshot = dict(), snapshot = dict(),
state = dict(default='present'), state = dict(default='present'),
@ -161,6 +170,7 @@ def main():
mode = module.params.get('mode') mode = module.params.get('mode')
name = module.params.get('name') name = module.params.get('name')
size_gb = module.params.get('size_gb') size_gb = module.params.get('size_gb')
disk_type = module.params.get('disk_type')
image = module.params.get('image') image = module.params.get('image')
snapshot = module.params.get('snapshot') snapshot = module.params.get('snapshot')
state = module.params.get('state') state = module.params.get('state')
@ -174,7 +184,7 @@ def main():
disk = inst = None disk = inst = None
changed = is_attached = False changed = is_attached = False
json_output = { 'name': name, 'zone': zone, 'state': state } json_output = { 'name': name, 'zone': zone, 'state': state, 'disk_type': disk_type }
if detach_only: if detach_only:
json_output['detach_only'] = True json_output['detach_only'] = True
json_output['detached_from_instance'] = instance_name json_output['detached_from_instance'] = instance_name
@ -233,7 +243,7 @@ def main():
try: try:
disk = gce.create_volume( disk = gce.create_volume(
size_gb, name, location=zone, image=lc_image, size_gb, name, location=zone, image=lc_image,
snapshot=lc_snapshot) snapshot=lc_snapshot, ex_disk_type=disk_type)
except ResourceExistsError: except ResourceExistsError:
pass pass
except QuotaExceededError: except QuotaExceededError:

Loading…
Cancel
Save