From 7ce560f4529f290d68dec314541cb7e9f03f751c Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 13 Mar 2019 15:52:54 -0700 Subject: [PATCH] Terraform: Support for (Regional)Disk physicalBlockSizeBytes (#211) /cc @drebes --- plugins/modules/gcp_compute_disk.py | 19 ++++++++++++++++++ plugins/modules/gcp_compute_disk_facts.py | 9 +++++++++ plugins/modules/gcp_compute_region_disk.py | 20 +++++++++++++++++++ .../modules/gcp_compute_region_disk_facts.py | 9 +++++++++ 4 files changed, 57 insertions(+) diff --git a/plugins/modules/gcp_compute_disk.py b/plugins/modules/gcp_compute_disk.py index 818123c..4c2c197 100644 --- a/plugins/modules/gcp_compute_disk.py +++ b/plugins/modules/gcp_compute_disk.py @@ -89,6 +89,15 @@ options: of sizeGb must not be less than the size of the sourceImage or the size of the snapshot. required: false + physical_block_size_bytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a request, + a default value is used. Currently supported sizes are 4096 and 16384, other + sizes may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + required: false + version_added: 2.8 type: description: - URL of the disk type resource describing which disk type to use to create the @@ -262,6 +271,15 @@ users: .' returned: success type: list +physicalBlockSizeBytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a request, + a default value is used. Currently supported sizes are 4096 and 16384, other sizes + may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + returned: success + type: int type: description: - URL of the disk type resource describing which disk type to use to create the @@ -587,6 +605,7 @@ def response_to_hash(module, response): u'name': module.params.get('name'), u'sizeGb': response.get(u'sizeGb'), u'users': response.get(u'users'), + u'physicalBlockSizeBytes': response.get(u'physicalBlockSizeBytes'), u'type': response.get(u'type'), u'sourceImage': module.params.get('source_image'), } diff --git a/plugins/modules/gcp_compute_disk_facts.py b/plugins/modules/gcp_compute_disk_facts.py index 4cd90ee..0eac0ae 100644 --- a/plugins/modules/gcp_compute_disk_facts.py +++ b/plugins/modules/gcp_compute_disk_facts.py @@ -138,6 +138,15 @@ items: .' returned: success type: list + physicalBlockSizeBytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a + request, a default value is used. Currently supported sizes are 4096 and 16384, + other sizes may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + returned: success + type: int type: description: - URL of the disk type resource describing which disk type to use to create diff --git a/plugins/modules/gcp_compute_region_disk.py b/plugins/modules/gcp_compute_region_disk.py index 416e85b..cd2500b 100644 --- a/plugins/modules/gcp_compute_region_disk.py +++ b/plugins/modules/gcp_compute_region_disk.py @@ -88,6 +88,14 @@ options: of sizeGb must not be less than the size of the sourceImage or the size of the snapshot. required: false + physical_block_size_bytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a request, + a default value is used. Currently supported sizes are 4096 and 16384, other + sizes may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + required: false replica_zones: description: - URLs of the zones where the disk should be replicated to. @@ -230,6 +238,15 @@ users: .' returned: success type: list +physicalBlockSizeBytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a request, + a default value is used. Currently supported sizes are 4096 and 16384, other sizes + may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + returned: success + type: int replicaZones: description: - URLs of the zones where the disk should be replicated to. @@ -332,6 +349,7 @@ def main(): licenses=dict(type='list', elements='str'), name=dict(required=True, type='str'), size_gb=dict(type='int'), + physical_block_size_bytes=dict(type='int'), replica_zones=dict(required=True, type='list', elements='str'), type=dict(type='str'), region=dict(required=True, type='str'), @@ -420,6 +438,7 @@ def resource_to_request(module): u'licenses': module.params.get('licenses'), u'name': module.params.get('name'), u'sizeGb': module.params.get('size_gb'), + u'physicalBlockSizeBytes': module.params.get('physical_block_size_bytes'), u'replicaZones': module.params.get('replica_zones'), u'type': region_disk_type_selflink(module.params.get('type'), module.params), } @@ -498,6 +517,7 @@ def response_to_hash(module, response): u'name': module.params.get('name'), u'sizeGb': response.get(u'sizeGb'), u'users': response.get(u'users'), + u'physicalBlockSizeBytes': response.get(u'physicalBlockSizeBytes'), u'replicaZones': response.get(u'replicaZones'), u'type': response.get(u'type'), } diff --git a/plugins/modules/gcp_compute_region_disk_facts.py b/plugins/modules/gcp_compute_region_disk_facts.py index d2f310d..d571944 100644 --- a/plugins/modules/gcp_compute_region_disk_facts.py +++ b/plugins/modules/gcp_compute_region_disk_facts.py @@ -138,6 +138,15 @@ items: .' returned: success type: list + physicalBlockSizeBytes: + description: + - Physical block size of the persistent disk, in bytes. If not present in a + request, a default value is used. Currently supported sizes are 4096 and 16384, + other sizes may be added in the future. + - If an unsupported value is requested, the error message will list the supported + values for the caller's project. + returned: success + type: int replicaZones: description: - URLs of the zones where the disk should be replicated to.