Skip to content

Commit

Permalink
Support zonal shared disks (Azure#567)
Browse files Browse the repository at this point in the history
* Make SCS Shared disk Premium_ZRS

* Add support for Premium_ZRS zonal disks

* Add Cluster disk info to the Web App

* Don't specify a zone for Premium_ZRS disks

* Ensure that the --username parameter is correct

* Fix error message in variables_global.tf

* Remove unused variables in variables_global.tf

* Refactor error message in variables_global.tf

* Added database_cluster_disk_type

* Update scs_cluster_disk_lun and database_cluster_disk_lun properties in SystemModel.cs

* Remove trailing spaces in parameter names in SystemDetails.json

* Fix ARM_CLIENT_ID variable interpolation in configure_deployer.sh.tmpl

* Update proximity_placement_group_id in vm-app.tf

* Fix zone assignment for scs_cluster_disk_type in vm-scs.tf

* Update disk zone configuration

* Update proximity_placement_group_id in vm-app.tf

* Update proximity placement group ID in app tier VM configuration

* Merge branch 'experimental'

---------

Co-authored-by: Kimmo Forss <[email protected]>
  • Loading branch information
KimForss and Kimmo Forss authored Mar 19, 2024
1 parent ce6a6ef commit 1fff160
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 28 deletions.
14 changes: 14 additions & 0 deletions Webapp/SDAF/Models/SystemModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,22 @@ public bool IsValid()
public bool? use_simple_mount { get; set; } = false;

public string database_cluster_type { get; set; } = "AFA";

public string scs_cluster_type { get; set; } = "AFA";


public int? scs_cluster_disk_lun { get; set; } = 5;

public int? scs_cluster_disk_size { get; set; } = 128;

public string scs_cluster_disk_type { get; set; } = "Premium_ZRS";

public int? database_cluster_disk_lun { get; set; } = 8;

public int? database_cluster_disk_size { get; set; } = 128;

public string database_cluster_disk_type { get; set; } = "Premium_ZRS";

/*---------------------------------------------------------------------------8
| |
| PPG information |
Expand Down
72 changes: 72 additions & 0 deletions Webapp/SDAF/ParameterDetails/SystemDetails.json
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,78 @@
"Overrules": "",
"Display": 2
},
{
"Name": "scs_cluster_disk_lun",
"Required": false,
"Description": "The LUN of the shared disk for the SAP Central Services cluster",
"Type": "field",
"Options": [],
"Overrules": "",
"Display": 3
},
{
"Name": "scs_cluster_disk_size",
"Required": false,
"Description": "The size of the shared disk for the SAP Central Services cluster",
"Type": "field",
"Options": [],
"Overrules": "",
"Display": 3
},
{
"Name": "scs_cluster_disk_type",
"Required": false,
"Description": "The storage_account_type of the shared disk for the SAP Central Services cluster",
"Type": "lookup",
"Options": [
{
"Text": "Premium LRS",
"Value": "Premium_LRS"
},
{
"Text": "Premium ZRS",
"Value": "Premium_ZRS"
}
],
"Overrules": "",
"Display": 3
},
{
"Name": "database_cluster_disk_lun",
"Required": false,
"Description": "The LUN of the shared disk for the Database cluster",
"Type": "field",
"Options": [],
"Overrules": "",
"Display": 3
},
{
"Name": "database_cluster_disk_size",
"Required": false,
"Description": "The size of the shared disk for the Database cluster",
"Type": "field",
"Options": [],
"Overrules": "",
"Display": 3
},
{
"Name": "database_cluster_disk_type",
"Required": false,
"Description": "The storage_account_type of the shared disk for the Database cluster",
"Type": "lookup",
"Options": [
{
"Text": "Premium LRS",
"Value": "Premium_LRS"
},
{
"Text": "Premium ZRS",
"Value": "Premium_ZRS"
}
],
"Overrules": "",
"Display": 3
},
{
"Name": "use_msi_for_clusters",
"Required": false,
Expand Down
18 changes: 18 additions & 0 deletions Webapp/SDAF/ParameterDetails/SystemTemplate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,27 @@ $$use_private_endpoint$$
# scs_cluster_type defines cluster quorum type; AFA (Azure Fencing Agent), ASD (Azure Shared Disk), ISCSI
$$scs_cluster_type$$

#scs_cluster_disk_lun defines the LUN number for the SAP Central Services cluster disk
$$scs_cluster_disk_lun$$

#scs_cluster_disk_size defines the size for the SAP Central Services cluster disk
$$scs_cluster_disk_size$$

#scs_cluster_disk_type defines the storage_account_type of the shared disk for the SAP Central Services cluster
$$scs_cluster_disk_type$$

# database_cluster_type defines cluster quorum type; AFA (Azure Fencing Agent), ASD (Azure Shared Disk), ISCSI
$$database_cluster_type$$

#database_cluster_disk_lun defines the LUN number for the database cluster disk
$$database_cluster_disk_lun$$

#database_cluster_disk_size defines the size for the database cluster disk
$$database_cluster_disk_size$$

#database_cluster_disk_type defines the storage_account_type of the shared disk for the Database cluster
$$database_cluster_disk_type$$

# use_msi_for_clusters if defined will use managed service identity for the Pacemaker cluster fencing
$$use_msi_for_clusters$$

Expand Down
6 changes: 0 additions & 6 deletions deploy/terraform/run/sap_system/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ module "hdb_node" {
cloudinit_growpart_config = null # This needs more consideration module.common_infrastructure.cloudinit_growpart_config
custom_disk_sizes_filename = try(coalesce(var.custom_disk_sizes_filename, var.db_disk_sizes_filename), "")
database = local.database
database_cluster_disk_lun = var.database_cluster_disk_lun
database_cluster_disk_size = var.database_cluster_disk_size
database_dual_nics = try(module.common_infrastructure.admin_subnet, null) == null ? false : var.database_dual_nics
database_server_count = upper(try(local.database.platform, "HANA")) == "HANA" ? (
local.database.high_availability ? (
Expand Down Expand Up @@ -206,8 +204,6 @@ module "app_tier" {
route_table_id = module.common_infrastructure.route_table_id
sap_sid = local.sap_sid
scale_set_id = try(module.common_infrastructure.scale_set_id, null)
scs_cluster_disk_lun = var.scs_cluster_disk_lun
scs_cluster_disk_size = var.scs_cluster_disk_size
sdu_public_key = module.common_infrastructure.sdu_public_key
sid_keyvault_user_id = module.common_infrastructure.sid_keyvault_user_id
sid_password = module.common_infrastructure.sid_password
Expand Down Expand Up @@ -251,8 +247,6 @@ module "anydb_node" {
0) : (
local.database.high_availability ? 2 * var.database_server_count : var.database_server_count
)
database_cluster_disk_lun = var.database_cluster_disk_lun
database_cluster_disk_size = var.database_cluster_disk_size
db_asg_id = module.common_infrastructure.db_asg_id
db_subnet = module.common_infrastructure.db_subnet
deploy_application_security_groups = var.deploy_application_security_groups
Expand Down
11 changes: 11 additions & 0 deletions deploy/terraform/run/sap_system/tfvar_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ variable "database_cluster_disk_size" {
default = 128
}

variable "database_cluster_disk_type" {
description = "The storage_account_type of the shared disk for the Database cluster"
default = "Premium_ZRS"
}


variable "database_platform" {
description = "Database platform, supported values are HANA, DB2, ORACLE, ORACLE-ASM, ASE, SQLSERVER or NONE (in this case no database tier is deployed)"
default = ""
Expand Down Expand Up @@ -709,6 +715,11 @@ variable "scs_cluster_disk_size" {
default = 128
}

variable "scs_cluster_disk_type" {
description = "The storage_account_type of the shared disk for the SAP Central Services cluster"
default = "Premium_ZRS"
}

#########################################################################################
# #
# Application Server variables #
Expand Down
8 changes: 8 additions & 0 deletions deploy/terraform/run/sap_system/transform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ locals {
deploy_v1_monitoring_extension = var.deploy_v1_monitoring_extension
dual_nics = var.database_dual_nics || try(var.databases[0].dual_nics, false)
high_availability = var.database_high_availability || try(var.databases[0].high_availability, false)
database_cluster_disk_lun = var.database_cluster_disk_lun
database_cluster_disk_size = var.database_cluster_disk_size
database_cluster_disk_type = var.database_cluster_disk_type

platform = var.database_platform
use_ANF = var.database_HANA_use_ANF_scaleout_scenario || try(var.databases[0].use_ANF, false)
use_avset = var.database_server_count == 0 || var.use_scalesets_for_deployment || length(var.database_vm_zones) > 0 || var.database_platform == "NONE" ? (
Expand Down Expand Up @@ -206,6 +210,10 @@ locals {
false) : (
var.scs_server_use_avset
)
scs_cluster_disk_lun = var.scs_cluster_disk_lun
scs_cluster_disk_size = var.scs_cluster_disk_size
scs_cluster_disk_type = var.scs_cluster_disk_type

webdispatcher_count = local.enable_app_tier_deployment ? (
max(var.webdispatcher_server_count, try(var.application_tier.webdispatcher_count, 0))
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ variable "database_server_count" {
description = "The number of database servers"
default = 1
}
variable "database_cluster_disk_size" { description = "The size of the shared disk for the Database cluster" }
variable "database_cluster_disk_lun" { description = "The LUN of the shared disk for the Database cluster" }
variable "database_vm_admin_nic_ips" { description = "If provided, the database tier will be configured with the specified IPs (admin subnet)" }
variable "database_vm_db_nic_ips" { description = "If provided, the database tier will be configured with the specified IPs" }
variable "database_vm_db_nic_secondary_ips" { description = "If provided, the database tier will be configured with the specified IPs as secondary IPs" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,13 @@ resource "azurerm_managed_disk" "cluster" {
location = var.resource_group[0].location
resource_group_name = var.resource_group[0].name
create_option = "Empty"
storage_account_type = "Premium_LRS"
disk_size_gb = var.database_cluster_disk_size
storage_account_type = var.database.database_cluster_disk_type
disk_size_gb = var.database.database_cluster_disk_size
disk_encryption_set_id = try(var.options.disk_encryption_set_id, null)
max_shares = var.database_server_count
tags = var.tags

zone = local.zonal_deployment && !var.database.use_avset ? (
zone = var.database.database_cluster_disk_type == "Premium_LRS" && local.zonal_deployment && !var.database.use_avset ? (
upper(local.anydb_ostype) == "LINUX" ? (
azurerm_linux_virtual_machine.dbserver[local.anydb_disks[count.index].vm_index].zone) : (
azurerm_windows_virtual_machine.dbserver[local.anydb_disks[count.index].vm_index].zone
Expand Down Expand Up @@ -595,7 +595,7 @@ resource "azurerm_virtual_machine_data_disk_attachment" "cluster" {
)
)
caching = "None"
lun = var.database_cluster_disk_lun
lun = var.database.database_cluster_disk_lun
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ variable "management_dns_resourcegroup_name" {
type = string
}

variable "scs_cluster_disk_lun" { description = "The LUN of the shared disk for the SAP Central Services cluster" }
variable "scs_cluster_disk_size" { description = "The size of the shared disk for the SAP Central Services cluster" }

#########################################################################################
# #
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ resource "azurerm_linux_virtual_machine" "app" {
location = var.resource_group[0].location
resource_group_name = var.resource_group[0].name

proximity_placement_group_id = length(var.scale_set_id) > 0 ? (
proximity_placement_group_id = var.application_tier.app_use_avset || length(var.scale_set_id) > 0 ? (
null) : (
var.application_tier.app_use_ppg ? (
var.ppg[count.index % max(length(var.ppg), 1)]) : (
Expand Down Expand Up @@ -240,6 +240,7 @@ resource "azurerm_linux_virtual_machine" "app" {
lifecycle {
ignore_changes = [
source_image_id,
proximity_placement_group_id,
zone
]
}
Expand All @@ -266,7 +267,7 @@ resource "azurerm_windows_virtual_machine" "app" {
source_image_id = var.application_tier.app_os.type == "custom" ? var.application_tier.app_os.source_image_id : null


proximity_placement_group_id = length(var.scale_set_id) > 0 ? (
proximity_placement_group_id = var.application_tier.app_use_avset || length(var.scale_set_id) > 0 ? (
null) : (
var.application_tier.app_use_ppg ? (
var.ppg[count.index % max(length(var.ppg), 1)]) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,12 +574,12 @@ resource "azurerm_managed_disk" "cluster" {
location = var.resource_group[0].location
resource_group_name = var.resource_group[0].name
create_option = "Empty"
storage_account_type = "Premium_LRS"
disk_size_gb = var.scs_cluster_disk_size
storage_account_type = var.application_tier.scs_cluster_disk_type
disk_size_gb = var.application_tier.scs_cluster_disk_size
disk_encryption_set_id = try(var.options.disk_encryption_set_id, null)
max_shares = local.scs_server_count

zone = !local.use_scs_avset ? (
zone = (var.application_tier.scs_cluster_disk_type == "Premium_LRS") && !local.use_scs_avset ? (
upper(var.application_tier.scs_os.os_type) == "LINUX" ? (
azurerm_linux_virtual_machine.scs[local.scs_data_disks[count.index].vm_index].zone) : (
azurerm_windows_virtual_machine.scs[local.scs_data_disks[count.index].vm_index].zone
Expand Down Expand Up @@ -623,7 +623,7 @@ resource "azurerm_virtual_machine_data_disk_attachment" "cluster" {
)
)
caching = "None"
lun = var.scs_cluster_disk_lun
lun = var.application_tier.scs_cluster_disk_lun
}

#########################################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ variable "application_tier" {
var.application_tier.scs_high_availability ? (
var.application_tier.scs_cluster_type != "ASD" ? (
true) : (
length(try(var.application_tier.scs_zones, [])) <= 1
length(try(var.application_tier.scs_zones, [])) <= (var.application_tier.scs_cluster_disk_type == "Premium_ZRS" ? 2 : 1)
)) : (
true
)
)

error_message = "Cluster type 'ASD' does not support cross zonal deployments."
error_message = format("Cluster type 'ASD' with disk type %s does not support deployments across %d zones.", var.application_tier.scs_cluster_disk_type, length(try(var.application_tier.scs_zones, [])))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ variable "custom_disk_sizes_filename" {
type = string
}
variable "database" {}
variable "database_cluster_disk_size" { description = "The size of the shared disk for the Database cluster" }
variable "database_cluster_disk_lun" { description = "The LUN of the shared disk for the Database cluster" }

variable "database_dual_nics" {
description = "Defines if the HANA DB uses dual network interfaces"
Expand Down
Loading

0 comments on commit 1fff160

Please sign in to comment.