[PATCH v3 09/36] terraform/oci: Add Kconfig choices for disk performance provisioning

Chuck Lever <[email protected]>
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Chuck Lever <[email protected]>

Add the vpus_per_gb argument when provisioning disk drives to
control how much performance is available. This is similar to
the performance settings available for other providers.

Reviewed-by: Luis Chamberlain <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
---
 .../templates/oci/terraform.tfvars.j2         |   1 +
 terraform/oci/kconfigs/Kconfig.storage        | 132 ++++++++++++++++++
 terraform/oci/main.tf                         |   1 +
 terraform/oci/vars.tf                         |   5 +
 terraform/oci/volumes/main.tf                 |  12 +-
 terraform/oci/volumes/vars.tf                 |   5 +
 6 files changed, 151 insertions(+), 5 deletions(-)

diff --git a/playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 b/playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2
index 9c32ea5884d4..0839bfacfb24 100644
--- a/playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2
+++ b/playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2
@@ -18,6 +18,7 @@ oci_subnet_ocid = "{{ terraform_oci_subnet_ocid }}"
 {% endif %}
 oci_volumes_per_instance = {{ terraform_oci_volumes_per_instance }}
 oci_volumes_size = {{ terraform_oci_volumes_size }}
+oci_vpus_per_gb = {{ terraform_oci_vpus_per_gb }}
 oci_data_volume_device_file_name = "{{ terraform_oci_data_volume_device_file_name }}"
 oci_sparse_volume_device_file_name = "{{ terraform_oci_sparse_volume_device_file_name }}"
 
diff --git a/terraform/oci/kconfigs/Kconfig.storage b/terraform/oci/kconfigs/Kconfig.storage
index ed872a26834e..15a2a05bb26a 100644
--- a/terraform/oci/kconfigs/Kconfig.storage
+++ b/terraform/oci/kconfigs/Kconfig.storage
@@ -122,6 +122,138 @@ config TERRAFORM_OCI_VOLUMES_SIZE
 	default 4096 if TERRAFORM_OCI_VOLUMES_SIZE_4096G
 	default 8192 if TERRAFORM_OCI_VOLUMES_SIZE_8192G
 
+choice
+	prompt "Volume Performance Units for each additional volume"
+	default TERRAFORM_OCI_VPUS_PER_GB_10
+	help
+	  Higher VPUs per GB increases maximum IOPS and throughput,
+	  but costs more. For more information, see:
+
+	  https://docs.oracle.com/en-us/iaas/Content/Block/Concepts/blockvolumeperformance.htm#vpus
+
+config TERRAFORM_OCI_VPUS_PER_GB_0
+	bool "0 VPUs"
+	help
+	  Lowest cost.
+
+	  2 IOPS/GB, 3,000 IOPS maximum/volume.
+	  480 MBPS maximum/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_10
+	bool "10 VPUs"
+	help
+	  Balanced performance.
+
+	  60 IOPS/GB, 25,000 IOPS maximum/volume.
+	  480 MBPS maximum/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_20
+	bool "20 VPUs"
+	help
+	  Higher performance.
+
+	  75 IOPS/GB, 50,000 IOPS maximum/volume.
+	  680 MBPS maximum/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_30
+	bool "30 VPUs"
+	help
+	  Ultra high performance.
+
+	  90 IOPS/GB, 75,000 IOPS maximum/volume.
+	  880 MBPS/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_40
+	bool "40 VPUs"
+	help
+	  Ultra high performance.
+
+	  105 IOPS/GB, 100,000 IOPS maximum/volume.
+	  1,080 MBPS maximum/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_50
+	bool "50 VPUs"
+	help
+	  Ultra high performance.
+
+	  120 IOPS/GB, 125,000 IOPS maximum/volume.
+	  1,280 max MBPS/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_60
+	bool "60 VPUs"
+	help
+	  Ultra high performance.
+
+	  135 IOPS/GB, 150,000 IOPS maximum/volume.
+	  1,480 max MBPS/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_70
+	bool "70 VPUs"
+	help
+	  Ultra high performance.
+
+	  150 IOPS/GB, 175,000 IOPS maximum/volume.
+	  1,680 max MBPS/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_80
+	bool "80 VPUs"
+	help
+	  Ultra high performance.
+
+	  165 IOPS/GB, 200,000 IOPS maximum/volume.
+	  1,880 max MBPS/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_90
+	bool "90 VPUs"
+	help
+	  Ultra high performance.
+
+	  180 IOPS/GB, 225,000 IOPS maximum/volume.
+	  2,080 max MBPS/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_100
+	bool "100 VPUs"
+	help
+	  Ultra high performance.
+
+	  195 IOPS/GB, 250,000 IOPS maximum/volume.
+	  2,280 max MBPS/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_110
+	bool "110 VPUs"
+	help
+	  Ultra high performance.
+
+	  210 IOPS/GB, 275,000 IOPS maximum/volume.
+	  2,480 max MBPS/volume.
+
+config TERRAFORM_OCI_VPUS_PER_GB_120
+	bool "120 VPUs"
+	help
+	  Ultra high performance.
+
+	  225 IOPS/GB, 300,000 IOPS maximum/volume.
+	  2,680 max MBPS/volume.
+
+endchoice
+
+config TERRAFORM_OCI_VPUS_PER_GB
+	int
+	output yaml
+	default 0 if TERRAFORM_OCI_VPUS_PER_GB_0
+	default 10 if TERRAFORM_OCI_VPUS_PER_GB_10
+	default 20 if TERRAFORM_OCI_VPUS_PER_GB_20
+	default 30 if TERRAFORM_OCI_VPUS_PER_GB_30
+	default 40 if TERRAFORM_OCI_VPUS_PER_GB_40
+	default 50 if TERRAFORM_OCI_VPUS_PER_GB_50
+	default 60 if TERRAFORM_OCI_VPUS_PER_GB_60
+	default 70 if TERRAFORM_OCI_VPUS_PER_GB_70
+	default 80 if TERRAFORM_OCI_VPUS_PER_GB_80
+	default 90 if TERRAFORM_OCI_VPUS_PER_GB_90
+	default 100 if TERRAFORM_OCI_VPUS_PER_GB_100
+	default 110 if TERRAFORM_OCI_VPUS_PER_GB_110
+	default 120 if TERRAFORM_OCI_VPUS_PER_GB_120
+
 config TERRAFORM_OCI_DATA_VOLUME_DEVICE_FILE_NAME
 	string "Data volume's device file name"
 	output yaml
