Skip to content

Commit 2cfb830

Browse files
JCS-14392 - Issue with volume attachments on scale-out (#245)
- Make the keys of the maps of compute and volumes resources to have 2 digits at the end, to conserve the iteration order, which is lexicographical, to prevent volume attachments from being reassigned to other instances because of the iteration order in the list of compute instances Tests: - Created a non-JRF stack with new VCN, and two nodes - Scaled up the stack to 4 nodes, verified the apply job completed successfully and that all servers were added. - Scaled up the stack to 10 nodes, and verified the same points above - Scaled up the stack to 11 nodes, and made the same verifications above, and verified that the existing block volume attachments and block volumes where not affected - Scaled up the stack to 20 nodes, and made the same verifications above - Scaled up the stack to 30 nodes, and made the same verifications above - Scaled down the stack to 10 nodes. Verified that only the artifacts 29 to 10 are deleted, and the rest of the servers are still running
1 parent 2515cf2 commit 2cfb830

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

terraform/modules/compute/wls_compute/wls_compute.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023, Oracle and/or its affiliates.
1+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
module "compute-keygen" {
@@ -9,7 +9,7 @@ module "wls-instances" {
99

1010
source = "../instance"
1111

12-
instance_params = { for x in range(var.num_vm_instances) : "${local.host_label}-${x}" => {
12+
instance_params = { for x in range(var.num_vm_instances) : "${local.host_label}-${format("%02d", x)}" => {
1313

1414
availability_domain = var.use_regional_subnet ? local.ad_names[(x + local.admin_ad_index) % length(local.ad_names)] : var.availability_domain
1515

terraform/modules/compute/wls_compute/wls_volume.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Copyright (c) 2023, Oracle and/or its affiliates.
1+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
module "middleware-volume" {
55
source = "../volume"
6-
bv_params = { for x in range(var.num_vm_instances) : "${var.resource_name_prefix}-mw-block-${x}" => {
6+
bv_params = { for x in range(var.num_vm_instances) : "${var.resource_name_prefix}-mw-block-${format("%02d", x)}" => {
77
ad = var.use_regional_subnet ? local.ad_names[(x + local.admin_ad_index) % length(local.ad_names)] : var.availability_domain
88
compartment_id = var.compartment_id
99
display_name = "${var.resource_name_prefix}-mw-block-${x}"
@@ -18,7 +18,7 @@ module "middleware-volume" {
1818

1919
module "data-volume" {
2020
source = "../volume"
21-
bv_params = { for x in range(var.num_vm_instances) : "${var.resource_name_prefix}-data-block-${x}" => {
21+
bv_params = { for x in range(var.num_vm_instances) : "${var.resource_name_prefix}-data-block-${format("%02d", x)}" => {
2222
ad = var.use_regional_subnet ? local.ad_names[(x + local.admin_ad_index) % length(local.ad_names)] : var.availability_domain
2323
compartment_id = var.compartment_id
2424
display_name = "${var.resource_name_prefix}-data-block-${x}"
@@ -35,7 +35,7 @@ module "middleware_volume_attach" {
3535

3636
bv_params = { empty = { ad = "", compartment_id = "", display_name = "", bv_size = 0, defined_tags = { def = "" }, freeform_tags = { free = "" } } }
3737

38-
bv_attach_params = { for x in range(var.num_vm_instances * var.num_volumes) : "${var.resource_name_prefix}-block-volume-attach-${x}" => {
38+
bv_attach_params = { for x in range(var.num_vm_instances * var.num_volumes) : "${var.resource_name_prefix}-block-volume-attach-${format("%02d", x)}" => {
3939
display_name = "${var.resource_name_prefix}-block-volume-attach-${x}"
4040
attachment_type = "iscsi"
4141
instance_id = module.wls-instances.instance_ids[x / var.num_volumes]
@@ -49,7 +49,7 @@ module "data_volume_attach" {
4949

5050
bv_params = { empty = { ad = "", compartment_id = "", display_name = "", bv_size = 0, defined_tags = { def = "" }, freeform_tags = { free = "" } } }
5151

52-
bv_attach_params = { for x in range(var.num_vm_instances * var.num_volumes) : "${var.resource_name_prefix}-block-volume-attach-${x}" => {
52+
bv_attach_params = { for x in range(var.num_vm_instances * var.num_volumes) : "${var.resource_name_prefix}-block-volume-attach-${format("%02d", x)}" => {
5353
display_name = "${var.resource_name_prefix}-block-volume-attach-${x}"
5454
attachment_type = "iscsi"
5555
instance_id = module.wls-instances.instance_ids[x / var.num_volumes]

0 commit comments

Comments
 (0)