Skip to content

Commit c3b09fb

Browse files
AFS fixes (#143)
1 parent 96fe09e commit c3b09fb

14 files changed

+291
-48
lines changed

src/module_utils/filesystem_collector.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ def _parse_filesystem_data(
110110

111111
if not matched:
112112
for nfs_share in afs_storage_data:
113+
storage_account_name = nfs_share.get("Pool", "")
113114
share_address = nfs_share.get("NFSAddress", "")
114-
if ":" in share_address and share_address.split(":")[0] == nfs_address:
115+
if (
116+
":" in share_address and share_address.split(":")[0] == nfs_address
117+
) or storage_account_name in nfs_address:
115118
filesystem_entry["max_mbps"] = nfs_share.get("ThroughputMibps", 0)
116119
filesystem_entry["max_iops"] = nfs_share.get("IOPS", 0)
117120
filesystem_entry["nfs_type"] = "AFS"

src/modules/configuration_check_module.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,12 @@ def run(self):
934934
context["hostname"] = custom_hostname
935935

936936
self.set_context(context)
937-
if self.context.get("check_type", {}).get("file_name") in ["hana", "db2"]:
937+
if self.context.get("check_type", {}).get("file_name") in [
938+
"hana",
939+
"db2",
940+
"ascs",
941+
"app",
942+
]:
938943
temp_context = FileSystemCollector(parent=self).collect(
939944
check=None, context=self.context
940945
)

src/modules/get_azure_lb.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,7 @@ def get_private_ip_from_config(config):
243243
Extract private IP from frontend config, handling different key variations.
244244
Azure SDK might return different structures based on authentication context.
245245
"""
246-
private_ip = (
247-
config.get("private_ip_address")
248-
or config.get("privateIpAddress")
249-
)
246+
private_ip = config.get("private_ip_address") or config.get("privateIpAddress")
250247
return private_ip
251248

252249
found_load_balancer = next(

src/playbook_00_configuration_checks.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@
1414
become: true
1515
ansible.builtin.pip:
1616
name:
17-
- ansible-runner
17+
- azure-identity
1818
- azure-kusto-data
1919
- azure-kusto-ingest
20+
- azure-mgmt-compute
21+
- azure-mgmt-network
22+
- azure-storage-blob
23+
- azure-storage-queue
24+
2025

2126
- name: "Generate test group ID and timestamp"
2227
ansible.builtin.set_fact:
@@ -438,8 +443,8 @@
438443
ansible.builtin.include_tasks: "./roles/misc/tasks/render-html-report.yml"
439444
vars:
440445
html_template_name: "./templates/config_checks_report.html"
441-
report_file_name: "CONFIG_{{ sap_sid | upper }}_{{ platform | upper }}_{{ test_group_invocation_id }}"
446+
report_file_name: "CONFIG_{{ sap_sid | upper }}_{{ platform | upper }}"
442447

443448
- name: "Debug the file name of the report generated"
444449
ansible.builtin.debug:
445-
msg: "Report file CONFIG_{{ sap_sid | upper }}_{{ platform | upper }}_{{ test_group_invocation_id }} generated."
450+
msg: "Report file CONFIG_{{ sap_sid | upper }}_{{ platform | upper }} generated."

src/playbook_00_ha_db_functional_tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
become: true
1616
ansible.builtin.pip:
1717
name:
18-
- ansible-runner
18+
- azure-identity
1919
- azure-kusto-data
2020
- azure-kusto-ingest
21-
- azure-identity
21+
- azure-mgmt-compute
2222
- azure-mgmt-network
23+
- azure-storage-blob
24+
- azure-storage-queue
2325
- pandas
2426

2527
- hosts: "{{ sap_sid | upper }}_DB"

src/playbook_00_ha_scs_functional_tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@
1515
become: true
1616
ansible.builtin.pip:
1717
name:
18-
- ansible-runner
18+
- azure-identity
1919
- azure-kusto-data
2020
- azure-kusto-ingest
21+
- azure-mgmt-compute
22+
- azure-mgmt-network
23+
- azure-storage-blob
24+
- azure-storage-queue
25+
- pandas
2126

2227
- hosts: "{{ sap_sid | upper }}_SCS:
2328
{{ sap_sid | upper }}_ERS"

src/playbook_01_ha_offline_tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
- name: "Install python azure pacakges required"
1515
ansible.builtin.pip:
1616
name:
17-
- ansible-runner
17+
- azure-identity
1818
- azure-kusto-data
1919
- azure-kusto-ingest
20-
- azure-identity
20+
- azure-mgmt-compute
2121
- azure-mgmt-network
22+
- azure-storage-blob
23+
- azure-storage-queue
2224
- pandas
2325

2426
- name: "Set the test group name based on the inputs"

src/roles/configuration_checks/tasks/disks.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,38 +195,46 @@
195195
when:
196196
- has_nfs_mounts | bool
197197
- NFS_provider is defined
198-
- "'AFS' in NFS_provider"
198+
- NFS_provider == "AFS"
199199
- afs_storage_accounts is defined
200200
- afs_storage_accounts | length > 0
201201
register: afs_storage_metadata_results
202202
delegate_to: localhost
203+
vars:
204+
accounts_list: "{{ afs_storage_accounts | join(' ') }}"
203205
ansible.builtin.shell:
204206
executable: /bin/bash
205207
cmd: |
208+
#!/bin/bash
206209
set -o pipefail
207-
for acc in {{ afs_storage_accounts | join(' ') }}; do
208-
sa_info=$(az storage account show --name "$acc" --query "{rg:resourceGroup,name:name,id:id}" -o tsv)
210+
for acc in {{ accounts_list }}; do
211+
sa_info=$(az storage account show --name "$acc" --query "{rg:resourceGroup,name:name,id:id}" -o tsv 2>&1)
212+
if [ $? -ne 0 ] || [ -z "$sa_info" ]; then
213+
echo "Error: Failed to retrieve storage account info for $acc: $sa_info" >&2
214+
continue
215+
fi
209216
rg=$(echo "$sa_info" | awk '{print $1}')
210217
sid=$(echo "$sa_info" | awk '{print $3}')
211-
dns="$acc.file.core.windows.net"
212-
for sh in $(az storage share-rm list --resource-group "$rg" --storage-account "$acc" \
213-
--query "[?enabledProtocols=='NFS'].[name,accessTier,quotaGiB]" -o tsv); do
214-
name=$(echo "$sh" | awk '{print $1}')
215-
tier=$(echo "$sh" | awk '{print $2}')
216-
quota=$(echo "$sh" | awk '{print $3}')
217-
peip=$(az network private-endpoint list \
218-
--query "[?privateLinkServiceConnections[?privateLinkServiceId=='$sid']].customDnsConfigs[].ipAddresses[]" -o tsv)
219-
for ip in $peip; do
220-
thr=$((100 + ( (quota*4+99)/100 ) + ( (quota*6+99)/100 ) ))
221-
iops=$((quota+3000))
222-
if [ $iops -gt 100000 ]; then iops=100000; fi
223-
echo "{\"Type\":\"AFS\",\"Name\":\"$name\",\"Pool\":\"$acc\",\"ServiceLevel\":\"$tier\",\"ThroughputMibps\":$thr,\"ProtocolTypes\":\"NFS4.1\",\"NFSAddressDNS\":\"$dns:/$acc/$name\",\"NFSAddress\":\"$ip:/$acc/$name\",\"QoSType\":\"Manual\",\"IOPS\":$iops,\"Id\":\"$sid\"}"
224-
done
218+
dns="$acc.privatelink.file.core.windows.net"
219+
share_list=$(az storage share-rm list --resource-group "$rg" --storage-account "$acc" \
220+
--query "[?enabledProtocols=='NFS'].[name,accessTier,shareQuota]" -o tsv 2>&1)
221+
if [ $? -ne 0 ]; then
222+
echo "Error: Failed to list shares for storage account $acc: $share_list" >&2
223+
continue
224+
fi
225+
echo "$share_list" | \
226+
while IFS=$'\t' read -r name tier quota; do
227+
if [ -z "$name" ]; then
228+
continue
229+
fi
230+
thr=$((100 + ( (quota*4+99)/100 ) + ( (quota*6+99)/100 ) ))
231+
iops=$((quota+3000))
232+
if [ $iops -gt 100000 ]; then iops=100000; fi
233+
echo "{\"Type\":\"AFS\",\"Name\":\"$name\",\"Pool\":\"$acc\",\"ServiceLevel\":\"$tier\",\"Quota\":\"$quota\",\"ThroughputMibps\":$thr,\"ProtocolTypes\":\"NFS4.1\",\"NFSAddressDNS\":\"$dns:/$acc/$name\",\"NFSAddress\":\"$dns:/$acc/$name\",\"QoSType\":\"Manual\",\"IOPS\":$iops,\"Id\":\"$sid\"}"
225234
done
226235
done
227236
228237
- name: Debug AFS storage data collected
229238
when: afs_storage_metadata_results is defined
230239
ansible.builtin.debug:
231-
verbosity: 1
232240
var: afs_storage_metadata_results

src/roles/configuration_checks/tasks/files/app.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ enums:
7979
report:
8080
- check: &check "check"
8181
- section: &section "section"
82+
- table: &table "table"
8283

8384
# Checks for APP roles
8485

@@ -262,3 +263,103 @@ checks:
262263
references:
263264
other: "https://www.suse.com/support/kb/doc/?id=000019722"
264265

266+
- id: "APP-0008"
267+
name: "Filesystem Mount Points"
268+
description: "Lists all mounted filesystems and their types to ensure APP directories are configured with supported filesystems."
269+
category: *sap_check
270+
severity: *info
271+
workload: *sap
272+
applicability:
273+
os_type: [*suse, *redhat]
274+
os_version: *all_versions
275+
hardware_type: *vm
276+
storage_type: *all_storage
277+
role: [*app_role, *pas]
278+
collector_type: *azure
279+
collector_args:
280+
resource_type: "filesystem"
281+
report: *table
282+
references:
283+
sap: "2972496"
284+
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
285+
286+
- id: "APP-0009"
287+
name: "Azure Disks"
288+
description: "Lists all attached Azure disks to ensure APP directories are configured with supported disks."
289+
category: *sap_check
290+
severity: *info
291+
workload: *sap
292+
applicability:
293+
os_type: [*suse, *redhat]
294+
os_version: *all_versions
295+
hardware_type: *vm
296+
storage_type: *all_storage
297+
role: [*app_role, *pas]
298+
collector_type: *azure
299+
collector_args:
300+
resource_type: "azure_disks"
301+
report: *table
302+
references:
303+
sap: "2972496"
304+
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
305+
306+
307+
- id: "APP-0010"
308+
name: "LVM Groups"
309+
description: "Lists all LVM groups to ensure APP server directories are configured with supported LVM configurations."
310+
category: *sap_check
311+
severity: *info
312+
workload: *sap
313+
applicability:
314+
os_type: [*suse, *redhat]
315+
os_version: *all_versions
316+
hardware_type: *vm
317+
storage_type: *all_storage
318+
role: [*app_role, *pas]
319+
collector_type: *azure
320+
collector_args:
321+
resource_type: "lvm_groups"
322+
report: *table
323+
references:
324+
sap: "2972496"
325+
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
326+
327+
- id: "APP-0011"
328+
name: "LVM Volumes"
329+
description: "Lists all LVM volumes to ensure APP server directories are configured with supported LVM configurations."
330+
category: *sap_check
331+
severity: *info
332+
workload: *sap
333+
applicability:
334+
os_type: [*suse, *redhat]
335+
os_version: *all_versions
336+
hardware_type: *vm
337+
storage_type: *all_storage
338+
role: [*app_role, *pas]
339+
collector_type: *azure
340+
collector_args:
341+
resource_type: "lvm_volumes"
342+
report: *table
343+
references:
344+
sap: "2972496"
345+
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
346+
347+
- id: "APP-0012"
348+
name: "ANF Volumes"
349+
description: "Lists all ANF volumes to ensure APP server directories are configured with supported ANF configurations."
350+
category: *sap_check
351+
severity: *info
352+
workload: *sap
353+
applicability:
354+
os_type: [*suse, *redhat]
355+
os_version: *all_versions
356+
hardware_type: *vm
357+
storage_type: *all_storage
358+
role: [*app_role, *pas]
359+
collector_type: *azure
360+
collector_args:
361+
resource_type: "anf_volumes"
362+
report: *table
363+
references:
364+
sap: "2972496"
365+
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"

0 commit comments

Comments
 (0)