diff --git a/terraform/oci/main.tf b/terraform/oci/main.tf
index d231f2225e5d..1d2d0f82e00f 100644
--- a/terraform/oci/main.tf
+++ b/terraform/oci/main.tf
@@ -50,6 +50,7 @@ module "volumes" {
   vol_instance_name       = element(var.kdevops_nodes, count.index)
   vol_volume_count        = var.oci_volumes_per_instance
   vol_volume_size         = var.oci_volumes_size
+  vol_vpus_per_gb         = var.oci_vpus_per_gb
 }
 
 resource "oci_core_vcn" "kdevops_vcn" {
diff --git a/terraform/oci/vars.tf b/terraform/oci/vars.tf
index c116829fbc72..401341feb34b 100644
--- a/terraform/oci/vars.tf
+++ b/terraform/oci/vars.tf
@@ -98,3 +98,8 @@ variable "oci_volumes_size" {
   description = "The size of additional block volumes, in gibibytes"
   type        = number
 }
+
+variable "oci_vpus_per_gb" {
+  description = "Volume performance units"
+  type        = number
+}
diff --git a/terraform/oci/volumes/main.tf b/terraform/oci/volumes/main.tf
index 56b9a476015a..7483ff72836e 100644
--- a/terraform/oci/volumes/main.tf
+++ b/terraform/oci/volumes/main.tf
@@ -1,9 +1,11 @@
 resource "oci_core_volume" "kdevops_volume_extra" {
-  count               = var.vol_volume_count
-  availability_domain = var.vol_availability_domain
-  display_name        = format("kdevops_%s_volume%02d", var.vol_instance_name, count.index + 1)
-  compartment_id      = var.vol_compartment_ocid
-  size_in_gbs         = var.vol_volume_size
+  count                = var.vol_volume_count
+  availability_domain  = var.vol_availability_domain
+  compartment_id       = var.vol_compartment_ocid
+  display_name         = format("kdevops_%s_vol%02d", var.vol_instance_name, count.index + 1)
+  is_auto_tune_enabled = false
+  size_in_gbs          = var.vol_volume_size
+  vpus_per_gb          = var.vol_vpus_per_gb
 }
 
 locals {
diff --git a/terraform/oci/volumes/vars.tf b/terraform/oci/volumes/vars.tf
index 57c5e2bf646b..ee702c2d713f 100644
--- a/terraform/oci/volumes/vars.tf
+++ b/terraform/oci/volumes/vars.tf
@@ -27,3 +27,8 @@ variable "vol_volume_size" {
   description = "Size of each volume, in gibibytes"
   type        = number
 }
+
+variable "vol_vpus_per_gb" {
+  description = "Volume performance units"
+  type        = number
+}
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.